merge
This commit is contained in:
@@ -30,7 +30,7 @@ public class SlimeAI : MonoBehaviour
|
||||
animator = GetComponent<Animator>();
|
||||
player = GameObject.FindWithTag("Player");
|
||||
HP = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@@ -75,7 +75,7 @@ public class SlimeAI : MonoBehaviour
|
||||
animator.SetBool("EnemyInAggroRange", false);
|
||||
animator.SetBool("EnemyInVisionRange", false);
|
||||
}
|
||||
|
||||
|
||||
if (!isWandering)
|
||||
{
|
||||
//Idle
|
||||
@@ -99,8 +99,8 @@ public class SlimeAI : MonoBehaviour
|
||||
animator.SetBool("Wandering", true);
|
||||
transform.position += transform.forward * moveSpeed * Time.deltaTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
void Rotate()
|
||||
@@ -144,6 +144,29 @@ public class SlimeAI : MonoBehaviour
|
||||
//do attack e.g check for player in range/hit collider
|
||||
}
|
||||
|
||||
void Attack()
|
||||
{
|
||||
if (!isAttacking)
|
||||
{
|
||||
isAttacking = true;
|
||||
attackStartTime = Time.time;
|
||||
StartCoroutine(DelayedAttack());
|
||||
}
|
||||
else if (Time.time - attackStartTime > 0.833)
|
||||
{
|
||||
isAttacking = false;
|
||||
attackStartTime = 0.0f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
IEnumerator DelayedAttack()
|
||||
{
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
Debug.Log("Attack");
|
||||
//do attack e.g check for player in range/hit collider
|
||||
}
|
||||
|
||||
IEnumerator Wander()
|
||||
{
|
||||
int rotTime = Random.Range(1, 3);
|
||||
@@ -174,4 +197,4 @@ public class SlimeAI : MonoBehaviour
|
||||
isWandering = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user