Exemple #1
0
    // ========================================================================== //

    /* protected - Override & Unity API         */

    protected override void OnAwake()
    {
        base.OnAwake();

        if (player == null)
        {
            player = GameObject.FindGameObjectWithTag("Player");
        }
        _controller = GetComponent <CPlatformerCalculator>();
        //_characterScript = GetComponent<CPlatformerController>();
        _pathAgent = GetComponent <CPathFindingAgent>();

        if (_pathScript == null)
        {
            _pathScript = GameObject.FindObjectOfType <CPathfinding>();
        }

        _behaviourText = transform.Find("BehaviourText").GetComponent <TextMesh>();
        switch (state)
        {
        case EAIState.flee: _behaviourText.text = "Flee"; break;

        case EAIState.groundpatrol: _behaviourText.text = "Ground Patrol"; break;

        default: _behaviourText.text = ""; break;
        }
    }
    // ========================================================================== //

    /* protected - Override & Unity API         */

    protected override void OnAwake()
    {
        base.OnAwake();

        if (_pathfindingManagerScript == null)
        {
            _pathfindingManagerScript = FindObjectOfType <CPathfinding>();
        }
        _aiControllerScript = GetComponent <CPlatformerAIController>();
        _characterScript    = GetComponent <CPlatformerController>();
        _controller         = GetComponent <CPlatformerCalculator>();
        if (drawPath)
        {
            AddLineRenderer();
        }
    }