Ejemplo n.º 1
0
    void Start()
    {
        GameObject counterText = GameObject.FindWithTag("EnemyCounter");

        enemyCounterScript = counterText.GetComponent <EnemyCounterScript>();
        isAbleToAttack     = true;
        isAbleToBeDamaged  = true;
        animator           = gameObject.GetComponent <Animator>();
        rBody      = gameObject.GetComponent <Rigidbody>();
        target     = GameObject.FindWithTag("Player").transform;
        player     = target.GetComponent <TyController>();
        agent      = gameObject.GetComponent <UnityEngine.AI.NavMeshAgent>(); // the agent component of
        health     = gameObject.GetComponent <Health>();
        deathSound = Resources.Load("DeathMouse") as GameObject;
    }
    // Can set new target if needed
    public void SetCameraTarget(Transform t)
    {
        target = t;

        if (target != null)
        {
            if (target.GetComponent <TyController>())
            {
                tyController = target.GetComponent <TyController>();
            }
            else
            {
                Debug.LogError("Ty doesn't have controller");
            }
        }
        else
        {
            Debug.LogError("Camera has no target");
        }
    }
Ejemplo n.º 3
0
 void Start()
 {
     target          = GameObject.FindWithTag("Player");
     player          = target.GetComponent <TyController>();
     particlesPrefab = Resources.Load("ChristmasParticles") as GameObject;
 }