29 lines
630 B
C#
29 lines
630 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Monster : Entity
|
|
{
|
|
// Start is called before the first frame update
|
|
override protected void Start()
|
|
{
|
|
base.Start();
|
|
base.SetName("Monster");
|
|
}
|
|
|
|
void FixedUpdate() => MoveToTarget(Time.fixedDeltaTime);
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if(IsInAttackRange()){
|
|
if(attackTimer >= attackCooldown){
|
|
Attack();
|
|
attackTimer = 0;
|
|
}else{
|
|
attackTimer += Time.deltaTime;
|
|
}
|
|
}
|
|
}
|
|
}
|