Ejemplo n.º 1
0
    public void ReplaceGamePlayer(Game.IView newPlayer, Game.IPlayerBehaviour newBehavior, Game.IPlayerAni newAni, Game.IPlayerAudio newAudio)
    {
        var entity = gamePlayerEntity;

        if (entity == null)
        {
            entity = SetGamePlayer(newPlayer, newBehavior, newAni, newAudio);
        }
        else
        {
            entity.ReplaceGamePlayer(newPlayer, newBehavior, newAni, newAudio);
        }
    }
Ejemplo n.º 2
0
    public void ReplaceGamePlayer(Game.IView newPlayer, Game.IPlayerBehaviour newBehavior, Game.IPlayerAni newAni, Game.IPlayerAudio newAudio)
    {
        var index     = GameComponentsLookup.GamePlayer;
        var component = (Game.PlayerComponent)CreateComponent(index, typeof(Game.PlayerComponent));

        component.Player   = newPlayer;
        component.Behavior = newBehavior;
        component.Ani      = newAni;
        component.Audio    = newAudio;
        ReplaceComponent(index, component);
    }
Ejemplo n.º 3
0
    public GameEntity SetGamePlayer(Game.IView newPlayer, Game.IPlayerBehaviour newBehavior, Game.IPlayerAni newAni, Game.IPlayerAudio newAudio)
    {
        if (hasGamePlayer)
        {
            throw new Entitas.EntitasException("Could not set GamePlayer!\n" + this + " already has an entity with Game.PlayerComponent!",
                                               "You should check if the context already has a gamePlayerEntity before setting it or use context.ReplaceGamePlayer().");
        }
        var entity = CreateEntity();

        entity.AddGamePlayer(newPlayer, newBehavior, newAni, newAudio);
        return(entity);
    }