Beispiel #1
0
    public override void Start()
    {
        base.Start();
        _snout    = GetComponentInChildren <ProjectileProjector>();
        _movement = GetComponent <SidescrollingMovement>();

        List <State> states = new List <State>
        {
            new State {
                Condition = () => true, Behavior = DoNothing
            },
            new State {
                Condition = PlayerNearby, Behavior = ChooseAction
            },
            new State {
                Condition = IsHit, Behavior = DoNothing
            }
        };

        _fsm = new StateMachine(states);
    }
Beispiel #2
0
    // Use this for initialization
    public override void Start()
    {
        base.Start();
        _projector = GetComponentInChildren <ProjectileProjector>();
        _webThread = GetComponent <LineRenderer>();

        _controller = GetComponent <CharacterController>();

        _behaviorFSM = new StateMachine(new List <State> {
            new State {
                Condition = DefaultCondition, Behavior = DoNothing
            },
            new State {
                Condition = SensesPlayer, Behavior = MoveTowardPlayer
            },
            new State {
                Condition = IsOverPlayer, Behavior = Attack
            },
            new State {
                Condition = AttackingTarget, Behavior = VerticalGrappling
            }
        });
    }
Beispiel #3
0
    // Use this for initialization
    protected void Start()
    {
        _sense = GetComponentInChildren<PlayerSense>();
        _sprite = GetComponentInChildren<SpriteSystem>();
        _projector = GetComponentInChildren<ProjectileProjector>();
        _webThread = GetComponent<LineRenderer>();

        _controller = GetComponent<CharacterController>();

        _behaviorFSM = new StateMachine(new List<State>	{
            new State { Condition = DefaultCondition, Behavior = DoNothing},
            new State { Condition = SensesPlayer,     Behavior = MoveTowardPlayer },
            new State { Condition = IsOverPlayer,     Behavior = Attack },
            new State { Condition = AttackingTarget,  Behavior = VerticalGrappling }
        });
    }
Beispiel #4
0
    void Start()
    {
        _snout = GetComponentInChildren<ProjectileProjector>();
        _movement = GetComponent<SidescrollingMovement>();
        _sprite = GetComponentInChildren<SpriteSystem>();

        List<State> states = new List<State>
        {
            new State{ Condition = () => true, Behavior = DoNothing },
            new State{ Condition = PlayerNearby, Behavior = ChooseAction },
            new State{ Condition = IsHit, Behavior = DoNothing }
        };

        _fsm = new StateMachine(states);
    }