예제 #1
0
파일: PartPickup.cs 프로젝트: MyEyes/Igorr
 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()+"!");
 }
예제 #2
0
파일: GlowPart.cs 프로젝트: MyEyes/Igorr
 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);
 }
예제 #3
0
파일: Legs.cs 프로젝트: MyEyes/Igorr
 public override void Jump(Player player, float strength)
 {
     if (player.OnGround)
     {
         Vector2 newSpeed = player.Speed;
         newSpeed.Y -= jumpBonus;
         player.Speed = newSpeed;
     }
 }
예제 #4
0
파일: Wings.cs 프로젝트: MyEyes/Igorr
 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++;
     }
 }
예제 #5
0
파일: Hover.cs 프로젝트: MyEyes/Igorr
 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;
         }
     }
 }
예제 #6
0
파일: WallWalker.cs 프로젝트: MyEyes/Igorr
 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;
 }
예제 #7
0
파일: Inventory.cs 프로젝트: MyEyes/Igorr
 public Inventory(Player owner)
 {
     _items = new List<ICollectible>();
     _owner = owner;
 }
예제 #8
0
 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);
 }
예제 #9
0
 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);
 }
예제 #10
0
파일: EventObject.cs 프로젝트: MyEyes/Igorr
 public virtual void Event(Player obj)
 {
 }
예제 #11
0
        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();
        }
예제 #12
0
 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;
         }
     }
 }
예제 #13
0
파일: Wings.cs 프로젝트: MyEyes/Igorr
 public override void Update(Player player, float ms)
 {
     if (player.OnGround)
         airJumps = 0;
 }
예제 #14
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();
        }
예제 #15
0
파일: Legs.cs 프로젝트: MyEyes/Igorr
 public override void Move(Player player, float dir, float yDir)
 {
     Vector2 newSpeed = player.Speed;
     newSpeed.X += speedBonus * dir;
     player.Speed = newSpeed;
 }
예제 #16
0
파일: WallWalker.cs 프로젝트: MyEyes/Igorr
 public override void Jump(Player player, float strength)
 {
 }
예제 #17
0
파일: GameScreen.cs 프로젝트: MyEyes/Igorr
 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();
 }
예제 #18
0
 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);
     }
 }
예제 #19
0
파일: Lava.cs 프로젝트: MyEyes/Igorr
 public override void Event(Player obj)
 {
 }
예제 #20
0
        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);
        }