Example #1
0
        public SPlayer(Player player, ClientService session)
            : base(player)
        {
            Session = session;

            Handler = new PlayerHandler(this);

            OnDirectionEnablement += new DirectionEventHandler(SPlayer_OnDirectionEnablement);
            OnDirectionDisablement += new DirectionEventHandler(SPlayer_OnDirectionEnablement);
        }
Example #2
0
 public Player(Player copy)
     : base(copy)
 {
     Inventory = new Inventory(copy.Inventory);
 }
Example #3
0
 public void Init(String login)
 {
     MainP = Create.Player("Vlad");
     MainP.Name = "VLAD";
 }
Example #4
0
        public void Init(Player player)
        {
            MainP = new MainPlayer(player);

            GameSession.Instance.SetPlayer(MainP);
        }
Example #5
0
 public MainPlayer(Player player)
     : base(player)
 {
 }
Example #6
0
        Vector2f GetViewMove(Time dt, Player player)
        {
            float moveX = 0.0f;
            float moveY = 0.0f;

            if (player == null)
            {
                return new Vector2f(moveX, moveY);
            }

            Vector2f p = player.Center;

            if (Math.Abs(p.X - GameRoot.MapView.Center.X) > VIEW_MOVE_TRIGGER_LIMIT * (GameData.WINDOW_HEIGHT / GameData.WINDOW_WIDTH))
                moveX = player.Velocity * (p.X - GameRoot.MapView.Center.X) / 50f * GameData.WINDOW_WIDTH / GameData.WINDOW_HEIGHT * (float)dt.Value;
            if (Math.Abs(p.Y - GameRoot.MapView.Center.Y) > VIEW_MOVE_TRIGGER_LIMIT * (GameData.WINDOW_WIDTH / GameData.WINDOW_HEIGHT))
                moveY = player.Velocity * (p.Y - GameRoot.MapView.Center.Y) / 50f * GameData.WINDOW_HEIGHT / GameData.WINDOW_WIDTH * (float)dt.Value;

            /*if (Math.Abs(moveX) < VIEW_MOVE_MINOR_LIMIT)
                moveX = p.X - Gui.MapView.Center.X;

            if (Math.Abs(moveY) < VIEW_MOVE_MINOR_LIMIT)
                moveY = p.Y - Gui.MapView.Center.Y;*/

            if (GameRoot.MapView.Center.X - GameRoot.MapView.Size.X / 2 + moveX < 0F)
            {
                GameRoot.MapView.Center = new Vector2f(0F, GameRoot.MapView.Center.Y) + new Vector2f(GameRoot.MapView.Size.X / 2F, 0F);
                moveX = 0.0f;
            }

            if (GameRoot.MapView.Center.X - GameRoot.MapView.Size.X / 2 + GameRoot.MapView.Size.X + moveX >= Map.Dimension.X)
            {
                GameRoot.MapView.Center = new Vector2f(Map.Dimension.X, GameRoot.MapView.Center.Y) - new Vector2f(GameRoot.MapView.Size.X / 2F, 0F);
                moveX = 0.0f;
            }

            if (GameRoot.MapView.Center.Y - GameRoot.MapView.Size.Y / 2 + moveY < 0F)
            {
                GameRoot.MapView.Center = new Vector2f(GameRoot.MapView.Center.X, 0F) + new Vector2f(0F, GameRoot.MapView.Size.Y / 2F);
                moveY = 0.0f;
            }

            if (GameRoot.MapView.Center.Y - GameRoot.MapView.Size.Y / 2 + GameRoot.MapView.Size.Y + moveY >= Map.Dimension.Y)
            {
                GameRoot.MapView.Center = new Vector2f(GameRoot.MapView.Center.X, Map.Dimension.Y) - new Vector2f(0F, GameRoot.MapView.Size.Y / 2F); ;
                moveY = 0.0f;
            }

            return new Vector2f(moveX, moveY);
        }
Example #7
0
 public void UpdateLockedViewMove(Time dt, Player player)
 {
     ViewMove = GetViewMove(dt, player);
 }