コード例 #1
0
    public void AddGameHumanBehaviourState(Game.PlayerBehaviourIndex newBehaviour, Game.BehaviorState newState)
    {
        var index     = GameComponentsLookup.GameHumanBehaviourState;
        var component = (Game.HumanBehaviourStateComponent)CreateComponent(index, typeof(Game.HumanBehaviourStateComponent));

        component.Behaviour = newBehaviour;
        component.State     = newState;
        AddComponent(index, component);
    }
コード例 #2
0
    public void ReplaceGameHumanBehaviourState(Game.PlayerBehaviourIndex newBehaviour, Game.BehaviorState newState)
    {
        var entity = gameHumanBehaviourStateEntity;

        if (entity == null)
        {
            entity = SetGameHumanBehaviourState(newBehaviour, newState);
        }
        else
        {
            entity.ReplaceGameHumanBehaviourState(newBehaviour, newState);
        }
    }
コード例 #3
0
    public GameEntity SetGameHumanBehaviourState(Game.PlayerBehaviourIndex newBehaviour, Game.BehaviorState newState)
    {
        if (hasGameHumanBehaviourState)
        {
            throw new Entitas.EntitasException("Could not set GameHumanBehaviourState!\n" + this + " already has an entity with Game.HumanBehaviourStateComponent!",
                                               "You should check if the context already has a gameHumanBehaviourStateEntity before setting it or use context.ReplaceGameHumanBehaviourState().");
        }
        var entity = CreateEntity();

        entity.AddGameHumanBehaviourState(newBehaviour, newState);
        return(entity);
    }