Ejemplo n.º 1
0
        /// <summary>
        /// Updates current state.
        /// </summary>
        public void Update()
        {
            if (TimeLeftForNextStep >= -float.Epsilon)
            {
                TimeLeftForNextStep -= Time.deltaTime;
            }
            else
            {
                switch (Step)
                {
                case AimStep.Enter:
                    Step = AimStep.Aiming;
                    TimeLeftForNextStep = TimeAimToLeave;
                    break;

                case AimStep.Aiming:
                    if (LeaveAfterAiming)
                    {
                        Step             = AimStep.None;
                        LeaveAfterAiming = false;
                    }
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Starts off a transition to aim, wait's for ImmediateAim() to finish it.
        /// </summary>
        /// <param name="angle">Degrees in world space to point the gun at.</param>
        public void WaitAim(float angle)
        {
            Angle = angle;

            if (Step == AimStep.Aiming)
            {
                LeaveAfterAiming = false;
            }
            else if (Step != AimStep.Enter)
            {
                Step = AimStep.Enter;
                TimeLeftForNextStep = 10000;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Starts off a transition to aim, used when in cover.
        /// </summary>
        /// <param name="angle">Degrees in world space to point the gun at.</param>
        public void CoverAim(float angle)
        {
            Angle = angle;

            if (Step == AimStep.Aiming)
            {
                LeaveAfterAiming = false;
            }
            else if (Step != AimStep.Enter)
            {
                Step = AimStep.Enter;
                TimeLeftForNextStep = TimeEnterToAim;
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Immediately enters aiming without any transitions.
 /// </summary>
 public void ImmediateEnter()
 {
     LeaveAfterAiming    = false;
     TimeLeftForNextStep = 0;
     Step = AimStep.Aiming;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Turns on aiming immediately, used when not in cover.
 /// </summary>
 /// <param name="angle">Degrees in world space to point the gun at.</param>
 public void FreeAim(float angle)
 {
     Angle = angle;
     Step  = AimStep.Aiming;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Immediately cancels aiming without any transitions.
 /// </summary>
 public void ImmediateLeave()
 {
     LeaveAfterAiming    = false;
     TimeLeftForNextStep = 0;
     Step = AimStep.None;
 }