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


C# FSM类代码示例

本文整理汇总了C#中FSM的典型用法代码示例。如果您正苦于以下问题:C# FSM类的具体用法?C# FSM怎么用?C# FSM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: MenuInGame2

    public MenuInGame2(FSM parentFsm, UIManager2 panel1, UIManager2 panel2)
        : base(parentFsm, panel1, panel2, "MenuInGame2.fsm")
    {
        InitUI();

        int stageCode = (int)parentFsm.Variables["stageId"];
    }
开发者ID:pb0,项目名称:ID0_Test,代码行数:7,代码来源:MenuInGame2.cs

示例2: UncontrolledFall

 public UncontrolledFall(FSM fsm)
     : base(fsm)
 {
     // Add Transitions.
     this.gravity = Hero.Gravity;
     this.maxSpeed = 0.0f;
 }
开发者ID:ZeroXFive7,项目名称:NextGenPlatformer,代码行数:7,代码来源:UncontrolledFall.cs

示例3: InitCommendSlots

 public void InitCommendSlots(FSM targetFsm, HeroCharacter heroCharacter)
 {
     itemSlotDisplay.Init(targetFsm, heroCharacter);
     /*
     skillDisplay.Init(targetFsm, heroCharacter);
      */
 }
开发者ID:pb0,项目名称:ID0_Test,代码行数:7,代码来源:UIInGameState.cs

示例4: Inizializza

    public void Inizializza(FSM oggetto)
    {
        MioCervello = oggetto;

        if (!MioCervello.DatiPersonaggio.Giocabile)
            elencoPercorsiDisponibili = Statici.databaseInizialePercorsi.trovaPercorsiDaPersonaggio(MioCervello.DatiPersonaggio.miaClasse);

        if (elencoPercorsiDisponibili.Count > 0)
            MioCervello.IndexPercorso = elencoPercorsiDisponibili[Random.Range(0, elencoPercorsiDisponibili.Count)];  //per ora gli assegno percorso casuale...da sistemare e completare

          //  foreach (int elem in elencoPercorsiDisponibili)
          //      Debug.Log("classe" + MioCervello.DatiPersonaggio.miaClasse + " idx " + elem);
          //  Debug.Log("percorso scelto " + MioCervello.IndexPercorso);

        /*
        if (GameManager.dizionarioPercorsi.ContainsKey(MioCervello.gameObject.tag))
            MioCervello.IndexPercorso = GameManager.dizionarioPercorsi[MioCervello.gameObject.tag];
            */
        //-Vedere se meglio con impostazione nostra di indiceDestionazioni oppure fare in modo che a ogni chiamata al Gestore PErcorso si incrementa da solo

        if (MioCervello.IndexPercorso < 0) //
        {
            Debug.LogError("Ue' picio.......Non hai stato assegnato nessun percorso..quindi se ne sta fermo in attesa di Input");
            return;
        }

        Percorso = Statici.padreGestore[MioCervello.IndexPercorso];
        indiceDestinazioni = -1;  //per convenzione ho assegnato il valore -1 per default (percorso no assegnato)
    }
开发者ID:LucaGames,项目名称:ClassPrjUnit4-5,代码行数:29,代码来源:Pattugliamento.cs

示例5: Awake

 void Awake()
 {
     _fsm = new FSM<GameStates>();
     AddStates();
     AddTransitons();
     _instance = this;
 }
开发者ID:DylanGuidry95,项目名称:CombatTest,代码行数:7,代码来源:GameStateManager.cs

示例6: Start

    // Use this for initialization
    public override void Start()
    {
        StateMachine = new FSM<EnemyChaserCloneScript> ( this, MoveToPlayer.Instance );
        anim = GetComponent<Animator>();

        if (!player) AssignPlayer();
        WaveSystem.EnemiesRemaining++;

        // Set initial stats (should overide by applying an upgrade)
        if (!HasBeenUpgraded)
        {
            Health = 1;
            Velocity = 1;
            Damage = 1;
            AttackRate = 5;
            Experience = 1;
        }

        // Movement
        IsMoving = true;
        TurnVelocity = 5f;

        // Attack
        IsAttacking = false;
        AttackDistance = 2;
        NextAttack = AttackRate;

        //Knockback
        Force = 50f;
        mass = 20;

        //misc
        renderer.material.color = Color.green;
    }
