private void Awake() { Debug.Log("Entity -" + name); //加载组件 animator = GetComponent <Animator>(); shootingBehavior = GetComponent <ShootingBehavior>(); movingBehavior = GetComponent <MovingBehavior>(); hitBehavior = GetComponent <HitBehavior>(); collider = GetComponent <Collider2D>(); rigidbody = GetComponent <Rigidbody2D>(); stat = GetComponent <Stats>(); //音效初始化 if (shootingBehavior != null) { shootingBehavior.audio = usingAudio; } if (movingBehavior != null) { movingBehavior.audio = usingAudio; } if (hitBehavior != null) { hitBehavior.audio = usingAudio; } PickingBehavior pickingBehavior = GetComponent <PickingBehavior>(); if (pickingBehavior != null) { pickingBehavior.audio = usingAudio; } }
// Use this for initialization void Start() { audio = GetComponent <AudioSource>(); movingObj = GetComponent <MovingBehavior>(); }
private ShootingBehavior shootingBehavior; //射击逻辑 #endregion private void Awake() { movingBehavior = GetComponent <MovingBehavior>(); shootingBehavior = GetComponent <ShootingBehavior>(); }