示例#1
0
        public override bool Collided(CollidableGameObject obj)
        {
            float smallestDistance = -1;
            bool  collided         = false;

            for (int i = 0; i < answers.Length; i++)
            {
                Answer a = answers[i];

                if (a.Collided(obj))
                {
                    if (obj is Character)
                    {
                        float distance = (float)Math.Abs(obj.Position.X - a.Position.X);
                        if (smallestDistance == -1 || distance < smallestDistance)
                        {
                            collidedAnswer   = a;
                            smallestDistance = distance;
                            collided         = true;
                        }
                    }
                }
            }
            return(collided);
        }
        public void OpenScene()
        {
            CollidableGameObject collider = world.ColliderCheck(this);

            if (collider != null && collider.GetType().BaseType == typeof(CraftingObjects))
            {
                screen.ScreenState = ((CraftingObjects)collider).Page;
            }
        }
示例#3
0
 private void Creature_CollisionWithTiles(CollidableGameObject velocity, CollidedCell collidedCell)
 {
     if (collidedCell.Direction.X != 0)
     {
         if (!_sawPlayer)
             Creature.HDirection = (HDirection)((sbyte)(Creature.HDirection) * -1);
         else
         {
             Creature.Jump();
         }
     }
 }
示例#4
0
        public CollidableGameObject ColliderCheck(CollidableGameObject movingObject)
        {
            CollidableGameObject collider = null;
            bool canMove = false;

            foreach (var collidercheck in collidables)
            {
                collidercheck.UpdateBoundariesPos();
                movingObject.UpdateBoundariesPos();
                if (collidercheck != movingObject)
                {
                    canMove = movingObject.CheckBoundaryCollision(collidercheck);
                    if (canMove)//This should be true if it collides
                    {
                        collider = collidercheck;
                        break;
                    }
                }
            }
            return(collider);
        }
示例#5
0
文件: Projective.cs 项目: mokujin/DN
 private void OnCollisionWithTiles(CollidableGameObject sender, CollidedCell collidedCell)
 {
     if(collidedCell.CellType == CellType.Wall)
         Destroy();
 }
示例#6
0
 public override bool Collided(CollidableGameObject obj)
 {
     return(base.Collided(obj) && GetComponent <VariableMovementComponent>().CurrentVelocity == Vector3.Zero);
 }
示例#7
0
 public PositionInfoText(CollidableGameObject <AnimatedImage> target) : base(target)
 {
     Information = "_info_";
 }