public bool ApplyTool(string toolName, int x, int y) { if (GameState.Mode != GameMode.Playing) { return(false); } if (toolName == GameState.EDITOR_DELETE) { if (GameState.Devices[y, x] != null && GameState.Devices[y, x].CanDelete) { GameState.Parts[GameState.Devices[y, x].PartName]++; ObjectPools.Despawn(GameState.Devices[y, x]); GameState.Devices[y, x] = null; ToolPanel.Current.Refresh(); SoundBoard.Play(SOUND_DELETE); return(true); } } else if (toolName != null) { if (GameState.Devices[y, x] == null && GameState.Parts.ContainsKey(toolName) && GameState.Parts[toolName] > 0) { CreateDevice(toolName, x, y); GameState.Devices[y, x].PartName = toolName; GameState.Parts[toolName]--; ToolPanel.Current.Refresh(); SoundBoard.Play(SOUND_ADD); return(true); } } return(false); }
IEnumerator <WaitForSeconds> PlayCleaning() { yield return(new WaitForSeconds(0.4f)); Laser.Target(transform); isLasered = true; yield return(new WaitForSeconds(0.1f)); SoundBoard.Play(SoundType.CleaningGunk); }
private void OnMouseEnter() { if (Time.timeSinceLevelLoad < noCleanStartDuration) { return; } if (!cleaning && vessel.PlayerPlaying && !cleaned) { isLasered = false; SoundBoard.Play(SoundType.TargetGunk); StartCoroutine(PlayCleaning()); } cleaningTarget = this; }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Ground") { SoundBoard.Play(SoundType.BouncingGround); scoreKeeper.GroundCollision(); cam.shaker.Shake(); } else if (collision.gameObject.tag == "Bottom" || collision.gameObject.tag == "Surface") { SoundBoard.Play(SoundType.BouncingGround); cam.shaker.Shake(); } }
void SelectTool(string toolName, Graphic icon) { if (GameState.EditorSelection != toolName) { SoundBoard.Play(SOUND_SELECT); GameEngine.Current.SelectTool(toolName); Selector.enabled = true; Selector.transform.position = icon.transform.position; } else { GameEngine.Current.SelectTool(null); Selector.enabled = false; } }
public void DeleteTool() { if (GameState.EditorSelection != GameState.EDITOR_DELETE) { SoundBoard.Play(SOUND_SELECT); GameEngine.Current.SelectTool(GameState.EDITOR_DELETE); Selector.enabled = true; Selector.transform.position = DeleteIcon.transform.position; } else { GameEngine.Current.SelectTool(null); Selector.enabled = false; } }
private IEnumerator <WaitForSeconds> Cleaned() { GetComponent <Collider2D>().enabled = false; SoundBoard.Play(SoundType.ExplodingGunk); float start = Time.timeSinceLevelLoad; while (Time.timeSinceLevelLoad - start < 0.5f) { Vibrate(); yield return(new WaitForSeconds(0.02f)); } Laser.ClearTarget(); vessel.scoreKeeper.AddCleaning(); ps.Play(); yield return(new WaitForSeconds(0.1f)); GetComponentInChildren <SpriteRenderer>().enabled = false; Destroy(gameObject, 2f); }