using UnityEngine; using System.Collections; public class DoorAI : CraftAI { // Use this for initialization override protected void Start () { base.Start(); checkTimeInterval = 1.5f; SetPlayer (new Player ()); } protected virtual void FixedUpdate () { if(!CanSendMessage()) { return; } if(CheckDead()) { return; } if(GameTime.time-lastCheckTime >= checkTimeInterval) { lastCheckTime = GameTime.time; } else { return; } if(owner.target == null || owner.target.IsDead()) { owner.target = null; FindTarget(); } else { FindMaxThreatTarget(); float targetDistance = NumberUtil.distanceVector3(owner.position, owner.target.position); if(targetDistance > owner.viewRange) { owner.target = null; } else { Attack(); } } } protected void Attack() { Power attack = owner.GetPowerManager().GetAttack(); if(attack.IsInRange(owner.target)) { owner.GetPowerManager().AttempUserPower(attack.GetId(), battleController); } } }