Example #1
0
    void CheckerInstantiate(int num)      // функция создания чекера
    {
        GameObject Obs;

        if (num == 1)
        {
            if (XLvl == 1)
            {
                Obs = Instantiate(GenObs.LeftChecker, new Vector3(Coordinate.x - 1.5f * XLvl,
                                                                  Coordinate.y, Coordinate.z), Quaternion.identity) as GameObject;
            }

            else
            {
                Obs = Instantiate(GenObs.RightChecker, new Vector3(Coordinate.x - 1.5f * XLvl,
                                                                   Coordinate.y, Coordinate.z), Quaternion.identity) as GameObject;
            }
        }
        else
        {
            if (XLvl == 1)
            {
                Obs = Instantiate(GenObs.RightChecker, new Vector3(Coordinate.x + 1.5f * XLvl,
                                                                   Coordinate.y, Coordinate.z), Quaternion.identity) as GameObject;
            }

            else
            {
                Obs = Instantiate(GenObs.LeftChecker, new Vector3(Coordinate.x + 1.5f * XLvl,
                                                                  Coordinate.y, Coordinate.z), Quaternion.identity) as GameObject;
            }
        }

        Obs.transform.SetParent(Island [IslandNum].gameObject.transform);

        if (Obs.GetComponent <EdgeChecker>())
        {
            Obs.GetComponent <EdgeChecker> ().XLvl = XLvl;
        }
    }