Пример #1
0
    void Awake()
    {
        // Get turret from heirachy
        GameObject turretObj = GameObject.Find("Turret");

        if (turretObj != null)
        {
            target = turretObj.GetComponent <Turret>();
        }

        // Get tank manager
        GameObject tankManagerObj = GameObject.Find("TankManager");

        if (tankManagerObj != null)
        {
            tankManager = tankManagerObj.GetComponent <TankManager>();
        }

        tankManager.AddEnemyToList(this);


        mRigidBody = GetComponent <Rigidbody>();
        //Set rotation
        lookPos            = target.transform.position - transform.position;
        transform.rotation = Quaternion.LookRotation(lookPos);
        // Set health
        mHealth = _maxHealth;
    }