private void Start() { if (StrawberryMgr.instance == null) { Debug.Assert(false, string.Format("场景缺少assets\\prefabs\\world\\StrawberryMgr物件,请摆放上去")); } m_nIndexOfStrawberry = StrawberryMgr.instance.GetCurrentIndex(); if (StrawberryMgr.instance.IsIndexHasBeenTake(m_nIndexOfStrawberry) == true) { Destroy(gameObject); } else if (StrawberryMgr.instance.IsSceneStrawberryInit(m_nIndexOfStrawberry) == true) { //CheckPointTotalManager.instance.DescreaseAndUpdate(); Destroy(gameObject); } else { StrawberryMgr.instance.InitStrawberry(m_nIndexOfStrawberry); transform.SetParent(null); DontDestroyOnLoad(gameObject); if (StrawBerryFolloingTime == 0.0f) { StrawBerryFolloingTime = 3.0f; } m_vecOriginalPos = transform.position; sr = GetComponent <SpriteRenderer>(); worldManager = GameObject.FindGameObjectWithTag("WorldManager").GetComponent <CheckPointTotalManager>(); m_playerCtrl = GlobalVariable.GetPlayer(); GlobalVariable.RegisteSetPlayerEvent(_setPlayer); if (m_playerCtrl != null) { m_playerCtrl.RegisteDieAction(_playerDie); } else { Debug.Assert(false); } if (FollowingSpeed == 0.0f) { FollowingSpeed = 3.0f; } } }
private void _setPlayer(PlayerControl1 _player) { m_playerCtrl = _player; m_playerCtrl.RegisteDieAction(_playerDie); }