Beispiel #1
0
    void Update()
    {
        float distance = Vector3.Distance(transform.position, PlayerManager.instance.playerObject.transform.position);

        if (distance <= enemy.enemyTriggerRange)
        {
            transform.LookAt(PlayerManager.instance.playerObject.transform.position);

            enemyMotor.moveToPoint(PlayerManager.instance.playerObject.transform.position);
        }
        else
        {
            enemyMotor.startWander();
        }

        if (enemyHealth <= 0)
        {
            killEnemy();
        }
    }