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; } }
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(); } } }
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); }
private void OnCollisionWithTiles(CollidableGameObject sender, CollidedCell collidedCell) { if(collidedCell.CellType == CellType.Wall) Destroy(); }
public override bool Collided(CollidableGameObject obj) { return(base.Collided(obj) && GetComponent <VariableMovementComponent>().CurrentVelocity == Vector3.Zero); }
public PositionInfoText(CollidableGameObject <AnimatedImage> target) : base(target) { Information = "_info_"; }