Example #1
0
 // Use this for initialization
 void Start()
 {
     controller = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController> ();
     anim       = GetComponent <Animator> ();
     look       = GetComponent <LookAt> ();
     alertLvl   = GetComponent <NPCradar> ();
 }
Example #2
0
 void Start()
 {
     myRadar    = GetComponent <NPCradar> ();
     isLooking  = false;
     t          = 0;
     viewTarget = GameObject.FindGameObjectsWithTag("Player")[0].transform;
     anim       = GetComponent <Animator>();   //liitetään parametri hahmon Animator-komponenttiin
 }
Example #3
0
 // Use this for initialization
 void Start()
 {
     myRadar            = gameObject.GetComponent <NPCradar> ();
     anim               = GetComponent <Animator> ();
     look               = GetComponent <LookAt> ();
     alertLvl           = GetComponent <NPCradar> ();
     alertLvl.isWalking = false;
 }
Example #4
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        roundRotation   = animator.gameObject.transform.eulerAngles;
        roundRotation.x = Mathf.Round(roundRotation.x / 90) * 90;
        roundRotation.y = Mathf.Round(roundRotation.y / 90) * 90;
        roundRotation.z = Mathf.Round(roundRotation.z / 90) * 90;
        animator.gameObject.transform.eulerAngles = roundRotation;

        npcControl               = animator.gameObject.GetComponent <NpcDownW> ();
        characterTrans           = animator.gameObject.GetComponent <Transform> ();
        alertLevel               = animator.gameObject.GetComponent <NPCradar> ();
        animator.applyRootMotion = false;
        wDirection               = false;
        if (animator.gameObject.transform.position.x > 3.0f)
        {
            wDirection = true;
        }
        npcControl.isWalking = true;
    }
Example #5
0
 // Use this for initialization
 void Start()
 {
     anim     = GetComponent <Animator> ();
     look     = GetComponent <LookAt> ();
     alertLvl = GetComponent <NPCradar> ();
 }