public override void CollisionCheck(Player player, GameTime gameTime) { if (player.Hitbox.Intersects(Hitbox)) { Game1.EventMan.Notify(Events.PlayerHitByPlant, this); } }
public override void CheckRange(Player player, GameTime gameTime) { if (Target == null) Target = player; if (Game1.CurrentTime - LastCharge < ChargeCooldown) return; float distance = player.DrawBox.Center.Distance(DrawBox.Center); switch (State) { case StoneRobotState.Stone: break; case StoneRobotState.Normal: if (distance < ATTACK_RANGE) State = StoneRobotState.Chasing; break; case StoneRobotState.Chasing: if (distance < CHARGE_RANGE) { State = StoneRobotState.Charging; LastCharge = Game1.CurrentTime; } break; case StoneRobotState.Charging: break; } }
public override void CheckRange(Player player, GameTime gameTime) { if (TargetPerson == null) TargetPerson = player; float distance = GetDistance(player); if (BehaviourState == BehaviourStates.Aggressive) { if (distance < RANGE_CHARGE) { if (ActionState != ActionStates.Charging && ActionState != ActionStates.PreCharge) { StartPreCharge(); } } else if (distance < RANGE_FOLLOW) { if (ActionState != ActionStates.Charging) ChasePlayer(); } else if (distance >= RANGE_FOLLOW && !CurrentlyBeingShot) { GoNeutral(); } } }
public override void CheckRange(Player player, GameTime gameTime) { if (State == IcydactylStates.Swooping || State == IcydactylStates.Rising || State == IcydactylStates.Carrying) return; if (DistanceXCenter(player) < SWOOP_RANGE) Swoop(player); }
public override void CheckRange(Player player, GameTime gameTime) { if (Game1.CurrentTime - LastShower > ShowerCooldown) { if (DistanceXCenter(player) < ATTACK_DISTANCE) { LastShower = Game1.CurrentTime; IciclesToAdd = MAX_ICICLES; } } }
public override void CheckRange(Player player, GameTime gameTime) { if (State == SnappingPlantState.Normal) { if (Math.Abs(player.DrawBox.Center.X - DrawBox.Center.X) < SNAPPING_RANGE) { State = SnappingPlantState.Attacking; LastSnap = Game1.CurrentTime; } } }
public override void CheckRange(Player player, GameTime gameTime) { if (Game1.CurrentTime - LastHug > CoolDownRate && State == YetiStates.Standing) { if (DistanceXCenter(player) < AGGRO_RANGE) { State = YetiStates.Chasing; Destination = player.Position; Player = player; } } }
public override void CollisionCheck(Player player, GameTime gameTime) { if ((player.State == Player.PlayerStates.Standing || player.State == Player.PlayerStates.Walking || player.State == Player.PlayerStates.Shooting) && (State == IcydactylStates.Swooping || State == IcydactylStates.Rising)) { if (Hitbox.Intersects(player.Hitbox)) { State = IcydactylStates.Carrying; Game1.EventMan.Notify(Events.PlayerPickedUpByIcydactyl, this); } } }
public override void CheckRange(Player player, GameTime gameTime) { if (Target == null) Target = player; float distance = player.DrawBox.Center.Distance(DrawBox.Center); switch (State) { case RobotSentinelStates.Attacking: if (distance > GIVE_UP_ATTACK_RANGE) RestoreState(); break; } }
public override void CollisionCheck(Player player, GameTime gameTime) { if (Hitbox.Intersects(player.Hitbox)) { // Resolve Collision Rectangle overlap = Rectangle.Intersect(Hitbox, player.Hitbox); if (Hitbox.Center.X > player.Hitbox.Center.X) player.Position.X -= overlap.Width; else player.Position.X += overlap.Width; } // Check if player hits shield // If they do, knock back with particle explosion, deal damage }
public override void CheckRange(Player player, GameTime gameTime) { if (Game1.CurrentTime - LastSwarm > SwarmCooldown) { float distToPlayer = player.DrawBox.Center.Distance(DrawBox.Center); if (distToPlayer < ATTACK_RANGE) { AttachToPlayer(player); if (State == LeechStates.Normal) Game1.EventMan.Notify(Events.PlayerSwarmedByLeeches, this); State = LeechStates.Attack; } } }
public override void CollisionCheck(Player player, GameTime gameTime) { bool playerHitWithLightning = false; Lightning lightningBolt = null; foreach (var lightning in LightningObjects) { if (lightning.Hitbox.Intersects(player.Hitbox)) { // Lightning Hit player lightning.Destroy = true; playerHitWithLightning = true; lightningBolt = lightning; } } if (playerHitWithLightning) Game1.EventMan.Notify(Events.PlayerHitWithLightning, lightningBolt); }
public override void CollisionCheck(Player Player, GameTime gameTime) { // If hugged recently, return. if (Game1.CurrentTime - LastHug < CoolDownRate) return; // Collision Check if (State != YetiStates.Hugging) { if (Hitbox.Intersects(Player.Hitbox) && (Player.State == Planet4.Player.PlayerStates.Standing || Player.State == Planet4.Player.PlayerStates.Walking || Player.State == Planet4.Player.PlayerStates.Shooting)) { State = YetiStates.Hugging; LastHug = Game1.CurrentTime; Velocity = Vector2.Zero; Game1.EventMan.Notify(Events.PlayerHugged, this); } } }
public override void CheckRange(Player player, GameTime gameTime) { float distanceToPlayer = DistanceXCenter(player); Player = player; // Normal : Aggro Range : Chase // Chase : Punch Range : Chase // Chase : Giveup Range : Chase bool inAggroRange = distanceToPlayer < AGGRO_RANGE; bool inPunchRange = distanceToPlayer < PUNCH_RANGE; bool outsideGiveupRange = distanceToPlayer > GIVEUP_RANGE; bool canPunch = Game1.CurrentTime - LastPunchHit > PunchCooldown; switch (State) { case RockGuyStates.Normal: if (canPunch && inAggroRange) State = RockGuyStates.Chasing; break; case RockGuyStates.Chasing: if (canPunch && inPunchRange) { State = RockGuyStates.Punching; LastPunchHit = Game1.CurrentTime; } if (outsideGiveupRange) State = RockGuyStates.Normal; break; case RockGuyStates.Punching: break; } }
public override void CheckRange(Player player, GameTime gameTime) { if (State == SwarmState.MovingToDestination) return; // Get aggro if (!IsAggro && gameTime.TotalGameTime - LastAttack > AttackCooldown) { float distSqr = Vector2.DistanceSquared(player.Position, Position); if (distSqr < AggroRange * AggroRange) { IsAggro = true; Player = player; } } // If center point is over player if (player.Hitbox.Over(Position)) { Game1.EventMan.Notify(Events.PlayerSwarmedBySwarm, this); State = SwarmState.Attacking; } }
public override void CheckRange(Player player, GameTime gameTime) { // Do nothing }
public virtual void CheckRange(Player player, GameTime gameTime) { }
public virtual void CollisionCheck(Player player, GameTime gameTime) { // Nothing by default }
public override void CheckRange(Player player, GameTime gameTime) { if (DistanceXCenter(player) < ATTACK_DISTANCE) ShootLightning(); }
public override void CollisionCheck(Player player, GameTime gameTime) { foreach (var item in Icicles) item.CollisionCheck(player, gameTime); }
public override void CheckRange(Player player, GameTime gameTime) { }
public override void CollisionCheck(Player player, GameTime gameTime) { if (player.Hitbox.Intersects(Hitbox)) { Destroy = true; Game1.EventMan.Notify(Events.PlayerHitWithIcicle, this); } }
void AttachToPlayer(Player player) { Position = player.DrawBox.Center.ToVector2(); Position.X -= DrawBox.Width / 2; }
public override void CollisionCheck(Player player, GameTime gameTime) { if (!Destroy) { if (player.Hitbox.Intersects(Hitbox)) { Game1.EventMan.Notify(Events.PlayerHitByFlamingBoulder, this); DeregisterEvents(); } } }
public Controller() : base() { int currentPlanet = DB.CurrentPlanet; Player = new Player(new Vector2(World.WORLD_WIDTH / 2, 100)); Type = (PlanetTypes)DB.Planets[currentPlanet].PlanetType; Camera = new Camera(); WhaleButton = new UI.Button(Player.Position.X, 100, "Planet/WhaleButton", Events.GoToSystemView); if (currentPlanet != 7) { Generators.Add(new Generator(new Vector2(0, 250))); Generators.Add(new Generator(new Vector2(World.WORLD_WIDTH - Generator.WIDTH, 250))); } else { AncientMachines.Add(new AncientMachine(new Vector2(0, 250))); AncientMachines.Add(new AncientMachine(new Vector2( World.WORLD_WIDTH - Generator.WIDTH, 250))); } if (Generators.Count > 0) { ActiveObjects.Add(Generators[0]); ActiveObjects.Add(Generators[1]); } foreach (var item in DB.Planets[currentPlanet].Hostiles) { switch ((HostilesTypes)item.Type) { case HostilesTypes.Boomba: ActiveObjects.Add(new Boomba(item.Position)); break; case HostilesTypes.Buffalo: ActiveObjects.Add(new Buffalo(item.Position)); break; case HostilesTypes.Bullfrog: ActiveObjects.Add(new Bullfrog(item.Position)); break; case HostilesTypes.CrushingMachine: ActiveObjects.Add(new CrushingMachine(item.Position)); break; case HostilesTypes.FireColumn: ActiveObjects.Add(new FireColumn(item.Position)); break; case HostilesTypes.FlamingBoulderSpawner: ActiveObjects.Add(new FlamingBoulder(item.Position)); break; case HostilesTypes.IceCloud: ActiveObjects.Add(new IceCloud(item.Position)); break; case HostilesTypes.IceColumn: ActiveObjects.Add(new IceColumn(item.Position)); break; case HostilesTypes.Icydactyl: ActiveObjects.Add(new Icydactyl(item.Position)); break; case HostilesTypes.Leech: ActiveObjects.Add(new Leech(item.Position)); break; case HostilesTypes.RobotSender: ActiveObjects.Add(new RobotSender(item.Position)); break; case HostilesTypes.RobotSentinel: ActiveObjects.Add(new RobotSentinel(item.Position)); break; case HostilesTypes.Rockguy: ActiveObjects.Add(new Rockguy(item.Position)); break; case HostilesTypes.SnappingPlant: ActiveObjects.Add(new SnappingPlant(item.Position)); break; case HostilesTypes.SpikeWall: ActiveObjects.Add(new SpikeWall(item.Position)); break; case HostilesTypes.StoneRobot: ActiveObjects.Add(new StoneRobot(item.Position)); break; case HostilesTypes.StormCloud: ActiveObjects.Add(new StormCloud(item.Position)); break; case HostilesTypes.Swarm: ActiveObjects.Add(new Swarm(item.Position)); break; case HostilesTypes.Yeti: ActiveObjects.Add(new Yeti(item.Position)); break; } } foreach (var item in DB.Planets[currentPlanet].Foods) Foods.Add(new Food(item.Position)); foreach (var item in DB.Planets[currentPlanet].Cubes) Cubes.Add(new Cube(item.Position)); foreach (var item in DB.Planets[currentPlanet].Critters) Critters.Add(new Critter(item.Position, item.Type)); foreach (var item in DB.Planets[currentPlanet].Peoples) Persons.Add(new Person((CharacterTypes)item.Type, item.Position)); Game1.EventMan.Register(Events.MouseMove, MouseMove); Game1.EventMan.Register(Events.MouseClick, MouseClick); Game1.EventMan.Register(Events.GoToSystemView, GoToSystemView); Game1.EventMan.Register(Events.PlayerHitByFeedback, PlayerHitByFeedback); Game1.EventMan.Register(Events.TeleportedFood, TeleportedFood); Game1.EventMan.Register(Events.PersonTeleported, PersonTeleported); WhaleButton.DeregisterEvents(); switch (Type) { case PlanetTypes.Green: Audio.Play(Music.Jungle); break; case PlanetTypes.Jungle: Audio.Play(Music.Jungle); break; case PlanetTypes.Ice: Audio.Play(Music.Ice); break; case PlanetTypes.Desert: Audio.Play(Music.Jungle); break; case PlanetTypes.Volcano: Audio.Play(Music.Volcano); break; case PlanetTypes.Machine: Audio.Play(Music.Machine); break; } }
public override void CollisionCheck(Player player, GameTime gameTime) { if (State == StoneRobotState.Charging && player.Hitbox.Intersects(Hitbox)) { Game1.EventMan.Notify(Events.KnockedBack, new ActiveObject[]{ this, player }); State = StoneRobotState.Normal; Velocity.X = 0; } }
public override void CollisionCheck(Player player, GameTime gameTime) { if (player.Hitbox.Intersects(Hitbox)) { Game1.EventMan.Notify(Events.PlayerSpottedByScanner, null); DeregisterEvents(); } }
public override void CollisionCheck(Player player, GameTime gameTime) { if (Scanner != null) Scanner.CollisionCheck(player, gameTime); }
public override void CollisionCheck(Player player, GameTime gameTime) { if (State == FireColumnState.Raised) if (player.Hitbox.Intersects(Hitbox)) Game1.EventMan.Notify(Events.PlayerHitFireColumn, this); }
void Swoop(Player player) { if (player.State == Player.PlayerStates.Standing || player.State == Player.PlayerStates.Walking || player.State == Player.PlayerStates.Shooting) { SwoopTarget = player.DrawBox.Center.ToVector2(); State = IcydactylStates.Swooping; } }