ふぃるゲ〜

ゲームアプリの開発をしています。また、作曲もしています。

【ピヨピヨ仕分け】操作方法

             f:id:filltomkun:20210707210911j:plain

1・・・オスひよこ

上のオス専用の柵の中にドラッグしましょう。

下のメス専用の柵の中に入れてしまったり10秒間放置すると怒られてゲームオーバーです。

 

2・・・メスひよこ

下のメス専用の柵の中にドラッグしましょう。

上のオス専用の柵の中に入れてしまったり10秒間放置すると怒られてゲームオーバーです。

 

時間制限などはありません。

時間経過で出てくるひよこがどんどん増えるので、どれだけ多く仕訳けれるか挑戦してみてください。

 

「ピヨピヨ仕分け」をApp Storeで

 

ひよこをドラッグ&ドロップできるようにする

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ObjectController : MonoBehaviour
{
    // 追加
    private Vector3 screenPoint;
    private Vector3 offset;
    private Vector2 prevPosition;

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {

    }

    void OnMouseDown()
    {
        this.screenPoint = Camera.main.WorldToScreenPoint(transform.position);
        this.offset = transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
        GetComponent<BoxCollider2D>().enabled = false;
    }

    void OnMouseDrag()
    {
        Vector3 currentScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
        Vector3 currentPosition = Camera.main.ScreenToWorldPoint(currentScreenPoint) + this.offset;
        transform.position = currentPosition;
    }

    void OnMouseUp()
    {
        GetComponent<BoxCollider2D>().enabled = true;
    }
}


}

 

時間経過でひよこが出てくる量を変える

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class GameManager : MonoBehaviour
{
    GameObject sw;
    float delta;
    float gamedelta;
    public GameObject pg;
    public GameObject pg1;
    public GameObject pg2;
    public GameObject pg3;
    public GameObject pg4;
    public GameObject pg5;

    void Start()
    {
        sw = GameObject.Find("Switch");
    }

    void Update()
    {
        gamedelta += Time.deltaTime;

        if (gamedelta >= 20)
        {
            pg1.SetActive(true);
        }

        if (gamedelta >= 40)
        {
            pg.SetActive(false);
            pg2.SetActive(true);
        }

        if (gamedelta >= 60)
        {
            pg1.SetActive(false);
            pg3.SetActive(true);
        }

        if (gamedelta >= 80)
        {
            pg2.SetActive(false);
            pg4.SetActive(true);
        }

        if (gamedelta >= 100)
        {
            pg3.SetActive(false);
            pg5.SetActive(true);
        }

        if (sw.GetComponent<MissSwitch>().Switch == true)
        {
            delta += Time.deltaTime;
            pg.SetActive(false);
            pg1.SetActive(false);
            pg2.SetActive(false);
            pg3.SetActive(false);
            pg4.SetActive(false);
            pg5.SetActive(false);
        }

        if (delta >= 2.5f)
        {
            SceneManager.LoadScene("Result");
        }
    }
}

}

 

