Code Monkey home page Code Monkey logo

statemachine's Introduction

说明:

  1. 该状态机是对游戏《蔚蓝 Celeste》开源角色控制 Player.cs 中的状态机的推测仿写练习,不一定对。
  2. 使用代理模式、委托回调代替泛型、基类继承实现状态机
  3. 有意思的点在于在状态的处理中添加了协程方法
    1. 协程可以配合其它(DotWeen插件)进行简单“实时动画演出” 原代码中的 "StIntro**" 状态大概就是 “实时动画演出”
    2. 协程可以用时间控制代替一些复杂的状态切换条件判断,比如角色从边缘跌落,先根据土狼时间切换到可跳跃状态,然后时间到切换到不可跳跃可攀爬状态,体力消耗(时间)完再切换到完全失重状态
  4. 与源代码不同,源代码中的状态处理 Update 方法相较于该状态机中的对应方法 Tick 返回值为 int,大概用于按键输入无协程回调的状态切换,待进一步研究
  5. 状态标记为 int 类型而非枚举enum,状态与状态标记是分离的。但是,状态的管理容器是数组,所以要严格的一一对应

参考:

NoelFB / Celeste

statemachine's People

Contributors

kinoiralink avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.