Exemple #1
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (unitStatus.unitCheck == false)
     {
         enemyUnitMove unitMove = collision.gameObject.GetComponent <enemyUnitMove>();
         if (unitMove != null)
         {
             unitMove.canMove = true;
         }
     }
 }
Exemple #2
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Unit")
     {
         UnitStatus status = collision.gameObject.GetComponent <UnitStatus>();
         if (status != null && status.unitCheck == false)
         {
             enemyUnitMove unitMove = collision.gameObject.GetComponent <enemyUnitMove>();
             unitMove.canMove = true;
         }
     }
 }
Exemple #3
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        UnitStatus status = collision.gameObject.GetComponent <UnitStatus>();

        if (status != null && unitStatus != null)
        {
            if (unitStatus.unitCheck != status.unitCheck)
            {
                enemyUnitMove unitMove = collision.gameObject.GetComponent <enemyUnitMove>();
                if (unitMove != null)
                {
                    unitMove.canMove = false;
                }
            }
        }
    }
Exemple #4
0
    void BaseE(GameObject baseObj)
    {
        //生成場所決め
        float creX = 0f; //中立拠点の右(左)の位置に配置

        switch (BaseTag)
        {
        case 3:
            creX = 1f;
            break;

        case 4:
            creX = -1f;
            break;

        default:
            break;
        }
        Vector3    crePos  = new Vector3(creX, 0f, 0f);
        int        rand    = Random.Range(0, 5); //どの種類のユニット生成するかを決める
        GameObject unitCre =
            Instantiate(unitCreateStart.EnemyKind[rand], baseObj.transform.position + crePos, Quaternion.identity) as GameObject;
        enemyUnitMove unitMove = unitCre.GetComponent <enemyUnitMove>();

        switch (BaseTag)
        {
        case 3:
            unitMove.unitTag = 11;
            break;

        case 4:
            unitMove.unitTag = 14;
            break;

        default:
            break;
        }

        float creY = 1f; //中立拠点の上下の位置に配置

        crePos  = new Vector3(0f, creY, 0f);
        rand    = Random.Range(0, 5);
        unitCre =
            Instantiate(unitCreateStart.EnemyKind[rand], baseObj.transform.position + crePos, Quaternion.identity) as GameObject;
        unitMove = unitCre.GetComponent <enemyUnitMove>();
        switch (BaseTag)
        {
        case 3:
            unitMove.unitTag = 12;
            break;

        case 4:
            unitMove.unitTag = 15;
            break;

        default:
            break;
        }

        crePos  = new Vector3(0f, -creY, 0f);
        rand    = Random.Range(0, 5);
        unitCre =
            Instantiate(unitCreateStart.EnemyKind[rand], baseObj.transform.position + crePos, Quaternion.identity) as GameObject;
        unitMove = unitCre.GetComponent <enemyUnitMove>();
        switch (BaseTag)
        {
        case 3:
            unitMove.unitTag = 13;
            break;

        case 4:
            unitMove.unitTag = 16;
            break;

        default:
            break;
        }
    }
    }                                     //敵の魔法兵のカウント

    // Use this for initialization
    void Start()
    {
        Enemy    = new GameObject[10];
        Player   = new GameObject[10];
        Enecount = 1;
        int     i       = 0;                       //Enemyの配列のカウント
        int     j       = 0;                       //EnemyKindの配列のカウント
        int     size    = 2;                       //配列のサイズ
        float   vx      = -3f;                     //ユニットを生成するx軸の位置
        float   vy      = 1f;                      //ユニットを生成するy軸の位置
        Vector3 unitPos = new Vector3(vx, vy, 0f); //生成するユニットの位置

        while (Enemy[9] == null)
        {
            vy = 2f;
            while (i < size)
            {
                unitPos  = new Vector3(vx, vy, 0f);                                                          //生成するユニットの位置
                Enemy[i] = Instantiate(EnemyKind[j], unitPos, Quaternion.Euler(0f, 0f, 180f)) as GameObject; //プレイヤーの方を向き生成
                //Enemy[i].AddComponent<enemyUnitMove>(); //敵が移動できるようにする
                enemyUnitMove move = Enemy[i].GetComponent <enemyUnitMove>();
                move.unitTag = i + 1;
                UnitStatus unitStatus = Enemy[i].GetComponent <UnitStatus>();
                unitStatus.unitCheck = false;

                if (size == 10)
                {
                    MagicModeChange modeChange = Enemy[i].GetComponent <MagicModeChange>();
                    if (modeChange != null)
                    {
                        //modeChange.attacking = true;
                    }
                    //StartCoroutine(comp(Enemy[i]));
                }

                vy += 1.5f;
                i++;
            }
            vx   += 1.5f;
            i     = size;
            size += 2;
            j++;
        }

        i    = 0;
        j    = 0;
        size = 2;
        vx   = -3f;
        while (Player[9] == null)
        {
            vy = -3f;
            while (i < size)
            {
                unitPos   = new Vector3(vx, vy, 0f); //生成するユニットの位置
                Player[i] = Instantiate(PlayerKind[j], unitPos, Quaternion.identity) as GameObject;

                if (size == 10)
                {
                    MagicModeChange modeChange = Player[i].transform.Find("Ui&Unit/unit").gameObject.GetComponent <MagicModeChange>();
                    if (modeChange != null)
                    {
                        modeChange.attacking = true;
                    }
                    //StartCoroutine(comp(Player[i]));
                }

                vy -= 1.5f;
                i++;
            }
            vx   += 1.5f;
            i     = size;
            size += 2;
            j++;
        }
    }