private void ConfigureTypeState(IObjectTypeDescriptor descriptor)
        {
            descriptor
            .Field("states")
            .Type <ListType <StateType> >()
            .Resolver(context =>
            {
                return(States);
            });

            descriptor
            .Field("state_add")
            .Argument("input", x => x.Type <StateInput>())
            .Type <StateType>()
            .Resolver(context =>
            {
                State state = context.ArgumentValue <State>("input");
                return(States.AddState(state));
            });

            descriptor
            .Field("state_find")
            .Argument("input", x => x.Type <IntType>())
            .Type <StateType>()
            .Resolver(context =>
            {
                int id = context.ArgumentValue <int>("id");
                return(States.Where(x => x.Id == id).FirstOrDefault());
            });
        }
Esempio n. 2
0
    void InitStates()
    {
        m_States.AddState((int)TypeState.Idle, new EasyStateWrapper(() => { PlayAnim(CharAnimHashes.Idle); }, null, IdleUpdate));
        m_States.AddState((int)TypeState.Move, new EasyStateWrapper(() => { PlayAnim(CharAnimHashes.Move); }, null, MoveUpdate));
        m_States.AddState((int)TypeState.Death, new EasyStateWrapper(
                              () => {
            m_AttackState.ExitState();
            PlayAnim(CharAnimHashes.Death);
            m_Container.CharacterControl.enabled = false;
        }
                              , () =>
        {
            m_Container.CharacterControl.enabled = true;
        }
                              , DeathUpdate));

        m_States.SetState((int)TypeState.Idle);
        m_AttackState = new EasyStateWrapper(AttackStart, AttackStop, AttackUpdate);
    }