void Awake() { KMGameplayRoom gameplayRoom = GetComponent <KMGameplayRoom>(); Debug.Log("Setting on light change"); gameplayRoom.OnLightChange = OnLightChange; }
/// <summary> /// Unity event. /// </summary> private void Awake() { _data = GetComponent <FactoryRoomData>(); _conveyorBeltAnimator = GetComponent <Animator>(); _room = GetComponent <KMGameplayRoom>(); _audio = GetComponent <KMAudio>(); _gameCommands = GetComponent <KMGameCommands>(); _room.OnLightChange += OnLightChange; }
void Init() { GetComponent <KMBombModule>().OnActivate += OnActivateCaller; KMGameplayRoom room = GetComponent <KMGameplayRoom>(); if (room != null) { room.OnLightChange += OnLightChange; } }
private void OnDrawGizmos() { if (_gameplayRoom == null) { _gameplayRoom = FindObjectOfType <KMGameplayRoom>(); if (_gameplayRoom == null) { return; } } if (_gameplayRoom.PlayerSpawnPosition != null) { Gizmos.color = PLAYER_COLOR; Matrix4x4 oldMatrix = Gizmos.matrix; Gizmos.matrix = _gameplayRoom.PlayerSpawnPosition.localToWorldMatrix; Gizmos.DrawCube(new Vector3(0.0f, PLAYER_SIZE.y * 0.5f, 0.0f), PLAYER_SIZE); Gizmos.matrix = oldMatrix; } if (_gameplayRoom.BombSpawnPosition != null) { Gizmos.color = BOMB_COLOR; Matrix4x4 oldMatrix = Gizmos.matrix; Gizmos.matrix = _gameplayRoom.BombSpawnPosition.localToWorldMatrix; Gizmos.DrawCube(new Vector3(0.0f, BOMB_SIZE.y * 0.5f, 0.0f), BOMB_SIZE); Gizmos.matrix = oldMatrix; } int multipleBombIndex = 0; GameObject multipleBomb = null; do { Gizmos.color = MULTIPLE_BOMB_COLOR; multipleBomb = GameObject.Find(string.Format("MultipleBombs_Spawn_{0}", multipleBombIndex)); if (multipleBomb != null) { Matrix4x4 oldMatrix = Gizmos.matrix; Gizmos.matrix = multipleBomb.transform.localToWorldMatrix; Gizmos.DrawCube(new Vector3(0.0f, BOMB_SIZE.y * 0.5f, 0.0f), BOMB_SIZE); Gizmos.matrix = oldMatrix; } multipleBombIndex++; }while (multipleBomb != null); if (_gameplayRoom.AlarmClockSpawn != null) { Gizmos.color = ALARM_COLOR; Matrix4x4 oldMatrix = Gizmos.matrix; Gizmos.matrix = _gameplayRoom.AlarmClockSpawn.localToWorldMatrix; Gizmos.DrawCube(new Vector3(0.0f, ALARM_SIZE.y * 0.5f, 0.0f), ALARM_SIZE); Gizmos.matrix = oldMatrix; } if (_gameplayRoom.DossierSpawn != null) { Gizmos.color = DOSSIER_COLOR; Matrix4x4 oldMatrix = Gizmos.matrix; Gizmos.matrix = _gameplayRoom.DossierSpawn.localToWorldMatrix; Gizmos.DrawCube(new Vector3(0.0f, DOSSIER_SIZE.y * 0.5f, 0.0f), DOSSIER_SIZE); Gizmos.matrix = oldMatrix; } }