Example #1
0
 public void HandleFacingChange(bool val)
 {
     isFacingPositive = val;
     if( target == null )
     {
         return;
     }
     float duration = 0.5f;
     sequenceLock = new BasicTimer(duration, false);
     mySequence = DOTween.Sequence();
     mySequence.Append(transform.DOMove(DesiredCameraPosition(target.position), duration));
 }
Example #2
0
        public void SetUnderwater(bool val)
        {
            if( isUnderwater == val )
            {
                return;
            }

            isUnderwater = val;
            Vector3 pos = this.transform.position;
            if( val )
            {
                pos.y = -8;
            }
            else
            {
                pos.y = 3;
            }
            float duration = 0.15f;
            sequenceLock = new BasicTimer(duration, false);
            mySequence = DOTween.Sequence();
            mySequence.Append(transform.DOMove(pos, duration));
        }
Example #3
0
 void Awake()
 {
     swimActionTimer = new BasicTimer(swimDuration, false);
     swimActionTimer.Pause(true);
     regainEnergyTimer = new BasicTimer(regainEnergyRate, true);
 }
Example #4
0
 public void Reset()
 {
     Detach();
     eatenTimer = new BasicTimer(0f);
     lifeTime = 0f;
     health = maxHealth;
 }
Example #5
0
        public void Rotate(float deltaTime, float horizontalAxis, float verticalAxis)
        {
            bool isTurn = false;
            if( Mathf.Abs(verticalAxis) > 0.01f)
            {
                AddPitch(deltaTime, verticalAxis);
                RecomputeForward();
            }

            if( Mathf.Abs(horizontalAxis) > 0.8f)
            {
                isTurn = AddTurn(deltaTime, horizontalAxis);
            }

            if( isTurn )
            {
                speed = 0f;
                Vector3 backwards = Vector3.zero;
                if( this.transform.forward.z > 0f )
                {
                    backwards.z = -1f;
                }
                else
                {
                    backwards.z = 1f;
                }
                float duration = 0.25f;
                sequenceLock = new BasicTimer(duration, false);
                mySequence = DOTween.Sequence();
                mySequence.Append(transform.DOLookAt(thisTransform.position + backwards, duration, AxisConstraint.None));
            }
        }