Ejemplo n.º 1
0
        public GameObject CreatePlayer(Vector2D position, MovementScript movementScript, LookScript lookScript, WeaponScript weaponScript, AttackScript attackScript, List <GameObject> players, int playerCount)
        {
            GameObject  player = new GameObject(position);
            CircleShape shape  = new CircleShape(20);

            shape.Origin    = new Vector2D(20, 20);
            shape.FillColor = Color.White;
            player.AddComponent(new RenderComponent(shape));
            player.AddComponent(new SphereCollider(20, false));
            player.AddScript(attackScript);


            GameObject swordRotationLayer = new GameObject(new Vector2D(0, 0));

            player.SetChild(swordRotationLayer);

            GameObject weapon = new GameObject(new Vector2D(25, 0));

            //weapon.AddComponent(weaponScript.GetTextureComponent());
            swordRotationLayer.SetChild(weapon);

            new CharacterScript(movementScript, lookScript, weaponScript, null, weapon, new InvincibleScript(playerCount), player);


            movementScript.Id = players.Count;

            return(player);
        }
Ejemplo n.º 2
0
        public void CreatePlayer(Texture texture, double maxLife, Vector2D position, MovementScript movementScript, LookScript lookScript, WeaponScript weaponScript, AttackScript attackScript, InteractionScript interactionScript, EstusScript estusScript, ActionScript actionScript, List <GameObject> players, int playerCount)
        {
            GameObject player = new GameObject(position);

            player.ObjectName = "MyPlayer";

            /*CircleShape shape = new CircleShape(20);
             * shape.Origin = new Vector2D(20, 20);
             * shape.FillColor = Color.White;*/
            player.AddComponent(new RenderComponent(texture));
            player.AddComponent(new SphereCollider(_HELMET_SIZE, false));
            player.AddScript(attackScript);
            player.AddScript(interactionScript);
            player.AddScript(new InvincibleScript(playerCount));
            player.AddScript(estusScript);
            player.AddScript(actionScript);


            GameObject swordRotationLayer = new GameObject(new Vector2D(0, 0));

            swordRotationLayer.ObjectName = "RotationLayer";
            player.SetChild(swordRotationLayer);

            GameObject weapon = new GameObject(new Vector2D(25, -20));

            weapon.ObjectName = "Weapon";
            //weapon.AddComponent(weaponScript.GetTextureComponent());

            new CharacterScript(maxLife, movementScript, lookScript, weaponScript, weapon, player);

            swordRotationLayer.SetChild(weapon);

            movementScript.Id = players.Count;

            _dataManager.Players.Add(player);
            _dataManager.Environment.SetChild(player);
            _dataManager.DynamicObjects.Add(player);

            player.Update(0);
        }
Ejemplo n.º 3
0
        public override void AddPlayer(Vector2D position, MovementScript movementScript, LookScript lookScript, WeaponScript weaponScript, AttackScript attackScript)
        {
            GameObject player = _factory.CreatePlayer(position, movementScript, lookScript, weaponScript, attackScript, _dataManager.Players, _dataManager.PlayerCount);

            //_dataManager.Environment.AddScript(_factory.CreateEnvironmentMovementScript(movementScript, _dataManager.Players));
            _dataManager.Players.Add(player);
            _dataManager.Environment.SetChild(player);
        }