开发者ID:jcollins2014,项目名称:Project,代码行数:35,代码来源:EnemyChaserCloneScript.cs

示例7: Awake

 void Awake()
 {
     _fsm = new FSM<CSTATES>();
     AddStates();
     AddTransitions();
     Instance = this;
 }
开发者ID:QuintonBaudoin,项目名称:GameJam,代码行数:7,代码来源:Stats.cs

示例8: AddUI

    public UIBase AddUI(string path, FSM fsm)
    {
        Assert.IsTrue(!string.IsNullOrEmpty(path));

        path = path.Trim();
        GameObject child = RecycleManager.Instance.Instantiate(path);
        if (child != null)
        {
            Vector3 tempPos = child.transform.position;
            child.transform.parent = panel.transform;
            child.transform.localScale = Vector3.one;
            child.transform.localPosition = tempPos;

            foreach (var entity in child.GetComponentsInChildren<UIButtonMessage>(true))
            {
                entity.fsm = fsm;
            }

            UIBase ret = child.GetComponent<UIBase>();
            if (ret == null)
            {
                ret = child.AddComponent<UIBase>();
            }
            ret.Init(path, fsm, this);
            handles.Add(path, ret);
            return ret;
        }
        return null;
    }
开发者ID:pb0,项目名称:ID0_Test,代码行数:29,代码来源:UIManager2.cs

示例9: BossAlertTrigger

    public BossAlertTrigger(FSM parentFsm)
        : base(OverlapEventType.Trigger, 1, 1, WorldAnchor.BottomLeft)
    {
        Assert.IsTrue(parentFsm != null);

        this.parentFsm = parentFsm;
    }
开发者ID:pb0,项目名称:ID0_Test,代码行数:7,代码来源:BossAlertTrigger.cs

示例10: LockObstacle

    public LockObstacle(ObjectField objectField, ObjectStage objectStage, ItemDropManager itemDropManager, FSM parentFsm)
        : base(objectField, objectStage, itemDropManager, parentFsm)
    {
        objectLockObstacle = TableLoader.GetTable<ObjectLockObstacle>().Get(objectStage.ObjectID);
        int lockCount = objectLockObstacle.LockCount;
        this.name = StringTableLoader.Instance.Get(objectField.ObjectName);

        InitStatus<LockStatus>(
            new object[] { LockStatus.Lock, 0, lockCount, lockCount }
        );

        RegisterDeathCondition(
            delegate(Status current)
            {
                return current.Get(LockStatus.Lock) == 0;
            }
        );

        AddAction(Action.E_Type.Unlock,
            delegate(float value, GameInstance firer, string[] param)
            {
                FSMEvent("damage");
                return new ActionHandler.Result(LockStatus.Lock, -value);
            }
        );
        AddAction(Action.E_Type.Attack,
            delegate(float value, GameInstance firer, string[] param)
            {
                FSMEvent("damage");
                return new ActionHandler.Result(LockStatus.Lock, -1);
            }
        );
    }
开发者ID:pb0,项目名称:ID0_Test,代码行数:33,代码来源:LockObstacle.cs

示例11: HeroState

 public HeroState(FSM fsm)
     : base(fsm)
 {
     Hero = (HeroMotion)fsm;
     animator = gameObject.GetComponent<Animator>();
     InputManager = gameObject.GetComponent<InputManager>();
 }
开发者ID:ZeroXFive7,项目名称:NextGenPlatformer,代码行数:7,代码来源:HeroState.cs

