public override void Reset() { _player = null; _poof = null; _end = null; _tiles.Clear(); }
public Poof CreatePoof() { var poof = new Poof(); poof.Transform.Position = Vector2.Zero; poof.AddComponent(new Animator { Animations = new[] { new Animation(_contentManager.Load <Texture2D>("poof"), new Point(32, 32)) { Looped = false, Name = "poof", Speed = 0.25f } }, }); poof.AddComponent(new Sprite { Texture2D = _contentManager.Load <Texture2D>("blank"), ZIndex = 1000 }); SystemMessageBroker.Send(new EntityCreated(poof)); return(poof); }
public void Escaping(Meepo me, EarthBind earthBind, Poof poof, Hero _globalTarget) { var handle = me.Handle; //bool nh; //if (!Variables.NeedHeal.TryGetValue(handle, out nh)) // Variables.NeedHeal.Add(handle, false); var perc = me.Health / (float)me.MaximumHealth * 100; if (!me.HasModifiers(new[] { "modifier_fountain_aura", "modifier_fountain_aura_buff" }, false)) { if (Utils.SleepCheck("move check" + handle)) { var anyEnemyHero = Heroes.GetByTeam(me.GetEnemyTeam()) .FirstOrDefault(x => x.IsAlive && x.IsVisible && x.Distance2D(me) <= 800); if (anyEnemyHero != null) { //var earthBind = Variables.earthBindList[handle]; if (earthBind != null && earthBind.CanBeCasted() && !anyEnemyHero.HasModifier("modifier_meepo_earthbind")) { earthBind.CastSpell(anyEnemyHero); } } var anyAllyMeepoNearBase = Variables.MeepoList.Where( x => !Heroes.GetByTeam(me.GetEnemyTeam()).Any(y => y.Distance2D(x) <= 1500)) .OrderBy(z => z.Distance2D(Fountain.GetAllyFountain())).FirstOrDefault(); if (anyAllyMeepoNearBase == null) { me.Move(Fountain.GetAllyFountain().Position); } else { if (anyAllyMeepoNearBase == me) { me.Move(Fountain.GetAllyFountain().Position); } else { if (poof.CanBeCasted()) { poof.Use(anyAllyMeepoNearBase.Position); } else { me.Move(Fountain.GetAllyFountain().Position); } } } Utils.Sleep(500, "move check" + handle); } } }
public override void Handle(EntityDestroyed message) { switch (message.Entity) { case Tile tile: _tiles.Remove(tile); break; case Player _: _player = null; break; case Poof _: _poof = null; break; } }
public void Handle(EntityCreated message) { switch (message.Entity) { case Tile tile: _tiles.Add(tile); break; case Player player: _player = player; break; case Poof poof: _poof = poof; break; case End end: _end = end; break; } }
private Entity LoadEnemy(Vector2 pos, string enemyType, string startDirection, string itemHeld) { Entity entity; Console.WriteLine("Initializing enemy at pos " + pos); if (startDirection.Equals("")) { startDirection = "right"; } // Parse direction (passed in as string) into Direction enumerable type Constants.Direction direction; switch (startDirection) { case "up": direction = Constants.Direction.UP; break; case "right": direction = Constants.Direction.RIGHT; break; case "down": direction = Constants.Direction.DOWN; break; case "left": direction = Constants.Direction.LEFT; break; default: // start direction not neccessary, default is right direction = Constants.Direction.RIGHT; break; } switch (enemyType) { case "aquamentus": entity = new Aquamentus(pos); break; case "bladetrap": entity = new BladeTrap(pos); break; case "gel": entity = new Gel(pos); break; case "goriya": entity = new Goriya(pos); break; case "keese": entity = new Keese(pos); break; case "rope": entity = new Rope(pos); break; case "stalfo": entity = new Stalfo(pos); if (itemHeld == "regularkey") { BasicSprite keySprite = ItemSpriteFactory.Instance.CreateRegularKey(); keySprite.offsets = new List <Vector2> { new Vector2(4, 0) }; entity.AddComponent(new Sprite(keySprite)); entity.GetComponent <StalfoMovement>().SetItemHeldTrue(); } break; case "wallmaster": entity = new WallMaster(pos, direction); break; default: Console.WriteLine("Level @ LoadEnemy(): Unrecognized enemyType \"" + enemyType + "\"!"); return(null); } var poof = new Poof(pos, entity); Scene.Add(entity); Scene.Add(poof); var transform = Root.GetComponent <Transform>(); transform.AddChild(poof); numEnemiesLeft++; enemyList.Add((Enemy)entity); return(entity); }