예제 #1
0
 public Player(Engine.Player player)
 {
     this.UserId        = player.UserId;
     this.Id            = player.Id;
     this.Team          = player.Team;
     this.KeyActorsSync = player.KeyActors.Select(x => x.Id).ToList();
     this.Status        = player.Status;
 }
예제 #2
0
        public Board(Engine.Player player)
        {
            this.player = player;

            Texture = Art.Board;

            ships = player.Board.Ships.Select(ship => new Ship(ship, this)).ToList();
            cells = player.Board.Cells.Select(cell => new Cell(cell, this)).ToList();
        }
예제 #3
0
        private void RenderQuad(Engine.Player p, float scale, float offset, Vector3 color)
        {
            var modelMat = Matrix4.CreateTranslation(p.Position + new Vector3(0.0f, offset, 0.1f));

            modelMat = Matrix4.CreateScale(scale, 0.1f, 1.0f) * modelMat;
            healthBar.shader.SetUniform("model", modelMat);
            healthBar.shader.SetUniform("col", color);
            GL.DrawElements(PrimitiveType.TriangleFan, healthBar.numIndices, DrawElementsType.UnsignedInt, (IntPtr)0);
        }
예제 #4
0
        public static Player CreateDefaultPlayer()
        {
            Player player = new Engine.Player(10, 10, 20, 0);

            player.Inventory.Add(new InventoryItem(World.ItemByID(World.ITEM_ID_RUSTY_SWORD), 1));
            player.CurrentLocation = World.LocationByID(World.LOCATION_ID_HOME);

            return(player);
        }
예제 #5
0
        public void updatePlayerHealth(Engine.Player player)
        {
            int index = 0;

            foreach (Player p in Game.players)
            {
                uiControllerGame.labelList_Scoreboard_hp[index].text = p.healthPoints.ToString();
                index++;
            }

            if (player.healthPoints == 0)
            {
                Announcement.make("Player " + player.user.username + " has been defeated!", Announcement.ScreenPosition.MiddleTop, 2.0f);
            }
            // TODO playerHealth degeri zaten enginde suan update edilmis halde. sen sadece degisiklik oldugunu isikli misikli gosterebilirsin
        }
예제 #6
0
        public void RenderPlayer(Engine.Player p)
        {
            shader.Bind();
            shader.SetUniform("proj", view.Proj);
            shader.SetUniform("view", view.View);
            var trans = Matrix4.CreateTranslation(p.Position);

            //Rotate the tank based on its current moving direction
            shader.SetUniform("model", Matrix4.CreateRotationZ(p.TankAngle) * trans);
            RenderTank(tank, p.Color);
            shader.SetUniform("model", Matrix4.CreateRotationZ(p.TowerAngle) * trans);
            RenderTank(tower, 0.5f * p.Color);
            RenderHealthBars(p);
            textRenderer.DrawInWorld($"Player{p.ID}", p.Position + new Vector3(-Engine.Player.radius - 0.2f, Engine.Player.radius, 0.5f),
                                     new Vector3(1.0f, 1.0f, 1.0f), .3f);
            shader.UnBind();
        }
예제 #7
0
        private void RenderHealthBars(Engine.Player p)
        {
            GL.BindVertexArray(healthBar.VAO);
            healthBar.shader.Bind();
            healthBar.shader.SetUniform("proj", view.Proj);
            healthBar.shader.SetUniform("view", view.View);
            var scale  = p.CurrHealth / (float)Engine.Player.initHealth;
            var offset = -Engine.Player.radius - 0.1f;
            var color  = new Vector3(1.0f, 0.0f, 0.0f);

            RenderQuad(p, scale, offset, color);

            scale  = p.CurrShields / (float)Engine.Player.initShields;
            offset = -Engine.Player.radius;
            color  = new Vector3(0.3f, 0.3f, 1.0f);
            RenderQuad(p, scale, offset, color);

            healthBar.shader.UnBind();
            GL.BindVertexArray(0);
        }
예제 #8
0
        public static Engine.Player GeneratePlayer(GeneratorConfig c)
        {
            try
            {
                int keeping;
                int tackling;
                int passing;
                int shooting;
                int aggression;
                int age;
                int counter = 0;
                do
                {
                    keeping    = c.generate(RosterGenerator.GeneratorConfig.KEEPING);
                    tackling   = c.generate(RosterGenerator.GeneratorConfig.TACKLING);
                    passing    = c.generate(RosterGenerator.GeneratorConfig.PASSING);
                    shooting   = c.generate(RosterGenerator.GeneratorConfig.SHOOTING);
                    aggression = c.generate(RosterGenerator.GeneratorConfig.AGGRESSION);
                    age        = c.generate(RosterGenerator.GeneratorConfig.AGE);
                    counter++;
                }while (!c.isValid(keeping + tackling + passing + shooting + aggression) && counter < MAX_TRIES);

                if (!c.isValid(keeping + tackling + passing + shooting + aggression))
                {
                    throw new TooMuchDiscardsException("Exception");
                }
                Engine.Player p = new Engine.Player("Unnamed", "???", age, keeping, tackling, passing, shooting, aggression, 300, 300, 300, 300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

                return(p);
            }
            catch (System.Exception err)
            {
                SupportClass.WriteStackTrace(err, Console.Error);
                System.Environment.Exit(-1);
                return(null);
            }
        }
예제 #9
0
 /// <summary>Creates a new instance of LeadersPlayer </summary>
 public LeadersPlayer(Engine.Player p, System.String team) : base(p.Name, p.Nationality, p.Age, p.Keeping, p.Tackling, p.Passing, p.Shooting, p.getAggression(), p.getKeepingAbility(), p.getTacklingAbility(), p.getPassingAbility(), p.getShootingAbility(), p.Games, p.getSaves(), p.getTackles(), p.getKeyPasses(), p.getShots(), p.getGoals(), p.getAssists(), p.Dps, p.Injury, p.Suspension)
 {
     this.team = team;
 }