示例12: JumpFall

 public JumpFall(FSM fsm)
     : base(fsm)
 {
     AddTransition<WallRun>(CanWallRun);
     this.gravity = Hero.JumpGravity;
     this.maxSpeed = Hero.MaxAirSpeed;
 }
开发者ID:ZeroXFive7,项目名称:NextGenPlatformer,代码行数:7,代码来源:JumpFall.cs

示例13: Inizializza

 public void Inizializza(FSM oggetto)
 {
     Cervello = oggetto;
     agente = Cervello.GetComponent<NavMeshAgent>();
     PersonaggioDaInseguire = GameObject.FindGameObjectWithTag("Player");
     animatore = Cervello.gameObject.GetComponent<Animator>();
 }
开发者ID:burrett,项目名称:ClassPrjUnit4-5,代码行数:7,代码来源:Inseguimento.cs

示例14: MenuInGame

    public MenuInGame(FSM parentFsm, UIManager2 panel1, UIManager2 panel2)
        : base(parentFsm, panel1, panel2, "MenuInGame.fsm")
    {
        timeClient = TimeManager.Instance.Create();

        InitUI();

        int stageId = (int)parentFsm.Variables["stageId"];

        /*
        // ddong
        if (stageId < 2000)
        {
            stageId += 2000;
        }
        */

        InitStage(stageId, out stageEntity, out gameEntity);

        Rect fieldArea = UI.GetFieldArea();
        field = CreateField(stageEntity, fieldArea, timeClient, fsm);

        // ddong
        int subClassCode = 11;
        int level = 1;
        int trainLevel = 1;

        this.subClassEntity = TableLoader.GetTable<SubClassEntity>().Get(subClassCode);
        ClassLevelEntity levelEntity = TableLoader.GetTable<ClassLevelEntity>().Get(subClassEntity.classCode, level);
        TrainLevelEntity trainLevelEntity = TableLoader.GetTable<TrainLevelEntity>().Get(subClassEntity.classCode, trainLevel);
        FieldObjectEntity objectField = TableLoader.GetTable<FieldObjectEntity>().Get(subClassEntity.objectCode);

        Rect puzzleArea = UI.GetPuzzleArea();
        CreatePuzzle(puzzleArea, timeClient, subClassCode, out puzzleRecord, out puzzlePanel);

        user = CreateUser(stageEntity, UI, fsm);
        heroCharacter = CreateCharacter(objectField, levelEntity, trainLevelEntity, subClassEntity, user, puzzlePanel, itemDropManager, UI.AddBuffIcon, UI.RemoveBuffIcon, fsm);
        itemDropManager = new ConsumableSpawn(stageEntity.gameModeCode, levelEntity.consumableTier);

        Func<float> getLifeDrainRate = (() => gameEntity.defaultHP);
        new PlayerCharacter(user, heroCharacter, getLifeDrainRate, fsm);
        /*
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.HP, OnCharacterHPChanged);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.HP, UI.ChangeHP);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.MP, UI.ChangeMana);
        heroCharacter.Status.RegisterOnChangeEvent(HeroCharacter.Character.Armor, UI.ChangeShield);
        */

        UI.InitCommendSlots(fsm, heroCharacter);

        field.AddPlayerCharacter(heroCharacter);
        field.FocusOnForced(heroCharacter, 0);
        puzzlePanel.SetQueue(user.commandQueue);

        var screenPosTable = TableLoader.GetTable<ScreenPositionEntity2>();
        var hpToPos = screenPosTable.Values.Select(x => new KeyValuePair<float, float>(x.hp, x.screenPos));
        convertHPRatioToScreenPos = new RangeConvertor(hpToPos).Convert;

        SetFocusTarget(heroCharacter);
    }
开发者ID:pb0,项目名称:ID0_Test,代码行数:60,代码来源:MenuInGame.cs

示例15: getState

 public GDGeek.State getState(FSM fsm)
 {
     if(state_ == null){
         state_ = create(fsm);
     }
     return state_;
 }
开发者ID:gdgeek,项目名称:fly,代码行数:7,代码来源:State.cs


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