Пример #1
0
 private void OnDestroy()
 {
     if (inst == this)
     {
         inst = null;
     }
 }
Пример #2
0
 private void Awake()
 {
     inst    = this;
     manager = GameObject.Find("Manager").GetComponent <ProjManager>();
     plane   = manager.dragPlane;
     plane.gameObject.SetActive(true);
     initPos();
     initRange();
 }
Пример #3
0
    private void Awake()
    {
        inst = this;
        GameObject obj = GameObject.Find("UICanvas");

        if (obj == null)
        {
            NeedCameraControl = false;
        }
        else
        {
            if (GameObject.Find("EventSystem") == null)
            {
                Debug.LogWarning("UGUI EventSystem can not be found in this scene. CameraController need UGUI EventSystem.");
            }
        }
    }
Пример #4
0
    public void Spawn()
    {
        var         unit        = (Enemy)Instantiate(enemy, projSpawn.position, projSpawn.rotation);
        ProjManager projManager = unit.GetComponent <ProjManager>();

        projManager.mode           = parent.mode;
        projManager.objectsManager = parent.objectsManager;
        unit.mode           = parent.mode;
        unit.objectsManager = parent.objectsManager;
        //projectile.mode = parent.mode;
        // Add velocity to the bullet
        unit.GetComponent <Rigidbody2D>().velocity = new Vector2(0f, 1f) * speed;
        // add the unit to the list of obj
        //parent.objectsManager.AddOjbToList(unit.gameObject);
        //unit.GetComponent<SpriteManager>().mode = parent.mode;
        //unit.GetComponent<ProjManager>().projPrefab.GetComponent<SpriteManager>().mode = parent.mode;

        parent.IncrementNrOfEnemyesSpawned();
    }