ひよこの動きの処理

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MaleMove : MonoBehaviour
{
    float x;
    float y;
    public float YSwitch = 0;
    public float XSwitch = 0;
    public bool MissSwitch;
    bool deltaSwitch = true;
    GameObject gd;
    GameObject sw;
    float delta = 0;
    float span = 7;
    float end = 10;
    Animator animator;

    void Start()
    {
        animator = GetComponent<Animator>();
        gd = GameObject.Find("GameDirector");
        sw = GameObject.Find("Switch");
    }

    void Update()
    {
        transform.Translate(x, y, 0);

        if (deltaSwitch == true)
        {
            delta += Time.deltaTime;
        }

        if (delta >= span)
        {
            animator.SetTrigger("MaleChangeTrigger");
        }

        if (delta >= end)
        {
            animator.SetTrigger("MaleAngryTrigger");
            sw.GetComponent<MissSwitch>().Switch = true;
        }

        x = 0.015f;
        y = 0.015f;

        if (YSwitch == 1)
        {
            y *= -1;
        }

        if (YSwitch == 2)
        {
            y *= -1;
            YSwitch = 0;
        }

        if (XSwitch == 1)
        {
            x *= -1;
        }

        if (XSwitch == 2)
        {
            x *= -1;
            XSwitch = 0;
        }

        if (sw.GetComponent<MissSwitch>().Switch == true)
        {
            x = 0;
            y = 0;
            Destroy(GetComponent<ObjectController>());
            deltaSwitch = false;
            GetComponent<AudioSource>().Stop();
        }
    }

    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == "Side")
        {
            XSwitch += 1;
        }

        if (other.gameObject.tag == "Wide")
        {
            YSwitch += 1;
        }

        if (other.gameObject.tag == "Male")
        {
            gd.GetComponent<GameDirector>().AddPoint();
            transform.position = new Vector3(0, 2.55f, 0);
            Destroy(GetComponent<ObjectController>());
            animator.SetTrigger("MaleNomalTrigger");
            delta = 0;
            deltaSwitch = false;
            GetComponent<AudioSource>().Stop();
        }

        if (other.gameObject.tag == "Female")
        {
            gd.GetComponent<GameDirector>().AddPoint();
            transform.position = new Vector3(0, -3.3f, 0);
            Destroy(GetComponent<ObjectController>());
            sw.GetComponent<MissSwitch>().Switch = true;
            animator.SetTrigger("MaleAngryTrigger");
        }
    }
}

 

【お肉ぱくぱくデブエット】操作方法

f:id:filltomkun:20210519224025p:plain

1・・・プレイヤー

ひたすら食べます。

食べれば食べるだけ太ります。

 

2・・・照準

この位置に来たコマンドを入力することでプレイヤーが肉を食べます。

 

3・・・コマンド

肉を1つ食べるごとに左にずれていきます。

コマンドの順を覚えておきましょう。

 

4・・・スコア

現在食べている肉の数が表示されます。

 

5・・・タイム

ゲームの残り時間が表示されます。

制限時間は30秒なので、ひたすら食べることに集中しましょう。

 

「お肉ぱくぱくデブエット!」をApp Storeで

 

スクリプト

 

・ゲームマネージャー

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class GameManager : MonoBehaviour
{
    float delta = 30;
    float end = 0;
    GameObject SecondsText;
    public GameObject End;

    void Start()
    {
        SecondsText = GameObject.Find("Seconds");
    }

    // Update is called once per frame
    void Update()
    {
        delta -= Time.deltaTime;
        SecondsText.GetComponent<Text>().text = delta.ToString("F1");

        if (delta <= end)
        {
            End.SetActive(true);
        }
    }
}

 

・ゲーム開始処理

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameStart : MonoBehaviour
{
    GameObject mv;
    GameObject gm;
    GameObject gari;
    GameObject mg;
    float delta = 0;
    float span = 1.4f;

    void Start()
    {
        mv = GameObject.Find("Move");
        gm = GameObject.Find("GameManager");
        gari = GameObject.Find("gari");
        mg = GameObject.Find("MeatGenerator");
    }

    void Update()
    {

        delta += Time.deltaTime;

        if (delta > span)
        {
            mv.GetComponent<Move>().enabled = true;
            mv.GetComponent<AudioSource>().enabled = true;
            gm.GetComponent<GameManager>().enabled = true;
            gari.GetComponent<PlayerController>().enabled = true;
            mg.GetComponent<MeatGenerator>().enabled = true;
            Destroy(gameObject);
        }
    }
}

 

