コード例 #1
0
 private static void RechargeBlink(BlinkComponent blink, GameTime gameTime)
 {
     if (blink.Charges < blink.MaxCharges && blink.Cooldown.Over)
     {
         blink.Charges++;
         blink.Cooldown.SetTimer(gameTime, blink.CooldownMilliseconds);
     }
 }
コード例 #2
0
        private static bool ExecuteAttackBlink(BlinkComponent blink, InputComponent input)
        {
            if (blink.Bindings.TryGetValue(typeof(AttackBehaviorComponent), out var attackBinding))
            {
                AttackBehaviorComponent attackBehavior = attackBinding as AttackBehaviorComponent;
            }

            return(false);
        }
コード例 #3
0
        private static void SetMovementVariables(BlinkComponent blink, MovementComponent movement, InputComponent input, GameTime gameTime)
        {
            blink.MovementDurationTimer.SetTimer(gameTime, blink.BlinkMovementDurationInMilliseconds);
            blink.MovementDirection = input.MovementDirection;
            blink.MovementExitSpeed = movement.Speed;

            SetMovementVariablesForBindings(blink);

            blink.CurrentEntityState.Blinking = true;
        }
コード例 #4
0
        private static bool ExecuteMovementBlink(BlinkComponent blink, InputComponent input, GameTime gameTime)
        {
            if (blink.Bindings.TryGetValue(typeof(MovementComponent), out var movementBinding))
            {
                MovementComponent movement = movementBinding as MovementComponent;
                if (!input.MovementDirection.Equals(Vector2.Zero))
                {
                    SetMovementVariables(blink, movement, input, gameTime);
                    SetMovementBlinkSpeed(blink, movement);
                    return(true);
                }
            }

            return(false);
        }
コード例 #5
0
        private static void MaintainMovementBlink(BlinkComponent blink) //TODO Think about this, kinda wanna reorganize the blink logic in general
        {
            if (blink.Bindings.TryGetValue(typeof(MovementComponent), out var movementBinding))
            {
                MovementComponent movement = movementBinding as MovementComponent;
                if (!blink.MovementDurationTimer.Over)
                {
                    SetMovementBlinkSpeed(blink, movement);
                }
                else if (blink.MovementDurationTimer.Over && !blink.PreviousTimerOver)
                {
                    ExitMovementBlink(blink, movement);
                }

                blink.PreviousTimerOver = blink.MovementDurationTimer.Over;
            }
        }
コード例 #6
0
 private static void ExitMovementBlink(BlinkComponent blink, MovementComponent movement)
 {
     movement.Speed = blink.MovementExitSpeed;
     if (blink.Bindings.TryGetValue(typeof(CollisionComponent), out var collisionBinding))
     {
         CollisionComponent collision = collisionBinding as CollisionComponent;
         collision.IsPhasing = false;
     }
     if (blink.Bindings.TryGetValue(typeof(DrawComponent), out var drawBinding))
     {
         DrawComponent draw = drawBinding as DrawComponent;
         if (draw.Tint == Color.Cyan)
         {
             draw.Tint = Color.White;
         }
     }
     blink.CurrentEntityState.Blinking = false;
 }
コード例 #7
0
        private static void SetMovementVariablesForBindings(BlinkComponent blink)
        {
            if (blink.InvulnerableOnMovementBlink)
            {
                if (blink.Bindings.TryGetValue(typeof(HealthComponent), out var healthBinding))
                {
                    HealthComponent health = healthBinding as HealthComponent;
                    //TODO make this shit invincible, use blink duration
                }
            }

            if (blink.Bindings.TryGetValue(typeof(CollisionComponent), out var collisionBinding))
            {
                CollisionComponent collision = collisionBinding as CollisionComponent;
                collision.IsPhasing = true;
            }

            if (blink.Bindings.TryGetValue(typeof(DrawComponent), out var drawBinding)) //TODO Breunig talk about Coupling
            {
                DrawComponent draw = drawBinding as DrawComponent;
                draw.Tint = Color.Cyan;
            }
        }
コード例 #8
0
 private static void SetBlinkCooldown(BlinkComponent blink, GameTime gameTime)
 {
     blink.Cooldown.SetTimer(gameTime, blink.CooldownMilliseconds);
     blink.Charges--;
 }
コード例 #9
0
 private static void SetMovementBlinkSpeed(BlinkComponent blink, MovementComponent movement)
 {
     movement.Speed.SetVector2(new Coord2(blink.MovementDirection).ChangePolarLength(blink.BlinkMovementSpeed).Cartesian);
 }