Ejemplo n.º 1
0
 // handle facing direction updates
 public void ProcessFacingDirection()
 {
     if (transform.position.X > otherPlayer.transform.position.X && !isFacingLeft)
     {
         transform.flipRenderingHorizontal = true;
         isFacingLeft = true;
         animator.Flip(true);
         attackPlayer.SetAttackDirection(true);
     }
     else if (transform.position.X < otherPlayer.transform.position.X && isFacingLeft)
     {
         transform.flipRenderingHorizontal = false;
         isFacingLeft = false;
         animator.Flip(false);
         attackPlayer.SetAttackDirection(false);
     }
 }
Ejemplo n.º 2
0
        public override void Load(ContentManager content)
        {
            input        = entity.getComponent <InputManager>();
            attackPlayer = entity.getComponent <AttackPlayer>();
            animator     = entity.getComponent <SpriteAnimator <FighterAnimations> >();

            if (!playerOne)
            {
                transform.flipRenderingHorizontal = true;
                isFacingLeft = true;
                animator.Flip(true);
                attackPlayer.SetAttackDirection(true);
            }
            else
            {
                transform.flipRenderingHorizontal = false;
                isFacingLeft = false;
                animator.Flip(false);
                attackPlayer.SetAttackDirection(false);
            }
        }