・ゲーム終了処理

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class GameEnd : MonoBehaviour
{
    GameObject mv;
    GameObject gm;
    GameObject gari;
    GameObject mg;
    float delta = 0;
    int span = 2;

    void Start()
    {
        mv = GameObject.Find("Move");
        gm = GameObject.Find("GameManager");
        gari = GameObject.Find("gari");
        mg = GameObject.Find("MeatGenerator");
    }

    void Update()
    {

        delta += Time.deltaTime;
        mv.GetComponent<Move>().enabled = false;
        gm.GetComponent<GameManager>().enabled = false;
        mv.GetComponent<AudioSource>().enabled = false;
        gari.GetComponent<PlayerController>().enabled = false;
        mg.GetComponent<MeatGenerator>().enabled = false;

        if (delta > span)
        {
            SceneManager.LoadScene("Result");
        }
    }
}

 

・プレイヤー太る処理

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour
{

    Animator animator;
    GameObject mv;
    GameObject re;

    void Start()
    {
        animator = GetComponent<Animator>();
        mv = GameObject.Find("Move");
        re = GameObject.Find("Reset");
    }

    void Update()
    {
        if (mv.GetComponent<Move>().EatSwitch == true)
        {
            animator.SetTrigger("EatTrigger");
            mv.GetComponent<Move>().EatSwitch = false;
            GetComponent<AudioSource>().Play();
        }

        if (re.GetComponent<ScoreReset>().NomalSwitch == true)
        {
            animator.SetTrigger("NomalTrigger");
        }

        if (re.GetComponent<ScoreReset>().FatSwitch == true)
        {
            animator.SetTrigger("FatTrigger");
        }

    }
}

 

・コマンド処理

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class A : MonoBehaviour
{
    GameObject gd;
    GameObject mv;

    void Start()
    {
        gd = GameObject.Find("GameDirector");
        mv = GameObject.Find("Move");
    }

    void Update()
    {
        if (transform.position.x <= -4.5f)
        {
            Destroy(gameObject);
            gd.GetComponent<GameDirector>().AddPoint();
        }
    }

    void OnTriggerEnter2D(Collider2D Other)
    {
        mv.GetComponent<Move>().ConnectA = true;
    }

    void OnTriggerExit2D(Collider2D Other)
    {
        mv.GetComponent<Move>().ConnectA = false;
    }
}

 

・コマンド移動

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Move: MonoBehaviour
{
    GameObject sw;
    GameObject ag;
    public bool ConnectA;
    public bool ConnectB;
    public bool ConnectU;
    public bool ConnectR;
    public bool ConnectD;
    public bool ConnectL;
    bool AbuttonSwitch;
    bool BbuttonSwitch;
    bool UbuttonSwitch;
    bool RbuttonSwitch;
    bool DbuttonSwitch;
    bool LbuttonSwitch;
    public bool EatSwitch = false;
    public bool MeatSwitch = false;

    void Start()
    {
        sw = GameObject.Find("Switch");
        ag = GameObject.Find("ArrowGenerator");
    }

    void Update()
    {
        if (ConnectA == true)
        {
            if (AbuttonSwitch == true)
            {
                ag.GetComponent<ArrowGenerator>().Switch = true;
                transform.Translate(-1, 0, 0);
                EatSwitch = true;
                MeatSwitch = true;
            }
        }

        if (ConnectB == true)
        {
            if (BbuttonSwitch == true)
            {
                ag.GetComponent<ArrowGenerator>().Switch = true;
                transform.Translate(-1, 0, 0);
                EatSwitch = true;
                MeatSwitch = true;
            }
        }

        if (ConnectU == true)
        {
            if (UbuttonSwitch == true)
            {
                ag.GetComponent<ArrowGenerator>().Switch = true;
                transform.Translate(-1, 0, 0);
                EatSwitch = true;
                MeatSwitch = true;
            }
        }

        if (ConnectR == true)
        {
            if (RbuttonSwitch == true)
            {
                ag.GetComponent<ArrowGenerator>().Switch = true;
                transform.Translate(-1, 0, 0);
                EatSwitch = true;
                MeatSwitch = true;
            }
        }

        if (ConnectD == true)
        {
            if (DbuttonSwitch == true)
            {
                ag.GetComponent<ArrowGenerator>().Switch = true;
                transform.Translate(-1, 0, 0);
                EatSwitch = true;
                MeatSwitch = true;
            }
        }

        if (ConnectL == true)
        {
            if (LbuttonSwitch == true)
            {
                ag.GetComponent<ArrowGenerator>().Switch = true;
                transform.Translate(-1, 0, 0);
                EatSwitch = true;
                MeatSwitch = true;
            }
        }

        if (AbuttonSwitch == true)
        {
            AbuttonSwitch = false;
        }

        if (BbuttonSwitch == true)
        {
            BbuttonSwitch = false;
        }

        if (UbuttonSwitch == true)
        {
            UbuttonSwitch = false;
        }

        if (RbuttonSwitch == true)
        {
            RbuttonSwitch = false;
        }

        if (DbuttonSwitch == true)
        {
            DbuttonSwitch = false;
        }

        if (LbuttonSwitch == true)
        {
            LbuttonSwitch = false;
        }
    }

    public void AbuttonDown()
    {
        AbuttonSwitch = true;
    }

    public void BbuttonDown()
    {
        BbuttonSwitch = true;
    }

    public void UbuttonDown()
    {
        UbuttonSwitch = true;
    }

    public void RbuttonDown()
    {
        RbuttonSwitch = true;
    }

    public void DbuttonDown()
    {
        DbuttonSwitch = true;
    }

    public void LbuttonDown()
    {
        LbuttonSwitch = true;
    }
}

 

