public DeadState(AbsAvatarObject avatar) : base(avatar) { avatar.Velocity = new Vector2(0, -1f); avatar.Hitbox = new BoundingBox(new Vector3(0), new Vector3(0)); updateTilRez = 0; }
public RightFallingState(AbsAvatarObject avatar) : base(avatar) { Console.WriteLine("rght falling"); avatar._velocity.X = 1.25f; avatar.isGrounded = false; }
public LeftIdleFallingState(AbsAvatarObject avatar) : base(avatar) { Console.WriteLine("left idle falling"); avatar._velocity.X = 0; avatar.isGrounded = false; }
public RightWalkingState(AbsAvatarObject avatar) : base(avatar) { Console.WriteLine("right walking"); avatar.isGrounded = true; avatar._velocity.X = 1.25f; avatar._velocity.Y = 0; }
public RightIdleState(AbsAvatarObject avatar) : base(avatar) { Console.WriteLine("right idle"); avatar.isGrounded = true; avatar._velocity.X = 0; avatar._velocity.Y = 0; }
public LeftJumpingIdleState(AbsAvatarObject avatar) : base(avatar) { // Console.WriteLine("left idle jumping"); avatar._velocity.X = 0; if (avatar.isGrounded) avatar._velocity.Y = -2.6f; avatar.isGrounded = false; }
public Level_Generator(ContentManager manager, Camera camera, AbsAvatarObject avatar, AudioManager audio) { content = manager; screen_dimensions.X = camera.Viewport.Width; screen_dimensions.Y = camera.Viewport.Height; camera_position = camera.Position; current_density = starting_density; avatarObject = avatar; this.audio = audio; }
public RightJumpingState(AbsAvatarObject avatar) : base(avatar) { //Console.WriteLine("right jumping"); avatar._velocity.X = 1.25f; if (avatar.isGrounded) { avatar._velocity.Y = -2.6f; } avatar.isGrounded = false; }
private static void TopCollide(AbsAvatarObject avatar, AbsObject obj, bool[] directionsBlocked) { if (obj is BlockObject || obj is PlatformObject) { avatar._velocity.Y = 0; avatar.Displace(0, 0.5f); directionsBlocked[0] = true; } else if (obj is EnemyObject) { avatar.TakeDamage(); avatar.ObjectsToNotCollide.Add(obj); } else if (obj is ItemObject) { switch (((ItemObject)obj).State) { case "super": avatar.Super(); avatar.hud.ChangeScore(1000); break; case "fire": avatar.Fire(); avatar.hud.ChangeScore(1000); break; case "coin": avatar.hud.GetCoin(); break; case "star": avatar.hud.ChangeScore(1000); break; case "1up": avatar.hud.ChangeLife(1); break; default: break; } } else { avatar.ObjectsToNotCollide.Add(obj); } }
public MiscObject(Vector2 startPos, ContentManager content, string type) { _opacity = 1.0f; isVisible = true; deleteThis = false; HiddenObject = null; WarpDestination = null; inRange = false; isTouching = false; _type = type; _mario = null; _hiddenObj = null; _spriteFactory = new MiscSpriteFactory(content); _sprite = _spriteFactory.build(type); _hitbox = GetHitbox(type, startPos); _position = startPos; _velocity = new Vector2(0); _acceleration = new Vector2(0); _objectsToNotCollide = new List <AbsObject>(); _objectsToAdd = new List <AbsObject>(); }
public StandardCommand(AbsAvatarObject recieve) { this.recievier = recieve; }
public TakeDamageCommand(AbsAvatarObject recieve) { this.recievier = recieve; }
public AbsMovementState(AbsAvatarObject avatar) { this.avatar = avatar; factory = new MetaFactory(avatar.powerUpState, avatar.content); avatar.Sprite = factory.build(this); }
public DownCommand(AbsAvatarObject recieve) { this.recievier = recieve; }
public AbsPowerState(AbsAvatarObject avatar) { this.avatar = avatar; factory = new MetaFactory(this, avatar.content); avatar.Sprite = factory.build(avatar.movementState); }
public SuperState(AbsAvatarObject avatar) : base(avatar) { avatar.Hitbox = new BoundingBox(new Vector3(avatar.Position.X, avatar.Position.Y, 0), new Vector3(avatar.Position.X + 16, avatar.Position.Y + 32, 0)); }
public SmallState(AbsAvatarObject avatar) : base(avatar) { avatar.Hitbox = new BoundingBox(new Vector3(avatar.Position.X + 2, avatar.Position.Y, 0), new Vector3(avatar.Position.X + 14, avatar.Position.Y + 16, 0)); }
public WarpUpState(AbsAvatarObject avatar) : base(avatar) { }
private static void BottomCollide(AbsAvatarObject avatar, AbsObject obj, bool[] directionsBlocked) { if (obj is BlockObject || obj is PlatformObject) { avatar._velocity.Y = 0; directionsBlocked[2] = true; avatar.isGrounded = true; if (avatar.movementState is LeftJumpingIdleState || avatar.movementState is LeftJumpingState) { avatar.movementState = new LeftIdleState(avatar); } else if (avatar.movementState is RightJumpingIdleState || avatar.movementState is RightJumpingState) { avatar.movementState = new RightIdleState(avatar); } } else if (obj is EnemyObject) { avatar._velocity.Y = -2; avatar.hud.ChangeScore(100); } else if (obj is ItemObject) { switch (((ItemObject)obj).State) { case "super": avatar.Super(); avatar.hud.ChangeScore(1000); break; case "fire": avatar.Fire(); avatar.hud.ChangeScore(1000); break; case "coin": avatar.hud.GetCoin(); break; case "star": avatar.hud.ChangeScore(1000); break; case "1up": avatar.hud.ChangeLife(1); break; default: break; } } else if (obj is MiscObject) { if (((MiscObject)obj).Type == "pipe_head") { avatar._velocity.Y = 0; avatar.PipeContacted = (MiscObject)obj; directionsBlocked[2] = true; avatar.isGrounded = true; if (avatar.movementState is LeftJumpingIdleState || avatar.movementState is LeftJumpingState) { avatar.movementState = new LeftIdleState(avatar); } else if (avatar.movementState is RightJumpingIdleState || avatar.movementState is RightJumpingState) { avatar.movementState = new RightIdleState(avatar); } } else { avatar.ObjectsToNotCollide.Add(obj); } } else { avatar.ObjectsToNotCollide.Add(obj); } }
public LeftCrouchingState(AbsAvatarObject avatar) : base(avatar) { avatar._velocity.X = 0; avatar._velocity.Y = 1; }
public LeftCommand(AbsAvatarObject recieve) { this.reciever = recieve; }
public RightCommand(AbsAvatarObject recieve) { this.recievier = recieve; }
private static void SideCollide(AbsAvatarObject avatar, AbsObject obj, bool[] directionsBlocked) { if (obj is BlockObject || obj is PlatformObject) { avatar._velocity.X = 0; if (Collision.GetCollisionType(avatar, obj) == Collision.CollisionType.RSide) { directionsBlocked[1] = true; } else { directionsBlocked[3] = true; } if (avatar.movementState is LeftWalkingState) { avatar.movementState = new LeftIdleState(avatar); } else if (avatar.movementState is RightWalkingState) { avatar.movementState = new RightIdleState(avatar); } else if (avatar.movementState is LeftJumpingState) { avatar.movementState = new LeftJumpingIdleState(avatar); } else if (avatar.movementState is RightJumpingState) { avatar.movementState = new RightJumpingIdleState(avatar); } } else if (obj is EnemyObject) { avatar.TakeDamage(); avatar.ObjectsToNotCollide.Add(obj); } else if (obj is ItemObject) { switch (((ItemObject)obj).State) { case "super": avatar.Super(); avatar.hud.ChangeScore(1000); break; case "fire": avatar.Fire(); avatar.hud.ChangeScore(1000); break; case "coin": avatar.hud.GetCoin(); break; case "star": avatar.hud.ChangeScore(1000); break; case "1up": avatar.hud.ChangeLife(1); break; default: break; } } else if (obj is MiscObject) { if (((MiscObject)obj).Type == "pipe_head" || ((MiscObject)obj).Type == "pipe_section") { avatar._velocity.X = 0; if (Collision.GetCollisionType(avatar, obj) == Collision.CollisionType.RSide) { directionsBlocked[1] = true; } else { directionsBlocked[3] = true; } if (avatar.movementState is LeftWalkingState) { avatar.movementState = new LeftIdleState(avatar); } else if (avatar.movementState is RightWalkingState) { avatar.movementState = new RightIdleState(avatar); } else if (avatar.movementState is LeftJumpingState) { avatar.movementState = new LeftJumpingIdleState(avatar); } else if (avatar.movementState is RightJumpingState) { avatar.movementState = new RightJumpingIdleState(avatar); } } else { avatar.ObjectsToNotCollide.Add(obj); } } else { avatar.ObjectsToNotCollide.Add(obj); } }
public SuperCommand(AbsAvatarObject recieve) { this.recievier = recieve; }