当前位置: 首页>>代码示例>>C#>>正文


C# FiniteStateMachine.Configure方法代码示例

本文整理汇总了C#中FiniteStateMachine.Configure方法的典型用法代码示例。如果您正苦于以下问题:C# FiniteStateMachine.Configure方法的具体用法?C# FiniteStateMachine.Configure怎么用?C# FiniteStateMachine.Configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FiniteStateMachine的用法示例。


在下文中一共展示了FiniteStateMachine.Configure方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Awake

 public void Awake()
 {
     _FSM = new FiniteStateMachine<BotBase>();
     _steering = GetComponent<Steering>();
     _FSM.Configure(this, BotState_Idle.Instance);
 }
开发者ID:spotco,项目名称:ld-33,代码行数:6,代码来源:BotBase.cs

示例2: Awake

 public void Awake()
 {
     _FSM = new FiniteStateMachine<TeamBase>();
     _FSM.Configure(this, TeamState_Wait.Instance);
 }
开发者ID:spotco,项目名称:ld-33,代码行数:5,代码来源:TeamBase.cs

示例3: Start

    // Use this for initialization
    void Start()
    {
        // find child triggers
        foreach (Transform childTransform in transform)
        {
            if (childTransform.gameObject.CompareTag(GlobalNames.TAG.ShoutingTrigger))
            {
                shoutTrigger = childTransform.gameObject.GetComponent<BoxCollider>();
            }
            else if (childTransform.gameObject.CompareTag(GlobalNames.TAG.WhistlingTrigger))
            {
                whistlingTrigger = childTransform.gameObject;
            }
            else if (childTransform.gameObject.CompareTag(GlobalNames.TAG.ShushTrigger))
            {
                shushTrigger = childTransform.gameObject;
            }
        }

        if (shoutTrigger != null)
        {
            shoutTrigger.gameObject.active = false;
        }
        else
        {
            Debug.LogWarning("Shout trigger on player wasn't found");
        }

        // whistling trigger
        if (whistlingTrigger != null)
        {
            whistlingTrigger.gameObject.active = true;
        }
        else
        {
            Debug.LogWarning("Whistling trigger on player wasn't found");
        }

        // shush trigger
        if (shushTrigger != null)
        {
            shushTrigger.gameObject.active = false;
        }
        else
        {
            Debug.LogWarning("Shush trigger on player wasn't found");
        }

        whistlingSpawn = transform.GetComponentInChildren<WhistlingSpawner>();
        if(whistlingSpawn == null)
            Debug.LogWarning("Whistling spawn wasn't found");

        ConfusingSpawn = transform.GetComponentInChildren<ConfusingSpawner>();
        if (ConfusingSpawn == null)
            Debug.LogWarning("Confusing spawn wasn't found");

        // float particle system
        Transform current;
        for (int i = 0; i < transform.GetChildCount(); i++)
        {
            current = transform.GetChild(i);
            if (current.gameObject.tag == GlobalNames.TAG.FloatParticleSystem)
            {
                FloatParticleSystem = current.gameObject.GetComponent<ParticleSystem>();
                FloatParticleSystem.emissionRate = 0;
                continue;
            }
            else if (current.gameObject.tag == GlobalNames.TAG.ShoutParticleSystem)
            {
                ShoutParticleSystem = current.gameObject.GetComponent<ParticleSystem>();
                shoutEmissionRate = ShoutParticleSystem.emissionRate;
                continue;
            }
        }

        // get renderer
        meshRenderer = transform.GetComponentInChildren<MeshRenderer>();

        // initialize states
        StandState = ScriptableObject.CreateInstance<PStandState>();
        WalkState = ScriptableObject.CreateInstance<PWalkState>();

        JumpState = ScriptableObject.CreateInstance<PJumpState>();
        FallState = ScriptableObject.CreateInstance<PFallState>();
        FloatState = ScriptableObject.CreateInstance<PFloatState>();

        // create the finite state machine
        FSM = new FiniteStateMachine<Player>();
        // configure it so that the player first falls and does not move r/l
        FSM.Configure(this, FallState, null);

        GameObject temp = GameObject.FindGameObjectWithTag(GlobalNames.TAG.StartPoint);
        if (temp != null)
        {
            startTransform = temp.transform;
        }
        else
        {
            Debug.LogWarning("The scene does not have an object tagged with \"StartPoint\"");
//.........这里部分代码省略.........
开发者ID:JungleJinn,项目名称:Staying-Alive,代码行数:101,代码来源:Player.cs


注:本文中的FiniteStateMachine.Configure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。