private void UpdateState() { switch (blockState) { case WallBlockState.Emerging: if (Time.time > nextStateTime) { blockState = WallBlockState.Active; } break; case WallBlockState.Active: break; case WallBlockState.Expired: break; } }
protected virtual void StartEmerging() { blockState = WallBlockState.Emerging; nextStateTime = Time.time + GameplayManager.blockEmergeDuration; // EmergeFX are assumed to be on&animating by default when they spawn GameObject fx = (GameObject)Instantiate(emergeFXPrefab) as GameObject; CodeTools.CopyTransform(transform, fx.transform, true, true, false); fx.transform.parent = transform; Destroy(fx, (GameplayManager.blockEmergeDuration + 2f)); AudioSource audio = GetComponent <AudioSource>(); if ((emergeSFX != null) && (audio != null)) { audio.clip = emergeSFX; audio.PlayOneShot(emergeSFX, 0.3f); } }
protected void InitExpiredState() { blockState = WallBlockState.Expired; }