コード例 #1
0
    void Start()
    {
        //refs to self and daddy
        this.navAgent  = this.GetComponent <NavMeshAgent>();
        this.zomboMov  = this.GetComponent <ZomboMovement>();
        this.zomboAtk  = this.GetComponent <ZomboAttack>();
        this.aiManager = GameObject.FindGameObjectWithTag("Manager").GetComponent <AI_Manager>();

        if (aiManager == null)
        {
            Debug.Log("ERROR: Can't find AI manager. SOURCE: " + this.transform.name);
        }
    }
コード例 #2
0
    private Renderer zomboRenderer; // for testing purposes TODO: Remove when zombo is alive.

    void Start()
    {
        //setting up refs
        if (target == null && GameObject.FindGameObjectWithTag(playerTag))
        {
            target = GameObject.FindGameObjectWithTag(playerTag).transform;  //TODO: optimization so we can get Vector3 and get the .position.
        }

        this.agent         = this.GetComponent <NavMeshAgent>();
        this.wanderPoint   = RandomWanderPoint();
        this.zomboRenderer = this.GetComponent <MeshRenderer>();
        this.zomboAtk      = this.GetComponent <ZomboAttack>();

        //MOVED TO AI_MANAGER this.zomboAttackTimer = zomboAttackSpeed * 3; //x3 is gameplay factor.
    }