void OnDestroy() { if (Instance == this) { Instance = null; } }
void Start() { if (Instance != null) { Destroy(this); } else { Instance = this; } TargetCharacter = ZDGameManager.GetPlayerProps().Script; ZDUIClass = GameObject.Find("ZDUI").GetComponent <ZDUI>(); BagClass = GameObject.Find("Item").GetComponent <BagController>(); }
void FixedUpdate() { if (ZDGameManager.GetGameState() == ZDGameState.Play) { if (Shrink) { Vector3 FramScaleChange = ScaleChangeRate * Time.fixedDeltaTime; Vector3 DeltaScale = TargetScale - VisibleArea.localScale; if (DeltaScale.magnitude < FramScaleChange.magnitude) { Shrink = false; VisibleArea.localScale = TargetScale; } else { VisibleArea.localScale += FramScaleChange; } } if (DoDamage) { if (GetCachedInRestrict(ZDController.GetTargetCharacter())) { cachedState.InZoneSeconds += Time.deltaTime; if (cachedState.InZoneSeconds > ZDGameRule.RestrictZone.HurtThresh) { cachedState.InZoneSeconds = 0; ZDController.GetTargetCharacter().Hurt(10); } } else if (!cachedState.InZoneSeconds.Equals(0)) { cachedState.InZoneSeconds = 0; } } } }