Пример #1
0
    private void SpawnEnemy()
    {
        GameObject  go   = Instantiate(m_Enemies[Random.Range(0, m_Enemies.Count)], m_SpawnPoint.transform.position, Quaternion.identity);
        GenericUnit unit = go.GetComponent <GenericUnit>();

        go.transform.parent = GameObject.Find("_Units").transform;
        unit.Initialize(Team.Team2, unit.GetUnitData());
    }
Пример #2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(m_Key))
     {
         GameObject  unitObject = Instantiate(m_Prefab, transform.position, Quaternion.identity);
         GenericUnit unit       = unitObject.GetComponent <GenericUnit>();
         unit.Initialize(m_Team, m_Data);
     }
 }