protected void OnEnable() { m_Controller = GetComponentInChildren <EnemyController>(); m_Controller.animator.Play(hashIdleState, 0, Random.value); SceneLinkedSMB <SpitterBehaviour> .Initialise(m_Controller.animator, this); }
protected void OnEnable() { m_Controller = GetComponentInChildren <EnemyController>(); originalPosition = transform.position; meleeWeapon.SetOwner(gameObject); m_Controller.animator.Play(hashIdleState, 0, Random.value); SceneLinkedSMB <ChomperBehavior> .Initialise(m_Controller.animator, this); }
// Called automatically by Unity after Awake whenever the script is enabled. void OnEnable() { SceneLinkedSMB <PlayerController> .Initialise(m_Animator, this); m_Damageable = GetComponent <Damageable>(); m_Damageable.onDamageMessageReceivers.Add(this); m_Damageable.isInvulnerable = true; EquipMeleeWeapon(false); m_Renderers = GetComponentsInChildren <Renderer>(); }
//启用脚本后,在唤醒后由Unity自动调用。 // Called automatically by Unity after Awake whenever the script is enabled. void OnEnable() { SceneLinkedSMB <PlayerController> .Initialise(m_Animator, this); //初始化SceneLinkedSMB类将动画控制机和场景链接 m_Damageable = GetComponent <Damageable>(); //初始化玩家受伤状态对象 m_Damageable.onDamageMessageReceivers.Add(this); //将当前脚本添加为玩家受伤状态的接受者 m_Damageable.isInvulnerable = true; //设置为无敌状态 EquipMeleeWeapon(false); //不装备武器 m_Renderers = GetComponentsInChildren <Renderer>(); //初始化渲染器 }
protected void OnEnable() { Controller = GetComponentInChildren <EnemyController>(); OriginalPosition = transform.position; BasicWeapon.SetOwner(gameObject); ClawWeapon1.SetOwner(gameObject); ClawWeapon2.SetOwner(gameObject); Controller.animator.Play(Sleep, 0, Random.value); SceneLinkedSMB <AlbinoDragonBehavior> .Initialise(Controller.animator, this); }
// Called automatically by Unity after Awake whenever the script is enabled. void OnEnable() { SceneLinkedSMB <PlayerController> .Initialise(m_Animator, this); m_Damageable = GetComponent <Damageable>(); m_Damageable.onDamageMessageReceivers.Add(this); EquipMeleeWeapon(false); m_Renderers = GetComponentsInChildren <Renderer>(); m_lastPosition = transform.position; if (IsMine) { m_healthUI.ChangeHitPointUI(m_Damageable); } }
void OnEnable() { m_EnemyController = GetComponent <EnemyController>(); m_NavMeshAgent = GetComponent <NavMeshAgent>(); SceneLinkedSMB <GrenadierBehaviour> .Initialise(m_EnemyController.animator, this); fistWeapon.SetOwner(gameObject); fistWeapon.EndAttack(); m_CoreMaterial = coreRenderer.materials[1]; m_OriginalCoreMaterial = m_CoreMaterial.GetColor("_Color2"); m_EnemyController.animator.Play(hashIdleState, 0, Random.value); shield.SetActive(false); m_Damageable = GetComponentInChildren <Damageable>(); }
protected float m_ShieldActivationTime; //盾的启动时间 void OnEnable() //游戏开始前的准备 { m_EnemyController = GetComponent <EnemyController>(); //获取怪物的敌人控制器组件 m_NavMeshAgent = GetComponent <NavMeshAgent>(); //获得怪物的寻路组件 SceneLinkedSMB <GrenadierBehaviour> .Initialise(m_EnemyController.animator, this); fistWeapon.SetOwner(gameObject); //设置可以使用拳击的对象 fistWeapon.EndAttack(); //默认拳击为停止状态 m_CoreMaterial = coreRenderer.materials[1]; //将核心材质替换为蒙皮过滤器的2号材质 m_OriginalCoreMaterial = m_CoreMaterial.GetColor("_Color2"); //将基础颜色设为核心材质的_Color2的颜色 m_EnemyController.animator.Play(hashIdleState, 0, Random.value); //播放一个随机进度的投掷者站立动画 https://docs.unity3d.com/ScriptReference/Animator.Play.html shield.SetActive(false); //盾关闭 m_Damageable = GetComponentInChildren <Damageable>(); //获得子物体的伤害控制组件 }
void Start() { m_Animator = GetComponent <Animator>(); if (m_Animator == null) { throw new MissingComponentException("EffectEvents requires an animator!"); } SceneLinkedSMB <EffectEvents> .Initialise(m_Animator, this); m_EventLookup.Clear(); for (int i = 0; i < events.Length; ++i) { m_EventLookup[Animator.StringToHash(events[i].eventName)] = events[i]; //lookup if we have particle system on target as those need to be restarted on re-enabling, and faster to lookup only once on init for (int k = 0; k < events[i].targets.Length; ++k) { events[i].targets[k].particlesystem = events[i].targets[k].gameObject.GetComponentInChildren <ParticleSystem>(); } } }
// Called automatically by Unity after Awake whenever the script is enabled. void OnEnable() { SceneLinkedSMB <PlayerController> .Initialise(m_Animator, this); m_Renderers = GetComponentsInChildren <Renderer>(); }