new void Start() { base.Start(); _hurtcontroller._DieCallBack = new DieCallBack(() => { _anim.SetTrigger("disappear"); CancelInvoke(); Timer.Register(1, () => { transform.position = new Vector3(diePos.position.x, diePos.position.y + 15); _anim.SetTrigger("die"); GetComponent <BoxCollider2D>().enabled = false; Timer.Register(0.5f, () => { transform.DOMoveY(diePos.position.y, 0.5f).SetEase(Ease.Linear); Timer.Register(0.5f, () => { AudioManager._instance.PlayBgm("普通"); DOTween.Shake(() => game.Scene._instance.VirtualCamera.GetComponent <CinemachineCameraOffset>().m_Offset, x => game.Scene._instance.VirtualCamera.GetComponent <CinemachineCameraOffset>().m_Offset = x, 0.3f, 1f); }); }); }); Timer.Register(4.5f, () => { _anim.SetTrigger("diedisappear"); game.Scene._instance.ChangeCamera(0); DashBook.SetActive(true); BossTrigger.SetActive(false); }); Destroy(gameObject, 5); }); _hurtcontroller._HurtCallBack = new HurtCallBack(() => { GameObject temp2 = GameObjectPool.GetInstance().GetGameObject("主角攻击特效", transform.position, Quaternion.identity); GameObjectPool.GetInstance().ReleaseGameObject("主角攻击特效", temp2, 0.5f); if (_anim.IsAnim("下冲出现")) { if (NextTimer != null) { NextTimer.Cancel(); } ReleaseSkill(); } }); }
public void ResetBoss() { isReset = true; _machine.ResetState(); ShootIndex = 0; lastindex = 0; AudioManager._instance.PlayBgm("普通"); _hurtcontroller.Health = _hurtcontroller.MaxHealth; CancelInvoke(); if (NextTimer != null) { NextTimer.Cancel(); } BossTrigger.GetComponent <Trigger>().ResetTrigger(); transform.rotation = Quaternion.identity; gameObject.transform.localPosition = startpos; _anim.SetTrigger("idle"); gameObject.SetActive(false); }
private void OnDisable() { CancelInvoke(); NextTimer.Cancel(); }