Пример #1
0
    // Start is called before the first frame update
    void Start()
    {
        if (NSM == null)
        {
            NSM = GameObject.Find("SelectControl").GetComponent <NodeStateMachine>();
        }

        objectPooler = ObjectPooler.Instance;
        for (int k = 0; k < gridX; k++)
        {
            GameObject g = objectPooler.SpawnFromPool(genTag, new Vector3(-startX + k * offX, 4.4f, 0), Quaternion.identity);
            if (!gemGenerator.Contains(g))
            {
                gemGenerator.Add(g);
            }
        }
        for (int k = 0; k < gridY; k++)
        {
            for (int l = 0; l < gridX; l++)
            {
                GameObject g = objectPooler.SpawnFromPool(objTag, new Vector3(-startX + l * offX, startY - k * offY, 0), Quaternion.identity);
                g.gameObject.GetComponent <Gem>().type = (Gem_Type)Random.Range(0, Gem_Type.GetNames(typeof(Gem_Type)).Length);
                if (!gems.Contains(g))
                {
                    gems.Add(g);
                }
                g.gameObject.GetComponent <Gem>().parent = gemGenerator[l].gameObject.GetComponent <NewGemGenerator>();
                if (!gemGenerator[l].gameObject.GetComponent <NewGemGenerator>().column.Contains(g))
                {
                    gemGenerator[l].gameObject.GetComponent <NewGemGenerator>().column.Add(g);
                }

                //vecs.Add(g.transform.position);
            }
        }
    }
Пример #2
0
 public override void _Ready()
 {
     LevelStateMachine = new NodeStateMachine <Level, LevelState>(this, LevelState.PreWave, LevelState.Global);
     StartButton       = GUIManager.StartButton;
     TowerManager      = GetNode("TowerManager") as TowerManager;
 }