Beispiel #1
0
 void Awake()
 {
     lookState         = LOOKSTATE.IDLE;
     Self              = transform.parent;
     lr                = true;
     aimedRotation     = Quaternion.Euler(0, idleLookAngle, 0);
     currentTriggerRot = transform.rotation;
 }
Beispiel #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;
     }
 }
Beispiel #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;
     }
 }
Beispiel #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());
     }
 }
Beispiel #5
0
 //function to call once the view direction is change
 public void ChangeLookDirection(LOOKSTATE newLookState)
 {
     time      = 0;
     lookState = newLookState;
 }
Beispiel #6
0
 //function to make unit look at front view
 public void LookMiddle()
 {
     lookState = LOOKSTATE.MIDDLE;
 }