Beispiel #1
0
    // Start is called before the first frame update
    void Start()
    {
        fsm = new FSM_System_MonsterS();

        FSM_MonsterS patrol = new PatrolStates(fsm, 1, this.gameObject);

        fsm.AddState(patrol);
        patrol.Addtransition(Transition.Inattackrange, Monster_State.Attack);
        patrol.Addtransition(Transition.Attacked, Monster_State.Hurt);

        FSM_MonsterS attack = new AttackStates(fsm, 1, this.gameObject);

        fsm.AddState(attack);
        attack.Addtransition(Transition.Searchhero, Monster_State.Trace);
        attack.Addtransition(Transition.Attacked, Monster_State.Hurt);

        FSM_MonsterS hurt = new HurtStates(fsm, 1, this.gameObject);

        fsm.AddState(hurt);
        hurt.Addtransition(Transition.Searchhero, Monster_State.Trace);
        hurt.Addtransition(Transition.Outoflife, Monster_State.Die);

        FSM_MonsterS die = new DieStates(fsm, 1, this.gameObject);

        fsm.AddState(die);
    }
Beispiel #2
0
 public AttackStates(FSM_System_MonsterS fsm, int monstertype, GameObject thismonster) : base(fsm, monstertype, thismonster)
 {
     monster_state = Monster_State.Attack;
     player_T      = GameObject.FindWithTag("player").transform;
     switch (monstertype)
     {
     case 1:
     {
     }
     break;
     }
 }
Beispiel #3
0
    public PatrolStates(FSM_System_MonsterS fsm, int monstertype, GameObject thismonster) : base(fsm, monstertype, thismonster)
    {
        monster_state = Monster_State.Trace;
        player_T      = GameObject.FindWithTag("player").transform;
        thismonster_T = thismonster.transform;
        audiosource   = thismonster.AddComponent <AudioSource>();
        switch (monstertype)
        {
        case 1:
        {
            speed = thismonster.GetComponent <FireMonStates>().movespeed;
        }
        break;

        case 2:
        {
            speed = thismonster.GetComponent <FlyMonStates>().movespeed;
        }
        break;
        }
    }
Beispiel #4
0
    public HurtStates(FSM_System_MonsterS fsm, int monstertype, GameObject thismonster) : base(fsm, monstertype, thismonster)
    {
        monster_state = Monster_State.Hurt;
        audiosource   = thismonster.GetComponent <AudioSource>();
        switch (monstertype)
        {
        case 1:
        {
            hurtTime_standard = thismonster.GetComponent <FireMonStates>().hurtTime;
            hurtTime_over     = 0;
            hurt_sound        = thismonster.GetComponent <FireMonStates>().Hurt;
        }
        break;

        case 2:
        {
            hurtTime_standard = thismonster.GetComponent <FlyMonStates>().hurtTime;
            hurtTime_over     = 0;
            hurt_sound        = thismonster.GetComponent <FlyMonStates>().Hurt;
        }
        break;
        }
    }
Beispiel #5
0
 public Idlestates(FSM_System_MonsterS fsm, int monstertype, GameObject thismonseter) : base(fsm, monstertype, thismonseter)
 {
     monster_state = Monster_State.Idle;
 }
Beispiel #6
0
 public FSM_MonsterS(FSM_System_MonsterS fsm, int monstertype, GameObject monster)
 {
     this.fsm         = fsm;
     this.MonsterType = monstertype;
     this.thismonster = monster;
 }