Example #1
0
        void OnCastSpell(SpellCastEventData e)
        {
            //TODO: this should be refactored. I am tired.
            switch (e.Type)
            {
            case SpellTypes.ManMega_RocketRampage: PlaySound(Sounds.ManMega_1, e.Position); break;

            case SpellTypes.ManMega_Slash: PlaySound(Sounds.ManMega_2, e.Position); break;

            case SpellTypes.ManMega_HintOfASpark: PlaySound(Sounds.ManMega_3, e.Position); break;

            case SpellTypes.ManMega_Shotgun: PlaySound(Sounds.ManMega_4, e.Position); break;

            case SpellTypes.Zoro_Tooth: PlaySound(Sounds.Zero_1, e.Position); break;

            case SpellTypes.Zoro_Slash: PlaySound(Sounds.Zero_2, e.Position); break;

            case SpellTypes.Zoro_Double: PlaySound(Sounds.Zero_3, e.Position); break;

            case SpellTypes.Zoro_Wall: PlaySound(Sounds.Zero_4, e.Position); break;
            }

            var s = GetSpellFromType(new ClientLinearSpell(e.ID, e.Type, e.Position, e.Time, e.Velocity, e.Range, e.Width));

            Spells.Add(e.ID, s);
            GameWorld.AddChild(s);

            if (OurChampion != null && OurChampion.Champion.ID == e.OwnerID)
            {
                ChampionState.SetSpellCooldown(e.Type, e.Cooldown);
            }
        }
Example #2
0
        void AddChampionToGame(PlayerData data, bool ourChampion)
        {
            ChampionSpawnInfo spawn = new ChampionSpawnInfo(data.ID, data.Position, data.Type, data.Team, data.MaxHealth, data.Health);

            IDraw          idraw;
            ClientChampion champ;

            if (ourChampion)
            {
                OurChampion               = new MainDrawableChampion(spawn, Match, ChampionsInfo);
                idraw                     = OurChampion;
                champ                     = OurChampion.Champion;
                ChampionState.MaxLife     = spawn.MaxHealth;
                ChampionState.CurrentLife = spawn.Health;
            }
            else
            {
                var remote = new RemoteDrawableChampion(spawn, spawn.Team == OurChampion.Champion.Team, ChampionsInfo);
                idraw = remote;
                champ = remote.Champion;
            }

            Champions.Add(champ);
            GameWorld.AddChild(idraw, 2);

            Match.CurrentState.AddEntity(champ);

            ILogger.Log(
                String.Format("New champion: id={0}, pos={1}, isOurChamp={2}", spawn.ID, spawn.SpawningPosition, ourChampion),
                LogPriority.High);
        }
Example #3
0
        protected override void OnLoadContent()
        {
            base.OnLoadContent();

            ESCMenu menu = new ESCMenu();

            AddChild(menu, 6);
            menu.SetPositionInScreenPercent(50, 50);

            ChampionState = new CurrentChampionState(100, 100);
            AddChild(new GameUI(ChampionState, new PingCounter(() => {
                return(Client.Instance.GetPing().TotalMilliseconds);
            }), GameScore),
                     3);
            AddChild(KillDisplay, 3);

            AddChild(DeathScreen   = new DeathScreen(), 4);
            AddChild(WinLoseScreen = new WinLoseScreen(), 5);
            AddChild(GameWorld, 1);

            Map = new DrawableTileMap(Match.World.Map, Match.World.Map.TileSet);
            GameWorld.AddChild(Map);

            Client.RegisterCommandHandler(ServerCommand.JoinedGame, OnJoinedGame);
            Client.RegisterCommandHandler(ServerCommand.NewRemotePlayer, OnNewRemotePlayer);
            Client.RegisterCommandHandler(ServerCommand.StateUpdate, OnStateUpdate);

            AddChild(Parallax, 0);

            ((SoundService)Services.GetService(typeof(SoundService))).PlayMusic("Sounds/Musics/SonOfARocket");
        }
Example #4
0
    private void _createPickUp(ItemResource itemResource, Vector2 itemPosition)
    {
        Pickup pickup = (Pickup)((PackedScene)GD.Load("res://items/Pickup.tscn")).Instance();

        _gameWorld.AddChild(pickup);

        pickup.Initialize(this, itemResource);
        pickup.GlobalPosition = itemPosition;
    }
Example #5
0
    public override void Initialize(GameWorld gameWorld, Agent agent, WeaponOrder weaponOrder)
    {
        _shieldPhysics = (ShieldPhysics)((PackedScene)GD.Load("res://weapons/ShieldPhysics.tscn")).Instance();
        gameWorld.AddChild(_shieldPhysics);

        _shieldPhysics.Initialize(this);
        _collisionShape2D = (CollisionShape2D)_shieldPhysics.GetNode("CollisionShape2D");

        base.Initialize(gameWorld, agent, weaponOrder);
    }
    public void debugDraw(Vector2 target)
    {
        Node2D path = null;

        if (!gameWorld.HasNode("path_raycast"))
        {
            path      = (Node2D)gameWorld.GetNode("pathchart").Duplicate();
            path.Name = "path_raycast";
            gameWorld.AddChild(path);
        }
        else
        {
            path = (Node2D)gameWorld.GetNode("path_raycast");
        }

        Node2D pointNode = (Node2D)gameWorld.GetNode("dot").Duplicate();

        pointNode.Name     = "path_raycast_" + target.x + "_" + target.y;
        pointNode.Position = target;
        path.AddChild(pointNode);
    }
Example #7
0
 void AddStructure(DrawableStructure structure)
 {
     GameWorld.AddChild(structure, 1);
     Structures.Add(structure);
 }