public override void Event(Player plr) { //plr.GivePart(_bodyPart); //TextManager.AddText(plr.MidPosition, "Acquired "+_bodyPart.GetName(), 4500, Color.Green, Color.Transparent); //_parent.RemoveChild(); //_map.TimeSpawn(_bodyPart.GetID(), _bodyPart.GetSpawnTime()); //WorldController.SendText("Picked up " + _bodyPart.GetName()+"!"); }
public override void Update(Player player, float ms) { currentPulse += up ? ms * pulseSpeed : -ms * pulseSpeed; if (currentPulse > pulseMax) up = false; if(currentPulse<-pulseMax) up=true; player.Map.SetGlow(player.ID, player.MidPosition, Color.DarkGreen, strength + currentPulse, true, 2000); }
public override void Jump(Player player, float strength) { if (player.OnGround) { Vector2 newSpeed = player.Speed; newSpeed.Y -= jumpBonus; player.Speed = newSpeed; } }
public override void Jump(Player player, float strength) { if (!player.OnGround && airJumps<airJumpMax) { Vector2 newSpeed = player.Speed; newSpeed.Y += - airJumpStrength; if(newSpeed.Y<-airJumpStrength) newSpeed.Y=-airJumpStrength; player.Speed = newSpeed; airJumps++; } }
public override void Update(Player player, float ms) { if (player.OnGround) { currentHoverTime = 0; } else { Vector2 playerMovement = player.Speed; if (playerMovement.Y > 0 && currentHoverTime < maxHoverTime) { currentHoverTime += ms; playerMovement.Y = 0; player.Speed = playerMovement; } } }
public override void Move(Player player, float dir, float yDir) { if (wasOnWall && !player.OnWall) { Vector2 speed = player.Speed; speed.Y = 0; player.Speed = speed; } if (player.OnWall) { Vector2 speed = player.Speed; speed.Y += yDir * speedBonus; player.Speed = speed; wasOnWall = true; } else wasOnWall = false; }
public Inventory(Player owner) { _items = new List<ICollectible>(); _owner = owner; }
public static void SendPosition(Player obj, bool forced=false) { countdown--; if (!forced && (!_started || !_enabled || !obj.ChangedMovement)) return; countdown = MaxNonUpdateTries; PositionMessage message = (PositionMessage)ProtocolHelper.NewMessage(MessageTypes.Position); message.Position = obj.Position; message.Move = new Vector3(obj.Movement, obj.Speed.Y); message.id = obj.ID; Send(message, true); }
private static void TryEquip(int id, Player player) { GameObject obj = ModuleManager.SpawnByIdClient(null, id, -1, Point.Zero, ""); PartContainer cont = obj as PartContainer; if (cont != null && cont.Part != null) player.Body.TryEquip(-1, cont.Part); }
public virtual void Event(Player obj) { }
public void RemoveObject(int id) { _sem.WaitOne(); if (id == playerID && _player!=null) { _objects.Remove(_player); _draw.Remove(_player); _player = null; playerID = -1; } else { for (int x = 0; x < _objects.Count; x++) { if (_objects[x].ID == id) { if (_objects[x] is EventObject) (_objects[x] as EventObject).Remove(); _objects.RemoveAt(x); break; } } for (int x = 0; x < _draw.Count; x++) { if (_draw[x].ID == id) { _draw.RemoveAt(x); _sem.Release(); return; } } } _sem.Release(); }
public void SelectPlayer(int id) { playerID = id; for (int x = 0; x < _objects.Count; x++) { if (_objects[x].ID == id && _objects[x] is Player) { _player = _objects[x] as Player; _player.ChangedMovement = true; return; } } }
public override void Update(Player player, float ms) { if (player.OnGround) airJumps = 0; }
public void SpawnObject(Rectangle position,Vector2 move, int objectType, int id, string info) { if (_map == null) return; GameObject obj = ModuleManager.SpawnByIdClient(_map, objectType, id, new Point(position.X, position.Y), info); if (obj == null) return; _sem.WaitOne(); if (obj is EventObject) _map.AddObject(obj as EventObject); else _draw.Add(obj); _objects.Add(obj); /* switch (objectType) { case 't' - 'a': Lava lava = new Lava(_map, ContentInterface.LoadTexture("Lava"), position, id); _map.AddObject(lava); _objects.Add(lava); break; case 'b' - 'a': PartPickup pp = new PartPickup(new Legs(ContentInterface.LoadTexture("FeetIcon")), _map, position, id); _map.AddObject(pp); _objects.Add(pp); break; case 'd' - 'a': pp = new PartPickup(new Striker(ContentInterface.LoadTexture("Attack")), _map, position, id); _map.AddObject(pp); _objects.Add(pp); break; case 15: pp = new PartPickup(new Striker(ContentInterface.LoadTexture("healthOrb")), _map, position, id); _map.AddObject(pp); _objects.Add(pp); break; case 20: pp = new PartPickup(new Striker(ContentInterface.LoadTexture("expOrb")), _map, position, id); _map.AddObject(pp); _objects.Add(pp); break; case 9: pp = new PartPickup(new Striker(ContentInterface.LoadTexture("Attack")), _map, position, id); _map.AddObject(pp); _objects.Add(pp); break; case 'c' - 'a': Exit exit = new Exit(ContentInterface.LoadTexture("Exit"), _map, position, id); _map.AddObject(exit); _objects.Add(exit); break; //case 'a' - 'a': Player player = new Player(ContentInterface.LoadTexture("blob"), new Rectangle((int)(position.X - standardSize / 2), (int)(position.Y - standardSize / 2), 2*standardSize, 2*standardSize-1), id); case 'a' - 'a': Player player; if (string.IsNullOrEmpty(charName)) player = new Player(ContentInterface.LoadTexture("blob"), position, id); else player = new Player(charName, position, id); player.Name = name; if (playerID != -1 && playerID == id) _player = player; _objects.Add(player); _draw.Add(player); player.SetGroup(groupID); break; case 'e' - 'a': pp = new PartPickup(new Wings(ContentInterface.LoadTexture("Wings")), _map, position, id); _map.AddObject(pp); _objects.Add(pp); break; case 'g' - 'a': exit = new Exit(ContentInterface.LoadTexture("Exit"), _map, position, id); _map.AddObject(exit); _objects.Add(exit); break; case 22: ScorePost sp = new ScorePost(_map, ContentInterface.LoadTexture("ScorePost"), position, id); _map.AddObject(sp); _objects.Add(sp); sp.SetColor(ScorePost.ScoreColor.Red); break; case 23: sp = new ScorePost(_map, ContentInterface.LoadTexture("ScorePost"), position, id); _map.AddObject(sp); _objects.Add(sp); sp.SetColor(ScorePost.ScoreColor.Blue); break; case 24: MessageBoard mb = new MessageBoard(_map, ContentInterface.LoadTexture("MessageBoard"), position, id); _map.AddObject(mb); _objects.Add(mb); break; case 29: sp = new ScorePost(_map, ContentInterface.LoadTexture("ScorePost"), position, id); _map.AddObject(sp); _objects.Add(sp); sp.SetColor(ScorePost.ScoreColor.Neutral); break; case 26: exit = new Exit(ContentInterface.LoadTexture("RedTel"), _map, position, id); _map.AddObject(exit); _objects.Add(exit); break; case 27: exit = new Exit(ContentInterface.LoadTexture("BlueTel"), _map, position, id); _map.AddObject(exit); _objects.Add(exit); break; case 28: exit = new Exit(ContentInterface.LoadTexture("Exit"), _map, position, id); _map.AddObject(exit); _objects.Add(exit); break; } */ if ((obj is Player) && playerID != -1 && playerID == id) _player = obj as Player; _sem.Release(); }
public override void Move(Player player, float dir, float yDir) { Vector2 newSpeed = player.Speed; newSpeed.X += speedBonus * dir; player.Speed = newSpeed; }
public override void Jump(Player player, float strength) { }
public void LoadMap(int id) { _mapMutex.WaitOne(); map = null; player = null; Map NewMap = MapManager.GetMapByID(id); objectManager.SetMap(NewMap); _lightMap.SetMap(NewMap); cam.JumpNext(); map = NewMap; mapChanged = true; _mapMutex.ReleaseMutex(); }
public void ExpParticles(int amount, Vector2 startPos, Player player) { ParticleInfo info = new ParticleInfo(); info.attractor = player; info.maxSpeed = 200f; info.attraction = 1000; for (int x = 0; x <= amount / 10; x++) { AddParticle(_expTex, 5f, startPos, new Vector2((float)_random.NextDouble() * 100 - 50, (float)(-50 + _random.NextDouble() * 100)), new Vector2(0, 0), (float)(_random.NextDouble() * Math.PI * 2), (float)(_random.NextDouble() * Math.PI * 2), 1, info); } }
public override void Event(Player obj) { }
public void Update(float ms, Player player) { if (!keepAni) { if (player.OnGround && !player.Jumping && !player.Flying && player.Speed.X != 0) SetAnimation(Run); else if (player.OnGround && !player.Jumping && !player.Flying && player.Speed.X == 0) SetAnimation(Idle); else if (player.OnGround && player.Flying) SetAnimation(Land); else if (player.OnWall) SetAnimation(Wall); else if (!player.OnGround && player.Flying && player.Speed.Y < 0) SetAnimation(Fly); else if (!player.OnGround && player.Flying && player.Speed.Y > 0) SetAnimation(Fall); else if (player.Jumping) SetAnimation(Jump); } if (currentAnimation != null) currentAnimation.Update(ms); }