・コマンドジェネレーター

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ArrowGenerator : MonoBehaviour
{
    public GameObject Aprefab;
    public GameObject Bprefab;
    public GameObject Uprefab;
    public GameObject Rprefab;
    public GameObject Dprefab;
    public GameObject Lprefab;
    GameObject sw;
    GameObject mv;

    public bool Switch = true;

    void Start()
    {
        mv = GameObject.Find("Move");
        sw = GameObject.Find("Switch");
    }

    // Update is called once per frame
    void Update()
    {
        if (Switch == true)
        {
            int dice = Random.Range(1, 12);

            if (dice <= 2)
            {
                GameObject go = Instantiate(Aprefab) as GameObject;
                go.transform.parent = mv.transform;
                Switch = false;
            }

            if ((dice >= 3) && (dice <= 4))
            {
                GameObject go = Instantiate(Bprefab) as GameObject;
                go.transform.parent = mv.transform;
                Switch = false;
            }

            if ((dice >= 5) && (dice <= 6))
            {
                GameObject go = Instantiate(Uprefab) as GameObject;
                go.transform.parent = mv.transform;
                Switch = false;
            }

            if ((dice >= 7) && (dice <= 8))
            {
                GameObject go = Instantiate(Rprefab) as GameObject;
                go.transform.parent = mv.transform;
                Switch = false;
            }

            if ((dice >= 9) && (dice <= 10))
            {
                GameObject go = Instantiate(Dprefab) as GameObject;
                go.transform.parent = mv.transform;
                Switch = false;
            }

            if (dice >= 11)
            {
                GameObject go = Instantiate(Lprefab) as GameObject;
                go.transform.parent = mv.transform;
                Switch = false;
            }
        }
    }
}

 

