Exemple #1
0
 private void Awake()
 {
     lineOfSightVisual = GetComponent <LineOfSightVisual>();
     lineofsight       = GetComponent <LineOfSight>();
     shooting1         = GetComponent <Shooting1>();
     chaseAI           = GetComponent <ChaseAI>();
 }
Exemple #2
0
    private void Start()
    {
        targetRotation = transform.rotation;
        if (GetComponent <Rigidbody>() != null)
        {
            rBody = GetComponent <Rigidbody>();
        }
        else
        {
            Debug.LogError("No RigidBody Attached to the Character");
        }

        if (GetComponent <Animator>() != null)
        {
            anim = GetComponent <Animator>();
        }
        else
        {
            Debug.LogError("No Animator Attached to the Character");
        }

        if (enemy.GetComponent <ChaseAI>() != null)
        {
            enemyAI = enemy.GetComponent <ChaseAI>();
        }
        else
        {
            Debug.LogError("No ChaseAI Attached to the Enemy");
        }

        if (gameManager.GetComponent <MapGrid>() != null)
        {
            if (gameManager.GetComponent <MapGrid>().Grid != null)
            {
                currNode = gameManager.GetComponent <MapGrid>().NodeFromWorldPoint(transform.position);
            }
        }
        else
        {
            Debug.LogError("GameManager has no Grid Component");
        }

        forwardInput = 0;
        turnInput    = 0;
    }