public static void MatchAndClear(GameTile[,] board) { clearedTiles = false; // Make a copy of the board to test CopyBoard(board, toTest); currentTile = null; collector.Clear(); for (int y = 0; y < BoardSize; y++) { for (int x = 0; x < BoardSize; x++) { TestTile(x, y); if (collector.Count >= 3) { foreach (GameTile tile in collector) { ClearTile(tile.Column, tile.Row); clearedTiles = true; Soundboard.PlayClear(); } } currentTile = null; collector.Clear(); } } if (clearedTiles) { timer = DisappearTimer; GameState.Mode = GameState.GameMode.Disappearing; } }
public ApplicationSprite() { var lobby = new FlashHeatZeeker.Lobby.ApplicationSprite(); lobby.AttachTo(this); var sb = new Soundboard(); this.InvokeWhenPromotionIsReady( delegate { lobby.StartClicked += delegate { if (lobby == null) { return; } sb.snd_click.play(); try { lobby.ytp.Loader.unloadAndStop(true); //lobby.ytp.pauseVideo(); } catch { } lobby.Orphanize(); lobby = null; new ApplicationSpriteContent().AttachTo(this); }; } ); }
void OnMouseDown() { if (PlayerController.Current.MagicPower < CastingCost) { return; } PlayerController.Current.MagicPower -= CastingCost; DestroyObject(gameObject); PlayerController.Current.CastAnimation(); Soundboard.PlayRockBreak(); Cloud c = (Cloud)Instantiate(PlayerController.Current.CloudPrefab); c.transform.position = this.transform.position; if (Contains == "Ruby") { Transform r = (Transform)Instantiate(PlayerController.Current.RubyPrefab); r.transform.position = this.transform.position; r.transform.parent = this.transform.parent; transform.parent.GetComponent <ObjectLayerFader>().ResetObjects = true; } else if (Contains == "Monster") { RockMonster r = (RockMonster)Instantiate(PlayerController.Current.MonsterPrefab); r.transform.position = this.transform.position; r.transform.parent = this.transform.parent; transform.parent.GetComponent <ObjectLayerFader>().ResetObjects = true; } }
// cannot define the interface inline can we.. public void Visualize(Func <IVisualizer> new_Visualizer) { // how many sounds we have? Soundboard sb = new Soundboard(); new[] { sb.loopmachinegun, sb.loophelicopter1, sb.loopdiesel2, sb.loopsand_run, sb.loopjeepengine, sb.loopcrickets, sb.loopstrange1, sb.loop_GallinagoDelicata, }.WithEachIndex( (s, index) => { var v = new_Visualizer(); v.SetMasterVolume = value => s.MasterVolume = double.Parse(value); // we did it for imp. v.SetLeftVolume = value => s.LeftVolume = double.Parse(value); v.SetRightVolume = value => s.RightVolume = double.Parse(value); s.MasterVolume = 0; s.Sound.play(); v.Initialize(new { index }.ToString()); } ); }
private void DoAttack() { // Check if player should attack if (cooldownShoot > 0) { return; // still on cooldown } if (!wantsToTarget) { return; // not targeting } if (!wantsToAttack) { return; // not shooting } if (target == null) { return; // no target } if (!CanSeeThing(target)) { return; // no target in range } HealthSystem targetHealth = target.GetComponent <HealthSystem>(); if (targetHealth) { targetHealth.TakeDamage(20); // Deal damage to target's health } cooldownShoot = 1 / roundsPerSecond; // Attack if (handL) { Instantiate(prefabMuzzleFlash, handL.position, handL.rotation); } if (handR) { Instantiate(prefabMuzzleFlash, handR.position, handR.rotation); } // Instantiate bullet on hands //Instantiate(bullet, handL.transform.position, Quaternion.identity); //Instantiate(bullet, handR.transform.position, Quaternion.identity); Instantiate(bullet, handL.transform.position, handL.transform.rotation); Instantiate(bullet, handR.transform.position, handR.transform.rotation); // Trigger arm animation armL.localEulerAngles += new Vector3(-20, 0, 0); // LArm recoil on shoot armR.localEulerAngles += new Vector3(-20, 0, 0); // RArm recoil on shoot armL.position += -armL.forward * .1f; // LArm pushback on shoot armR.position += -armR.forward * .1f; // RArm pushback on shoot camOrbit.Shake(.5f); // Shakes camera with an intensity of 1 Soundboard.PlayShoot(); }
void OnMouseUpAsButton() { if (GameState.Mode == GameState.GameMode.Playing) { Board.SwapBoards(); Soundboard.PlaySwap(); } }
void OnTriggerEnter2D(Collider2D collider) { if (collider.gameObject.layer == LayerManager.PlayerLayer) { Soundboard.PlayExitLevel(); MessageWindow.Current.DisplayFinalText(Message, NextLevel); } }
void OnMouseUpAsButton() { if (GameState.Mode == GameState.GameMode.Playing) { GameState.ResetGame(); Soundboard.PlaySwap(); } }
void Start(){ s = this; sources = new Dictionary<string, AudioSource>(); for(int i = 0; i < transform.childCount; i++){ AudioSource ass = transform.GetChild(i).GetComponent<AudioSource>(); sources.Add(ass.name, ass); } }
void OnTriggerEnter2D(Collider2D collider) { if (collider.tag == RubyTag) { Rubies += 1; DestroyObject(collider.gameObject); Soundboard.PlayRubyPickup(); } }
public SoundboardViewModel(Soundboard soundboard, IMessageBoxService msgBoxServ, IFileFolderDialogService fileFolderServ) { _messageBoxService = msgBoxServ; _fileDolderDialogService = fileFolderServ; _soundboard = soundboard; _fileFormatInspector = new FileFormatInspector(RecognizableFormats.GetAllFormats()); Initialize(); }
protected virtual void OnCollisionEnter2D(Collision2D collision) { if (collision.collider.gameObject.layer == LayerManager.PlayerLayer) { Soundboard.PlayGoodGuyDamage(); MessageWindow.Current.DisplayText("A bad guy defeated you!"); GameState.Current.SetStatus(ActionState.GameOver); } }
void OnMouseDown() { Board.ClickCaught = true; if (GameState.Mode == GameState.GameMode.Playing) { Board.FlipTile(this); Soundboard.PlayFlip(); GameState.ActionsTaken++; } }
void Start() { if (main == null) { main = this; player = GetComponent <AudioSource>(); // Gets a reference to the AudioSource } else { Destroy(this.gameObject); } }
void OnMouseDown() { if (GameState.Mode == GameState.GameMode.Playing && !ClickCaught) { mouseClick = Camera.main.ScreenToWorldPoint(Input.mousePosition); mouseX = (int)Mathf.Round((mouseClick.x + WorldOffset) / TileSize); mouseY = (int)Mathf.Round((mouseClick.y + WorldOffset) / TileSize); PutNextTile(mouseX, mouseY); Soundboard.PlayDrop(); GameState.ActionsTaken++; } }
private void ShootPlayer() { if (cooldownShoot > 0) { return; // still on cooldown } cooldownShoot = 1 / roundsPerSecond; Instantiate(prefabMuzzleFlash, barrel.position, barrel.rotation); Instantiate(laser, barrel.transform.position, barrel.transform.rotation); Soundboard.PlayLaser(); }
void OnCollisionEnter2D(Collision2D collision) { if (CurrentState == PlayerState.Transition) { return; } Debug.Log(collision.collider.tag); if ((CurrentState == PlayerState.Arrived || CurrentState == PlayerState.ArrivedAndSet) && !forcedTransition) { UnderworldObjectFader.SetActive(false, false); OverworldObjectFader.SetActive(false, true); CurrentState = PlayerState.Transition; TransitionTimer = TransitionTimerMax; Soundboard.PlayTransition(); anim.SetBool(AnimParam_Jump, true); transform.position = lastPosition; forcedTransition = true; } if (collision.collider.tag == MonsterTag) { if (DamageTimer <= 0) { MagicPower -= MagicDamage_Monster; Life -= LifeDamage_Monster; DamageTimer = DamageTimerMax; Soundboard.PlayHurt(); } if (!forcedTransition) { Pushback(); } } else if (collision.collider.tag == LavaTag) { if (DamageTimer <= 0) { MagicPower -= MagicDamage_Lava; Life -= LifeDamage_Lava; DamageTimer = DamageTimerMax; Soundboard.PlayHurt(); } if (!forcedTransition) { Pushback(); } } }
public void Destroy() { int x = p1.X + 1; int y = p1.Y + p1.Direction; if (this[x, y] == 61) { MinePoint temp = new MinePoint(x, y); Destroyed.Enqueue(temp); this[x, y] = 126; ++DestroyedNum; box[x, y].Image = Image.FromFile(Path.GetFullPath($"{this[x, y]}.png")); Soundboard.Bomb(); } }
protected virtual void DoHit(LightPower power) { if (power == LightPower.Damage) { DealDamage(LightDamage * Time.fixedDeltaTime); if (!soundWait) { StartCoroutine(WaitForSoundTick()); Soundboard.PlayBadGuyDamage(); } } else if (power == LightPower.Freeze) { isFrozen = true; } }
void OnMouseDown() { if (PlayerController.Current.MagicPower > CastingCost) { LavaFlow lf = (LavaFlow)Instantiate(PlayerController.Current.LavaFlowPrefab); //lf.transform.position = this.transform.position; tmp = Camera.main.ScreenToWorldPoint(Input.mousePosition); tmp.z = transform.position.z; lf.transform.position = tmp; PlayerController.Current.MagicPower -= CastingCost; Soundboard.PlayLava(); PlayerController.Current.CastAnimation(); } }
void Update() { if (GameState.CurrentState == GameState.GameMode.SpacePlaying) { isIdle = true; Angle += (RotateSpeed * -Input.GetAxis(HORIZONTAL_AXIS) * Time.deltaTime); Angle = Mathf.Repeat(Angle, 360); if (Angle != lastAngle) { isIdle = false; transform.localRotation = Quaternion.Euler(0, 0, Angle); for (int i = 0; i < spaceCams.Length; i++) { spaceCams[i].transform.localRotation = Quaternion.Euler(0, 0, -Angle); } } dashAmount = Input.GetAxis(VERTICAL_AXIS); if (dashAmount == 0) { flySpeed = FlySpeed; Flame.transform.localScale = new Vector3(2, 2, 0); Soundboard.ResetThrusters(); } else if (dashAmount < 0) { flySpeed = Mathf.Lerp(FlySpeed, SlowSpeed, -dashAmount); isIdle = true; Flame.transform.localScale = new Vector3(1, 1, 0); Soundboard.ResetThrusters(); } else if (dashAmount > 0) { flySpeed = Mathf.Lerp(FlySpeed, DashSpeed, dashAmount); isIdle = true; Flame.transform.localScale = new Vector3(3, 3, 0); Soundboard.PlayThrusters(Time.deltaTime, 0.1f); } GameState.UpdateDistance(transform.position.magnitude); GameState.SpendFuel((isIdle ? IdleFuelCost : FlyFuelCost) * Time.fixedDeltaTime); } }
void OnTriggerEnter2D(Collider2D collider) { // Player rescue if (collider.gameObject.layer == LayerManager.PlayerLayer) { Soundboard.PlayRescue(); MessageWindow.Current.DisplayText("You rescued an innocent bystander!"); DestroyObject(gameObject); } else if (collider.gameObject.layer == LayerManager.EnemyCollisionLayer) { Soundboard.PlayGoodGuyDamage(); MessageWindow.Current.DisplayText("A bad guy attacked an innocent bystander!"); GameState.Current.SetStatus(ActionState.GameOver); DestroyObject(gameObject); } }
public void WasShot() { if (Fuels > 0) { tmpV3 = transform.position; tmpV3.x += Random.Range(-ScatterX, ScatterX); tmpV3.y -= Random.Range(0.01f, ScatterY); FuelPickup.Spawn(System.Guid.NewGuid().ToString(), tmpV3); Fuels--; Soundboard.Play(AUDIO_MINE); if (Fuels == 0) { gameObject.SetActive(false); } } }
void DoHit(LightPower power) { if (GameState.CurrentActionState != ActionState.Playing) { return; } if (power != LightPower.BreakTerrain) { return; } Soundboard.PlayDestroy(); tmpPrefab = ParticlePrefabs[Random.Range(0, ParticlePrefabs.Length)]; Instantiate(tmpPrefab, ParticleSource.position, ParticleSource.rotation * tmpPrefab.rotation); DestroyObject(gameObject); }
public SoundboardViewModel GetSoundboardViewModel(string soundboardType, Soundboard soundboard, IMessageBoxService messageBoxService, IFileFolderDialogService fileFolderDialogService) { if (string.IsNullOrWhiteSpace(soundboardType)) { return(new SoundboardViewModel(soundboard, messageBoxService, fileFolderDialogService)); } string loweredType = soundboardType.ToLowerInvariant(); switch (loweredType) { case "keyboard": return(new SoundboardKeyboardViewModel(soundboard, messageBoxService, fileFolderDialogService)); default: return(new SoundboardViewModel(soundboard, messageBoxService, fileFolderDialogService)); } }
private void HandleShooting() { if (bulletTimerCurrent <= 0) { if (Input.GetButtonDown(FIRE_BUTTON)) { bulletTimerCurrent = BulletTimer; Bullet.Spawn(transform.position + new Vector3(_c.offset.x + (Facing.X * BulletOffset), _c.offset.y + (Facing.Y * BulletOffset) + 0.2f, 0), Facing.ToVector2(), BulletLifetime, BulletSpeed); GameState.SpendFuel(BulletCost); Soundboard.Play(AUDIO_SHOOT); } } else { bulletTimerCurrent -= Time.deltaTime; } }
public window() { InitializeComponent(); LoginPanel.Visible = true; loginTB.Enabled = true; passwordTB.Enabled = true; MainMenu.Visible = false; HelpPanel.Visible = false; GamePanel.Visible = false; SettingsPanel.Visible = false; Soundboard.Load(); Auth.Load(); Leaderboard.Load(LeaderboardPanel); playground = new Map(GamePanel, new Label[] { goldLabel, keysLabel, stepsLabel, pointsLabel }); GameSettings.Load(); TimeControl.Start(timeLabel); playground.Restart(); KeyLog.Load(this); }
private void HandleJumping() { if (isJumping) { // If we're already jumping, see if we need to continue isJumpingHitsCount = _c.OverlapCollider(isJumpingFilter, isJumpingHits); isForcedJumping = false; for (int i = 0; i < isJumpingHitsCount; i++) { if (isJumpingHits[0].gameObject.layer == LayerManager.Water) { isForcedJumping = true; break; } } if (!isForcedJumping) { isJumping = Input.GetButton(JUMP_BUTTON); } } else { isJumping = Input.GetButton(JUMP_BUTTON); } if (isJumping) { GameState.SpendFuel(JumpFuelCost * Time.deltaTime); } gameObject.layer = isJumping ? LayerManager.PlayerJumping : LayerManager.Player; if (isJumping) { Soundboard.PlayThrusters(Time.deltaTime, 0.25f); } else { Soundboard.ResetThrusters(); } }
void Update() { if (GameState.Mode == GameState.GameMode.Falling && Row != LastRow) { targetY = (Row * Board.TileSize) - Board.WorldOffset; tmpPos = _t.position; tmpPos.y -= FallSpeed * Time.deltaTime; if (tmpPos.y <= targetY) { Board.fallingBlocks.Remove(this); UpdatePosition(); Soundboard.PlayDrop(); } else { _t.position = tmpPos; } } }
private void OnTriggerEnter(Collider other) // On Overlap { PlayerMovement player = other.GetComponent <PlayerMovement>(); HealthSystem playerHealth = player.GetComponent <HealthSystem>(); //HealthSystem enemyHealth = enemy.GetComponent<HealthSystem>(); // if overlapping a player object if (player) { // if player has health if (playerHealth) { playerHealth.TakeDamage(5); Soundboard.PlayDamage(); } Destroy(gameObject); // remove projectile after overlap } }
void Update() { if (CurrentState == PlayerState.OnLevel) { // Switch levels if (Input.GetButtonUp("Jump") && CastTimer <= 0) { if (MagicPower > CastingCost_Transfer) { UnderworldObjectFader.SetActive(false, false); OverworldObjectFader.SetActive(false, true); CurrentState = PlayerState.Transition; Soundboard.PlayTransition(); TransitionTimer = TransitionTimerMax; MagicPower -= CastingCost_Transfer; anim.SetBool(AnimParam_Jump, true); } } } }
void Start () { instance = this; }