Esempio n. 1
0
 void Awake()
 {
     lookState         = LOOKSTATE.IDLE;
     Self              = transform.parent;
     lr                = true;
     aimedRotation     = Quaternion.Euler(0, idleLookAngle, 0);
     currentTriggerRot = transform.rotation;
 }
Esempio n. 2
0
 void executeLookAt()
 {
     if (Quaternion.Angle(currentTriggerRot, transform.rotation) > lookDirAcc)
     {
         transform.rotation = Quaternion.Slerp(transform.rotation, currentTriggerRot, Time.deltaTime * lookSpeed);
     }
     else
     {
         currentTriggerRot = transform.rotation;
         lookState         = LOOKSTATE.NONE;
     }
 }
Esempio n. 3
0
 void return2Idle()
 {
     lr            = true;
     aimedRotation = Quaternion.Euler(0, idleLookAngle, 0);
     if (Quaternion.Angle(Self.rotation, transform.rotation) > lookDirAcc)
     {
         transform.rotation = Quaternion.Slerp(transform.rotation, Self.rotation, lookSpeed * Time.deltaTime);
     }
     else
     {
         lookState = LOOKSTATE.IDLE;
     }
 }
Esempio n. 4
0
 // initiate the action to look at a certain position and setting the corresponding lookState
 public void LookAt(Vector3 pos, LOOKSTATE lookStateIn)
 {
     if (lookStateIn == LOOKSTATE.LOOKAT || lookStateIn == LOOKSTATE.TRIGGERED)
     {
         lookState         = lookStateIn;
         currentTriggerRot = Quaternion.LookRotation(pos - transform.position);
     }
     else
     {
         Debug.Log("There was an attempt to set an invalid lookState for E"
                   + Self.GetComponent <EnemyBrain>().enemyIndex.ToString());
     }
 }
Esempio n. 5
0
 //function to call once the view direction is change
 public void ChangeLookDirection(LOOKSTATE newLookState)
 {
     time      = 0;
     lookState = newLookState;
 }
Esempio n. 6
0
 //function to make unit look at front view
 public void LookMiddle()
 {
     lookState = LOOKSTATE.MIDDLE;
 }