Example #1
0
    void OnTriggerStay(Collider other)
    {
        AIStateMachine machine = GameSceneManager.instance.GetAIStateMachine(other.GetInstanceID());

        if (machine != null && _controller != null)
        {
            _controller.DoStickiness();
            machine.VisualThreat.Set(AITargetType.Visual_Player, _controller.characterController, _controller.transform.position, Vector3.Distance(machine.transform.position, _controller.transform.position));
            machine.SetStateOverride(AIStateType.Attack);
        }
    }
Example #2
0
    // Update is called once per frame
    private void OnTriggerStay(Collider col)
    {
        AIStateMachine machine = GameSceneManager.Instance.GetAIStateMachine(col.GetInstanceID());

        if (machine != null && controller != null)
        {
            controller.DoStickiness();

            machine.visualThreat.Set(AITargetType.VisualPlayer, controller.CharacterController, controller.transform.position,
                                     Vector3.Distance(machine.transform.position, controller.transform.position));

            machine.SetStateOverride(AIStateType.Attack);
        }
    }
    void OnTriggerStay(Collider col)
    {
        // Is this collier a zombie
        AIStateMachine machine = GameSceneManager.instance.GetAIStateMachine(col.GetInstanceID());

        if (machine != null && _controller != null)
        {
            // Apply stickiness
            _controller.DoStickiness();

            // Set THIS location as the zombie's visual threat
            machine.VisualThreat.Set(AITargetType.Visual_Player,
                                     _controller.characterController,
                                     _controller.transform.position,
                                     Vector3.Distance(machine.transform.position, _controller.transform.position)
                                     );

            // Force the zombie in ATTACK state
            machine.SetStateOverride(AIStateType.Attack);
        }
    }