예제 #1
0
        public override void HandleCollision(Vector2 vector, AABB collision, Entity collider)
        {
            Side side = AABB.SideHit(BoundingBox, collision);

            if (side == Side.BOTTOM && collider is PlayerChar)
            {
                if (item != null)
                {
                    item.EmergingTransition();
                    item = null;
                }
                PlayerChar colliderChar = (PlayerChar)collider;
                if ((colliderChar.IsSmall() && Velocity.Equals(Vector2.Zero)))
                {
                    this.HitTransition();
                }
                else if (!colliderChar.IsSmall())
                {
                    this.BigHitTransition();
                }
            }
            // Bounce any entities off except for an emerging or inactive item
            if (collider is ItemEntity)
            {
                if (!(((ItemEntity)collider).CurrentItemState is InactiveItemState) && !(((ItemEntity)collider).CurrentItemState is EmergingItemState))
                {
                    Bounce(side, collision, collider);
                }
            }
            else if ((collider is EnemyEntity) || (collider is PlayerChar && Velocity.Y == 0))
            {
                Bounce(side, collision, collider);
            }
        }
예제 #2
0
 public virtual void DownTransition()
 {
     if (!PlayerChar.IsSmall())
     {
         this.Enter(StateMachine.Crouch);
     }
 }