public override void Use(S_Player player, int dx, int dy) { if ((dx == 0) == (dy == 0)) { UnsuccessfulUse(); return; } int index = 0; foreach (S_Tile tile in player.currentTile.GetTilesInLine(dx, dy)) { S_Pickup pickup = tile.content; if (pickup != null) { index++; pickup.Magnetise(tile.TileDistance(player.currentTile) + index, (int)player.transform.position.x - S_Tile.width / 2, (int)player.transform.position.y - S_Tile.height / 2); } } if (index > 0) { SuccessfulUse(); Sounds.PlaySound(Sounds.suck); } else { UnsuccessfulUse(); } }
internal void AddPickup() { GameObject pickup = (GameObject)(Instantiate(Resources.Load("prefabs/pickup"))); content = pickup.GetComponent <S_Pickup>(); pickup.name = "pickup"; S_Camera.SetupScale(pickup.transform); pickup.transform.position = transform.position; pickup.transform.parent = transform; }
internal void Pickup(S_Pickup pickup) { pickupsRemaining--; GameObject.Destroy(pickup.gameObject); int pickedUp = totalPickups - pickupsRemaining; float pitch = Mathf.Pow(1.07946f, (pickedUp) / (float)totalPickups) + Random.Range(0f, pickedUp / 10f); Sounds.PlaySound(Sounds.pip, 1, pitch); /*if (totalPickups > Sounds.nicePitches.Length) { * Sounds.PlaySound(Sounds.pip, .9f, Mathf.Pow(1.05946f, ((float)(totalPickups - pickupsRemaining-1) / (Mathf.Max(1,totalPickups - 1))) * 12)); * } * else { * Sounds.PlaySound(Sounds.pip, .9f, Mathf.Pow(1.05946f, Sounds.nicePitches[totalPickups - 1][totalPickups - pickupsRemaining - 1])); * }*/ if (pickupsRemaining == 0) { Game.Get().Victory(); } }
internal void AddPickup() { GameObject pickup = (GameObject)(Instantiate(Resources.Load("prefabs/pickup"))); content = pickup.GetComponent<S_Pickup>(); pickup.name = "pickup"; S_Camera.SetupScale(pickup.transform); pickup.transform.position = transform.position; pickup.transform.parent = transform; }