・コマンド初期位置

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class StartArrowGenerator : MonoBehaviour
{
    public GameObject Aprefab;
    public GameObject Bprefab;
    public GameObject Uprefab;
    public GameObject Rprefab;
    public GameObject Dprefab;
    public GameObject Lprefab;
    GameObject mv;

    public bool Switch1 = true;
    public bool Switch2 = true;
    public bool Switch3 = true;
    public bool Switch4 = true;
    public bool Switch5 = true;
    public bool Switch6 = true;
    public bool Switch7 = true;
    public bool Switch8 = true;
    public bool Switch9 = true;

    // Start is called before the first frame update
    void Start()
    {
        mv = GameObject.Find("Move");
    }

    // Update is called once per frame
    void Update()
    {
        if (Switch1 == true)
        {
            int dice = Random.Range(1, 12);

            if (dice <= 2)
            {
                GameObject go = Instantiate(Aprefab) as GameObject;
                go.transform.position = new Vector3(-3.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch1 = false;
            }

            if ((dice >= 3) && (dice <= 4))
            {
                GameObject go = Instantiate(Bprefab) as GameObject;
                go.transform.position = new Vector3(-3.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch1 = false;
            }

            if ((dice >= 5) && (dice <= 6))
            {
                GameObject go = Instantiate(Uprefab) as GameObject;
                go.transform.position = new Vector3(-3.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch1 = false;
            }

            if ((dice >= 7) && (dice <= 8))
            {
                GameObject go = Instantiate(Rprefab) as GameObject;
                go.transform.position = new Vector3(-3.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch1 = false;
            }

            if ((dice >= 9) && (dice <= 10))
            {
                GameObject go = Instantiate(Dprefab) as GameObject;
                go.transform.position = new Vector3(-3.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch1 = false;
            }

            if (dice >= 11)
            {
                GameObject go = Instantiate(Lprefab) as GameObject;
                go.transform.position = new Vector3(-3.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch1 = false;
            }
        }

        if (Switch2 == true)
        {
            int dice = Random.Range(1, 12);

            if (dice <= 2)
            {
                GameObject go = Instantiate(Aprefab) as GameObject;
                go.transform.position = new Vector3(-2.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch2 = false;
            }

            if ((dice >= 3) && (dice <= 4))
            {
                GameObject go = Instantiate(Bprefab) as GameObject;
                go.transform.position = new Vector3(-2.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch2 = false;
            }

            if ((dice >= 5) && (dice <= 6))
            {
                GameObject go = Instantiate(Uprefab) as GameObject;
                go.transform.position = new Vector3(-2.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch2 = false;
            }

            if ((dice >= 7) && (dice <= 8))
            {
                GameObject go = Instantiate(Rprefab) as GameObject;
                go.transform.position = new Vector3(-2.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch2 = false;
            }

            if ((dice >= 9) && (dice <= 10))
            {
                GameObject go = Instantiate(Dprefab) as GameObject;
                go.transform.position = new Vector3(-2.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch2 = false;
            }

            if (dice >= 11)
            {
                GameObject go = Instantiate(Lprefab) as GameObject;
                go.transform.position = new Vector3(-2.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch2 = false;
            }
        }

        if (Switch3 == true)
        {
            int dice = Random.Range(1, 12);

            if (dice <= 2)
            {
                GameObject go = Instantiate(Aprefab) as GameObject;
                go.transform.position = new Vector3(-1.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch3 = false;
            }

            if ((dice >= 3) && (dice <= 4))
            {
                GameObject go = Instantiate(Bprefab) as GameObject;
                go.transform.position = new Vector3(-1.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch3 = false;
            }

            if ((dice >= 5) && (dice <= 6))
            {
                GameObject go = Instantiate(Uprefab) as GameObject;
                go.transform.position = new Vector3(-1.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch3 = false;
            }

            if ((dice >= 7) && (dice <= 8))
            {
                GameObject go = Instantiate(Rprefab) as GameObject;
                go.transform.position = new Vector3(-1.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch3 = false;
            }

            if ((dice >= 9) && (dice <= 10))
            {
                GameObject go = Instantiate(Dprefab) as GameObject;
                go.transform.position = new Vector3(-1.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch3 = false;
            }

            if (dice >= 11)
            {
                GameObject go = Instantiate(Lprefab) as GameObject;
                go.transform.position = new Vector3(-1.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch3 = false;
            }
        }

        if (Switch4 == true)
        {
            int dice = Random.Range(1, 12);

            if (dice <= 2)
            {
                GameObject go = Instantiate(Aprefab) as GameObject;
                go.transform.position = new Vector3(-0.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch4 = false;
            }

            if ((dice >= 3) && (dice <= 4))
            {
                GameObject go = Instantiate(Bprefab) as GameObject;
                go.transform.position = new Vector3(-0.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch4 = false;
            }

            if ((dice >= 5) && (dice <= 6))
            {
                GameObject go = Instantiate(Uprefab) as GameObject;
                go.transform.position = new Vector3(-0.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch4 = false;
            }

            if ((dice >= 7) && (dice <= 8))
            {
                GameObject go = Instantiate(Rprefab) as GameObject;
                go.transform.position = new Vector3(-0.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch4 = false;
            }

            if ((dice >= 9) && (dice <= 10))
            {
                GameObject go = Instantiate(Dprefab) as GameObject;
                go.transform.position = new Vector3(-0.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch4 = false;
            }

            if (dice >= 11)
            {
                GameObject go = Instantiate(Lprefab) as GameObject;
                go.transform.position = new Vector3(-0.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch4 = false;
            }
        }

        if (Switch5 == true)
        {
            int dice = Random.Range(1, 12);

            if (dice <= 2)
            {
                GameObject go = Instantiate(Aprefab) as GameObject;
                go.transform.position = new Vector3(0.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch5 = false;
            }

            if ((dice >= 3) && (dice <= 4))
            {
                GameObject go = Instantiate(Bprefab) as GameObject;
                go.transform.position = new Vector3(0.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch5 = false;
            }

            if ((dice >= 5) && (dice <= 6))
            {
                GameObject go = Instantiate(Uprefab) as GameObject;
                go.transform.position = new Vector3(0.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch5 = false;
            }

            if ((dice >= 7) && (dice <= 8))
            {
                GameObject go = Instantiate(Rprefab) as GameObject;
                go.transform.position = new Vector3(0.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch5 = false;
            }

            if ((dice >= 9) && (dice <= 10))
            {
                GameObject go = Instantiate(Dprefab) as GameObject;
                go.transform.position = new Vector3(0.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch5 = false;
            }

            if (dice >= 11)
            {
                GameObject go = Instantiate(Lprefab) as GameObject;
                go.transform.position = new Vector3(0.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch5 = false;
            }
        }

        if (Switch6 == true)
        {
            int dice = Random.Range(1, 12);

            if (dice <= 2)
            {
                GameObject go = Instantiate(Aprefab) as GameObject;
                go.transform.position = new Vector3(1.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch6 = false;
            }

            if ((dice >= 3) && (dice <= 4))
            {
                GameObject go = Instantiate(Bprefab) as GameObject;
                go.transform.position = new Vector3(1.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch6 = false;
            }

            if ((dice >= 5) && (dice <= 6))
            {
                GameObject go = Instantiate(Uprefab) as GameObject;
                go.transform.position = new Vector3(1.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch6 = false;
            }

            if ((dice >= 7) && (dice <= 8))
            {
                GameObject go = Instantiate(Rprefab) as GameObject;
                go.transform.position = new Vector3(1.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch6 = false;
            }

            if ((dice >= 9) && (dice <= 10))
            {
                GameObject go = Instantiate(Dprefab) as GameObject;
                go.transform.position = new Vector3(1.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch6 = false;
            }

            if (dice >= 11)
            {
                GameObject go = Instantiate(Lprefab) as GameObject;
                go.transform.position = new Vector3(1.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch6 = false;
            }
        }

        if (Switch7 == true)
        {
            int dice = Random.Range(1, 12);

            if (dice <= 2)
            {
                GameObject go = Instantiate(Aprefab) as GameObject;
                go.transform.position = new Vector3(2.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch7 = false;
            }

            if ((dice >= 3) && (dice <= 4))
            {
                GameObject go = Instantiate(Bprefab) as GameObject;
                go.transform.position = new Vector3(2.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch7 = false;
            }

            if ((dice >= 5) && (dice <= 6))
            {
                GameObject go = Instantiate(Uprefab) as GameObject;
                go.transform.position = new Vector3(2.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch7 = false;
            }

            if ((dice >= 7) && (dice <= 8))
            {
                GameObject go = Instantiate(Rprefab) as GameObject;
                go.transform.position = new Vector3(2.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch7 = false;
            }

            if ((dice >= 9) && (dice <= 10))
            {
                GameObject go = Instantiate(Dprefab) as GameObject;
                go.transform.position = new Vector3(2.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch7 = false;
            }

            if (dice >= 11)
            {
                GameObject go = Instantiate(Lprefab) as GameObject;
                go.transform.position = new Vector3(2.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch7 = false;
            }
        }

        if (Switch8 == true)
        {
            int dice = Random.Range(1, 12);

            if (dice <= 2)
            {
                GameObject go = Instantiate(Aprefab) as GameObject;
                go.transform.position = new Vector3(3.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch8 = false;
            }

            if ((dice >= 3) && (dice <= 4))
            {
                GameObject go = Instantiate(Bprefab) as GameObject;
                go.transform.position = new Vector3(3.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch8 = false;
            }

            if ((dice >= 5) && (dice <= 6))
            {
                GameObject go = Instantiate(Uprefab) as GameObject;
                go.transform.position = new Vector3(3.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch8 = false;
            }

            if ((dice >= 7) && (dice <= 8))
            {
                GameObject go = Instantiate(Rprefab) as GameObject;
                go.transform.position = new Vector3(3.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch8 = false;
            }

            if ((dice >= 9) && (dice <= 10))
            {
                GameObject go = Instantiate(Dprefab) as GameObject;
                go.transform.position = new Vector3(3.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch8 = false;
            }

            if (dice >= 11)
            {
                GameObject go = Instantiate(Lprefab) as GameObject;
                go.transform.position = new Vector3(3.5f, 3.5f, 0);
                go.transform.parent = mv.transform;
                Switch8 = false;
            }
        }
    }
}

 

・肉処理

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MeatController : MonoBehaviour
{
    Rigidbody2D rigid2D;
    bool Switch = true;
    int x;
    int y;
    int z;

    void Start()
    {
        rigid2D = GetComponent<Rigidbody2D>();
    }

    void Update()
    {
        x = Random.Range(2, 4);
        y = Random.Range(2, 4);

        if (Switch == true)
        {
            Vector3 force = new Vector3(x, y, 0);
            rigid2D.AddForce(force, ForceMode2D.Impulse);
            Switch = false;
        }

        Destroy(gameObject, 5.0f);
    }
}

 

肉ジェネレーター

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MeatGenerator : MonoBehaviour
{
    GameObject mv;
    public GameObject MeatPrefab;

    void Start()
    {
        mv = GameObject.Find("Move");
    }

    void Update()
    {
        if (mv.GetComponent<Move>().MeatSwitch == true)
        {
            GameObject go = Instantiate(MeatPrefab) as GameObject;
            mv.GetComponent<Move>().MeatSwitch = false;
        }
    }
}

 

【UFOを堕とせ】操作方法

 

f:id:filltomkun:20210404183029j:plain

1・・・ミサイル

画面をタップすると発射します。

ただし一つのUFOに対して1発のみ!!

慎重に狙いを定めましょう。

 

2・・・照準

ミサイルがこの照準に向かって飛んでいくので、UFOがこの照準に重なるところを見計らって狙いましょう。

 

3・・・UFO

今回の標的。

UFOは色によって動きが違うので、しっかり見極めましょう。

色の種類は黄色、青、紫、緑、赤の計5つです。

ただし、レアなUFOがたまに現れます。

そのUFOを堕とせば1機アップします!

 

4・・・残機

残機は3つで、ミスをするたびUFOマークが1つずつ消えていきます。

UFOマークがすべてなくなったらゲームオーバーです。

 

5・・・得点

UFOを撃墜するたび1点増えます。

最高得点を目指して頑張りましょう!!

 

[UFOを堕とせ!]をappStoreで!