コード例 #1
0
    void Awake() {
        //navMeshAgent = GetComponent<NavMeshAgent>();
        

        sphereCollider = GetComponent<SphereCollider>();
        lastPlayerSighting = GameManager.Instance.GetComponent<LastPlayerSightingScript>();
        player = GameObject.FindGameObjectWithTag(Tags.player);

        // Set the personal sighting and the previous sighting to the reset position.
        personalLastSighting = lastPlayerSighting.resetPosition;
        previousSighting = lastPlayerSighting.resetPosition;
    }
コード例 #2
0
ファイル: EnemyScript.cs プロジェクト: Gotyn/2.2-INDIE-GAME
    void Awake () {

        time = Time.time;
        //Getting the references
        agent = GetComponent<NavMeshAgent>();
        enemySight = GetComponent<EnemySightScript>();
        lastPlayerSighting = GameManager.Instance.GetComponent<LastPlayerSightingScript>();

        if (target == null) target = GameObject.FindWithTag(Tags.player).transform;
        InvokeRepeating("StateLogic", 0, 0.01f);

        StartCoroutine("StateMachine");
	}