public override void Initialize() { if (NPC != null)//如果有NPC布置了击杀巫师的任务 { //完成任务需求的对象 talker = NPC.GetComponent <TalkUI>(); } priorityInType = 1; player = GameObject.Find("Player"); movementComponent = GetComponent <MovementWitcher>(); if (movementComponent == null) { Debug.LogError("在Witcher中,没有找到Movement脚本!"); } attackComponent = GetComponent <WitcherAttack>(); if (attackComponent == null) { Debug.LogError("在Witcher中,没有找到Attack脚本!"); } defenceComponent = GetComponent <DefenceEnemies>(); if (defenceComponent == null) { Debug.LogError("在Witcher中,没有找到Defence脚本!"); } //设置最大生命值 defenceComponent.Initialize(10); }
void Awake() { canFight = GetComponent <CanFight>(); if (canFight == null) { Debug.LogError("在" + gameObject.name + "中,找不到CanFight组件!"); } //使用string数组初始化canFight能够检测到的层 string[] targets = new string[1]; targets[0] = targetLayerName; canFight.Initiailize(targets); movementComponent = GetComponent <MovementWitcher>(); if (movementComponent == null) { Debug.LogError("在" + gameObject.name + "中,找不到MovementPlayer组件!"); } poolManager = GameObject.Find("PoolManager").GetComponent <PoolManager>(); //用于行为树的一些参数 canActiveAttack = true; attackLength = 6f; }
public override void OnStart() { base.OnStart(); movementComponent = GetComponent <MovementWitcher>(); }