void OnDestroy() { ScreenShakey screenShakey = Camera.main.GetComponent <ScreenShakey>(); DungeonCamera dungeonCamera = Camera.main.GetComponent <DungeonCamera>(); if (screenShakey) { screenShakey.shakeybakeys.Remove(this); } if (dungeonCamera) { dungeonCamera.shakeybakeys.Remove(this); } }
// Use this for initialization void Start() { m_DungeonUnitManager = new DungeonUnitManager(); int mainWarriorId = GetMainWarriorId(); m_DungeonUnitManager.CreateHero(mainWarriorId, m_HeroPosition, m_HeroOrient); if (m_DungeonUnitManager.HeroController == null) { Debug.LogError("hero is null"); return; } GameObject carmera = GameObject.FindWithTag("MainCamera"); DungeonCamera dungeonCamera = carmera.GetComponent <DungeonCamera> (); dungeonCamera.target = m_DungeonUnitManager.HeroController.transform; }
void Start() { ScreenShakey screenShakey = Camera.main.GetComponent <ScreenShakey>(); DungeonCamera dungeonCamera = Camera.main.GetComponent <DungeonCamera>(); shakenibba = shakeyStrength; if (screenShakey) { screenShakey.shakeybakeys.Add(this); } if (dungeonCamera) { dungeonCamera.shakeybakeys.Add(this); } if (duration > 0) { if (destroyAfterDuration) { Destroy(this, duration); } } }