private void OnKilled() { m_isAlive = false; m_enableControl = false; HealthCurrent = 0.0f; if (crashSound) { WorldControl.GetInstance().soundController.PlayShortSound(crashSound); } m_engineControl.SetEngineActive(false); if (destroyedRocketObject != null) { destroyedRocketObject.SetActive(true); } if (rocketObject != null) { rocketObject.SetActive(false); } WorldControl.GetInstance().ShowMessage("You broke you rocket. Try again."); StartCoroutine(RestartCrt()); }
public void OnButtonEndLevelPressed() { WorldControl.GetInstance().EndLevel(); DialogsController.GetInstance().ShowDialog(DialogType.StartMenu); SetActive(false); }
void Start() { if (m_engineWorkingSound) { WorldControl.GetInstance().soundController.SetEngineAudioClip(m_engineWorkingSound); } }
public override void OnTriggered(RocketControl rocket) { if (WorldControl.GetInstance().getMap().GetComponent <MapInfo>().m_collectSound) { WorldControl.GetInstance().soundController.PlayShortSound(WorldControl.GetInstance().getMap().GetComponent <MapInfo>().m_collectSound); } Destroy(gameObject); }
public void ApplyDamage(float damageAmount) { HealthCurrent -= damageAmount; WorldControl.GetInstance().CallHpChanged(HealthCurrent); if (HealthCurrent <= 0) { OnKilled(); } }
public override void OnTrigerStay(RocketControl rocket) { if (m_idx == WorldControl.GetInstance().CurrentCheckpoint || m_allowedVelosity < rocket.GetComponent <Rigidbody2D>().velocity.magnitude) { return; } WorldControl.GetInstance().OnCheckpointSaved(m_idx); WorldControl.GetInstance().ShowMessage("Checkpoint saved!"); }
public void OnButtonStartPressed() { if (WorldControl.GetInstance() == null) { return; } WorldControl.GetInstance().LoadLevel(m_mapIdx); SetActive(false); }
public static void Clear() { PlayerPrefs.DeleteAll(); Init(); WorldControl wc = WorldControl.GetInstance(); if (wc != null) { wc.Init(); } }
private void Start() { WorldControl.GetInstance().OnHPChanged += OnValueChanged; WorldControl.GetInstance().OnRocketCreated += OnRocketCreated; var rocket = WorldControl.GetInstance().GetRocketControl(); if (rocket) { OnRocketCreated(rocket); } }
override public void OnEngineStart() { ParticleSystem particleSystem = GetComponent <ParticleSystem>(); if (particleSystem != null) { particleSystem.Play(); } transform.parent.GetComponent <Rigidbody2D>().AddForce((Vector2)transform.parent.up * m_power * Time.deltaTime); if (m_engineStartSound) { WorldControl.GetInstance().soundController.PlayShortSound(m_engineStartSound); } }
public void Activate() { if (m_state != State.Inactive) { return; } m_state = State.Active; if (m_particleSystem) { m_particleSystem.Play(); } WorldControl.GetInstance().ShowMessage("Checkpoint activated!"); }
public bool InitWithMapIdx(int mapIdx) { m_mapIdx = mapIdx; var mapPaths = WorldControl.GetInstance().MapList.GetMapPaths(mapIdx); if (mapPaths == null) { m_textMapName.text = $"MISSING {mapIdx}"; SetIconSprite(MapsHelper.GetDefaultIcon()); return(false); } m_textMapName.text = mapPaths.Name; SetIconSprite(mapPaths.GetMapIcon()); return(true); }
private void UpdateScrollContent() { ClearScroll(); var mapList = WorldControl.GetInstance().MapList; for (var i = 0; i < mapList.Count; ++i) { var itemController = Instantiate(m_mapItemPrefab, m_scroll.content); if (itemController.InitWithMapIdx(i)) { itemController.OnPressed += OnMapSelected; } else { Destroy(itemController.gameObject); } } }
public virtual void OnEngineStop() { ParticleSystem particleSystem = GetComponent <ParticleSystem>(); if (particleSystem) { particleSystem.Stop(); } if (m_engineStopSound) { WorldControl.GetInstance().soundController.PlayShortSound(m_engineStopSound); } if (m_engineWorkingSound) { WorldControl.GetInstance().soundController.StopEngineSound(); } }
public void Reset() { m_isAlive = true; m_enableControl = true; HealthCurrent = m_durability; WorldControl.GetInstance().CallHpChanged(HealthCurrent); if (rocketObject) { rocketObject.SetActive(true); } if (destroyedRocketObject) { destroyedRocketObject.SetActive(false); } m_engineControl.SetEngineActive(false); }
private void Update() { if (!m_enableControl || !WorldControl.GetInstance().IsInGame || WorldControl.GetInstance().IsPaused) { return; } var isEngine = Input.GetButton("Jump"); m_engineControl.SetEngineActive(isEngine); float rotation = Input.GetAxis("Horizontal"); if (rotation != 0) { var sign = rotation > 0 ? -1 : 1; transform.Rotate(0, 0, sign * Time.deltaTime * (1 + m_agility / GetComponent <Rigidbody2D>().angularDrag), Space.Self); } }
public void SetMapIdx(int mapIdx) { m_mapIdx = mapIdx; var mapPaths = WorldControl.GetInstance().MapList.GetMapPaths(mapIdx); if (mapPaths == null) { SetActive(false); return; } var mapInfo = Resources.Load <MapInfo>(mapPaths.PrefabPath); m_imageIcon.sprite = mapInfo.m_mapIcon; m_imageMiniMap.sprite = mapInfo.m_miniImage; m_textMapName.text = mapInfo.m_mapName; m_textMapDescription.text = mapInfo.m_mapDiscription; m_textMapGravity.text = string.Format(m_stringGravity, mapInfo.m_mapGravity); m_textMapDrag.text = string.Format(m_stringDrag, mapInfo.m_mapDrag); m_textMapFriction.text = string.Format(m_strinFriction, mapInfo.m_mapFriction); m_textMapBounciness.text = string.Format(m_strinBounciness, mapInfo.m_mapBounciness); }
public override void OnTrigerStay(RocketControl rocket) { if (m_state != State.Timer) { return; } m_timeLeft -= Time.deltaTime; if (m_timeLeft <= 0) { m_state = State.Checked; if (m_particleSystem) { m_particleSystem.Stop(); } m_collider.enabled = false; WorldControl.GetInstance().ShowMessage("Checkpoint collected!"); WorldControl.GetInstance().OnTargetZoneChecked(); } else { WorldControl.GetInstance().ShowMessage("Checkpoint will be collected in (" + string.Format("{0:0.00}", Mathf.Round(m_timeLeft * 100.0f) / 100.0f) + ")"); } }
public void OnPauseButtonPressed() { WorldControl.GetInstance().SetPause(true); }
public void OnMusicValueChanged(Slider slider) { WorldControl.GetInstance().SetMusicVolume(slider.value); }
private IEnumerator RestartCrt() { yield return(new WaitForSeconds(2)); WorldControl.GetInstance().RestartFromCheckpoint(); }
public void OnButtonContinuePressed() { SetActive(false); WorldControl.GetInstance().SetPause(false); }
public void OnSoundValueChanged(Slider slider) { WorldControl.GetInstance().SetFXVolume(slider.value); }
public void OnButtonRestartLevelPressed() { WorldControl.GetInstance().RestartLevel(); SetActive(false); }
public void Start() { WorldControl.GetInstance().OnRocketCreated += OnRocketCreated; }
private void Start() { m_textMessage.text = ""; WorldControl.GetInstance().OnMessage += OnMessage; }
protected override void OnActivated() { m_sliderSound.value = WorldControl.GetInstance().GetFXVolume(); m_sliderMusic.value = WorldControl.GetInstance().GetMusicVolume(); }