Exemple #1
0
        /// <summary>
        /// Called by client component every tick.
        /// </summary>
        public override void Update(double deltaTime)
        {
            if (!(IsEnabled && CheckPrecondition()))
            {
                Stop();
                return;
            }

            if (attackInProgress)
            {
                if (currentTargetObject?.PhysicsBody != null &&
                    ValidateTarget(currentTargetObject, out Vector2D targetPoint))
                {
                    MovementManager.RotationTargetPos = targetPoint;
                    if (!PlayerCharacter.GetPrivateState(CurrentCharacter).WeaponState.IsFiring)
                    {
                        // On mouse button release firing is stopped, set it on again
                        WeaponSystem.ClientChangeWeaponFiringMode(true);
                    }
                }
                else
                {
                    StopAttack();
                    FindAndAttackTarget();
                }
            }
        }
Exemple #2
0
 private void StopAttack()
 {
     if (attackInProgress)
     {
         MovementManager.OverrideRotate = false;
         attackInProgress = false;
         WeaponSystem.ClientChangeWeaponFiringMode(false);
     }
 }
Exemple #3
0
 private void AttackTarget(IStaticWorldObject targetObject, Vector2D intersectionPoint)
 {
     if (targetObject == null)
     {
         return;
     }
     currentTargetObject = targetObject;
     MovementManager.RelativeRotate(intersectionPoint, GetWeaponOffset());
     WeaponSystem.ClientChangeWeaponFiringMode(true);
     attackInProgress = true;
 }