public void CheckForPassing(object sender, EventArgs eventArgs) { int mappyX = (int)(this.Level as DynamicLevel).Mappy.Position.X; int pipeX = (int)(int)((this.Position.X + (this.Width * this.Scale) / 2)); if (mappyX > pipeX) { Console.WriteLine("Pass Pipe"); SoundHandler.PlaySoundEffect((this.Level as DynamicLevel).L1SoundHandler.Pipe); this.Level.Score++; if (sender is SpriteMappy) { (sender as SpriteMappy).OnMove -= this.CheckForPassing; (sender as SpriteMappy).Velocity = new Vector2((sender as SpriteMappy).Velocity.X + 0.1f, (sender as SpriteMappy).Velocity.Y); SpritePipe.Speed += 0.03f; foreach (Sprite sprite in (this.Level as DynamicLevel).CollisionLayer.Sprites) { if (sprite is SpritePipe) { sprite.velocity = new Vector2(0, SpritePipe.Speed); } } } } }
public SoundHandler PlayMusic(AudioClipWithVolume clip, bool loop = true, float pitch = 1f, bool ignoreListenerPause = false, float delay = 0f) { if (clip == null) { return(null); } if (clip.Clip == null) { return(null); } if (MusicHandler != null) { Debug.Log(clip.VolumeModifier); MusicHandler.Source.clip = clip.Clip; //MusicHandler.Volume = clip.VolumeModifier; MusicHandler.Source.volume = clip.VolumeModifier; MusicHandler.IsLooped = loop; MusicHandler.Pitch = pitch; MusicHandler.Source.Play(); return(MusicHandler); } var handler = Play(clip, loop, pitch, true, delay); DontDestroyOnLoad(handler.Source.gameObject); MusicHandler = handler; return(handler); }
public override void Death() //NEEDS FIX !!!TODO!!! Fix particles for parts { IsActive = false; SoundHandler.PlaySoundEffect((int)IDs.PLAYERDEATHSOUND); base.Death(); Hull.Color = Color.Transparent; }
// Use this for initialization void Start() { GetComponent <Rigidbody2D>().AddTorque(-540); deleteList = new HashSet <GameObject> (); deleteJewels = GameObject.Find("Level Controller").GetComponent <RockLevelDeleteJewels> (); instantiator = GameObject.Find("Level Controller").GetComponent <RockLevelInstantiator> (); fourInARow = GameObject.Find("Level Controller").GetComponent <RockLevelFourInARow> (); scoreKeeper = GameObject.Find("Level Controller").GetComponent <RockLevelScoreKeeper> (); jewelToDestroy = instantiator.GetJewelGridGameObject(targetJewelRow, targetJewelCol); controller = GameObject.Find("Level Controller").GetComponent <RockLevelController> (); audioSources = GameObject.Find("SoundHandler").GetComponents <AudioSource>(); soundHandler = GameObject.Find("Game Manager").GetComponent <SoundHandler> (); swapJewel = GameObject.Find("Level Controller").GetComponent <RockLevelSwapJewel> (); if (tag != "End Star") { instantiatedCrosshairs = (GameObject)Instantiate(crosshairs, new Vector3(-2.45f + (targetJewelCol * .6125f), 2.591252f - (targetJewelRow * .6097268f), -90), Quaternion.identity); targetPosition = instantiatedCrosshairs.transform.position; } else { targetPosition = new Vector3(-2.45f + (targetJewelCol * .6125f), 2.591252f - (targetJewelRow * .6097268f), -90); } timeStamp = Time.time; cooldown1 = .25f; cooldown2 = .15f; if (transform.position.y > -.5) { oppositeY = Random.Range(4f, 4.5f); } else { oppositeY = Random.Range(-4f, -4.65f); } oppositeX = Random.Range(-2.5f, 2.5f); }
void Awake() { devmode = false; ctrl = GetComponent <CharacterController>(); tran = GetComponent <Transform>(); snd = GetComponent <AudioSource>(); locked = false; needtomove = false; if (player) { anims.SetBool("move", false); cam_help = cam_single; cam1 = cam1_single; cam2 = cam2_single; cam_snd = cam1.GetComponent <AudioSource>(); cam_snd.clip = SoundHandler.GetMus(GameMus.Main); cam_snd.Play(); } else { //Editor always re-enabled it //Needs to be disabled, otherwise an enemy can somehow move the helicopter and it will trigger ctrl.enabled = false; snd.clip = SoundHandler.GetSnd(GameSnd.Helicopter); } }
void Awake() { AudioClip clip = SoundHandler.GetMus(music); audio.PlayOneShot(clip); StartCoroutine(StartLevel(clip.length)); }
// Use this for initialization void Start() { cooldown = .1f; childStarCount = 0; GetChildStar(); instantiator = GameObject.Find("Level Controller").GetComponent <RockLevelInstantiator> (); GetComponent <Rigidbody2D>().AddTorque(540); deleteJewels = GameObject.Find("Level Controller").GetComponent <RockLevelDeleteJewels> (); touchHandler = GameObject.Find("Level Controller").GetComponent <RockLevelTouchHandler> (); fiveInARow = GameObject.Find("Level Controller").GetComponent <RockLevelFiveInARow> (); powerPercentageController = GameObject.Find("Level Controller").GetComponent <PowerPercentageController> (); soundHandler = GameObject.Find("Game Manager").GetComponent <SoundHandler> (); bombHandler = GameObject.Find("Level Controller").GetComponent <RockLevelBombHandler> (); if (GameObject.Find("Mountain Level Two ID") != null) { tutorialLevel = true; } tutorialNumber = 0; jewelList = new List <GameObject> (); jewelPicked = false; // targetX = Random.Range (-2f, 2f); // targetY = 4.5f; targetX = transform.position.x; targetY = transform.position.y; childStarArray = new List <GameObject> (); }
private void EnemyShoots() { // projectile cooldown _cooldownTimeLeft -= Time.deltaTime; if (!(_cooldownTimeLeft <= 0)) { return; } _cooldownTimeLeft = 60 / enemyRoundsPerMinute; // projectile spread var projectileSpread = new System.Random().Next(-enemySpread, enemySpread); // projectile rotation var rotation = transform.rotation; var z = rotation.eulerAngles.z + projectileSpread; var projectileRotation = Quaternion.Euler(0, 0, z); var offset = rotation * new Vector3(0, -0.2f, 0); SoundHandler.PlayShotSound(); var enemyProjectile = Instantiate(projectile, transform.GetChild(0).position - offset, projectileRotation); enemyProjectile.layer = 14; }
void FixedUpdate() { Collider[] cols = Physics.OverlapSphere(tran.position, 2.0f); foreach (Collider col in cols) { if ((1 << col.gameObject.layer & check_layer) > 0) { IntObjBase tmp = col.GetComponent <IntObjBase>(); if (tmp != null) { tmp.Damage(); } if (explosive) { Instantiate(GameControl.inst.expl_part, tran.position, tran.rotation); ExplosiveDamage(col); } if (sound != GameSnd.None) { SoundScript.CreateSound(tran, SoundHandler.GetSnd(sound)); } Destroy(gameObject); return; } } }
// Use this for initialization void Start() { horizontalCoefficient = .8f; if (GameObject.Find("Pause Button(Clone)") != null) { targetXPosition = GameObject.Find("Pause Button(Clone)").transform.position.x - .2f - (horizontalCoefficient * 3); } else { targetXPosition = GameObject.Find("Play Button(Clone)").transform.position.x - .2f - (horizontalCoefficient * 3); } buttonHandler = GameObject.Find("Button Handler").GetComponent <ButtonHandler> (); if (!pressedQuitInstantiated && GameObject.Find("Quit Button(Clone)") != null && (GameObject.Find("Level Controller").GetComponent <RockLevelBombHandler> ().GetBombCount() == 0 || (GameObject.Find("Jewel Collector") != null && GameObject.Find("Jewel Collector").GetComponent <JewelCollectorController> ().GetJewelCollectorsFinshedCollecting())) && gameObject.name == "Quit Button(Clone)") { GameObject qb = GameObject.Find("Quit Button(Clone)"); starsLaunching = true; tempPressedQuitButton = (GameObject)Instantiate(pressedQuitButton, new Vector3(qb.transform.position.x, qb.transform.position.y, qb.transform.position.z - .001f), Quaternion.identity); tempPressedQuitButton.transform.parent = transform; pressedQuitInstantiated = true; } soundHandler = GameObject.Find("Game Manager").GetComponent <SoundHandler> (); }
public GameClass(bool startFullScreen, Size size, bool enableNetwork) { this.startFullscreen = startFullScreen; this.Size = size; this.networkEnabled = enableNetwork; this.Text = "SpaceWar3D-Step12"; statusMessageTimer = Constants.StatusMessageDisplayTime; drawingFont = new GraphicsFont( "Verdana", System.Drawing.FontStyle.Regular); input = new InputClass(this); mouseInput = new MouseInput(this); this.MouseMove +=new MouseEventHandler(GameClass_MouseMove); this.Cursor = Cursors.NoMove2D; camera = new Camera(); soundHandler = new SoundHandler(this); if (networkEnabled) { peer = new PlayClass(this); if (peer.IsHost) { hullColor = HullColors.Red; } } }
static void StartStand(HordeStand stand) { ActiveStand = stand; if (IsPlaying) { if (!string.IsNullOrWhiteSpace(stand.SFXStart)) { SoundHandler.PlaySound3D(new SoundDefinition(stand.SFXStart), stand.Position, 2500, 1.0f); } if (!string.IsNullOrWhiteSpace(stand.SFXStart)) { StandSFXLoop = SoundHandler.PlaySound3D(new SoundDefinition(stand.SFXLoop), stand.Position, 2500, 0.5f, true); } if (stand.Messages != null && stand.Messages.Length > 0) { messageIndex = 0; NextMessage(); if (stand.Messages.Length > 1 && stand.Duration > 0) { messageTimer.SetInterval(stand.Duration * TimeSpan.TicksPerSecond / (stand.Messages.Length - 1)); messageTimer.Start(); } } } }
protected static void DoVictoryStuff(bool win, string winText = "SIEG!", string lossText = "NIEDERLAGE!") { if (VictoryVis == null) { const int boxWidth = 260; const int boxHeight = 45; const int boxOffset = 100; var ssize = GUCView.GetScreenSize(); var vis = new GUCVisual((ssize.X - boxWidth) / 2, boxOffset, boxWidth, boxHeight); vis.Font = GUCView.Fonts.Menu; vis.SetBackTexture("menu_choice_back.tga"); var txt = vis.CreateTextCenterX("", 7); txt.Show(); VictoryVis = vis; } if (win) { VictoryVis.Texts[0].Text = winText; SoundHandler.PlaySound(VictoryWin); } else { VictoryVis.Texts[0].Text = lossText; SoundHandler.PlaySound(VictoryLoss); } VictoryVis.Show(); }
// Use this for initialization void Start() { soundHandler = GameObject.Find("Game Manager").GetComponent <SoundHandler> (); jewel1 = null; jewel2 = null; startSwap = false; swapJewelsBack = false; instantiator = gameObject.GetComponent <RockLevelInstantiator> (); checkForMatches = gameObject.GetComponent <RockLevelCheckForMatches> (); bombHandler = gameObject.GetComponent <RockLevelBombHandler> (); stoppedMoving = gameObject.GetComponent <RockLevelMovementChecker> (); deleteJewels = gameObject.GetComponent <RockLevelDeleteJewels> (); touchHandler = gameObject.GetComponent <RockLevelTouchHandler> (); timeBombLevel = (GameObject.Find("Time Bomb Identification") != null); translationMultiplier = .35f; distanceToTarget = .01f; firstSwapPerformed = false; if (GameObject.Find("Mountain Level Two ID") != null) { tutorialLevel2 = true; } if (GameObject.Find("Jewel Collection Level ID") != null) { jewelCollectorLevel = true; moveNumberHandler = GameObject.Find("Jewel Collector").GetComponent <MoveNumberHandler> (); } }
// Use this for initialization void Start() { touchHandler = GameObject.Find("Level Controller").GetComponent <RockLevelTouchHandler> (); buttonHandler = GameObject.Find("Button Handler").GetComponent <ButtonHandler> (); touchOn = true; soundHandler = GameObject.Find("Game Manager").GetComponent <SoundHandler> (); }
// Use this for initialization void Start() { levelController = GameObject.Find("Level Controller").GetComponent <RockLevelController> (); transitionShadeController = GameObject.Find("Transition Shade").GetComponent <TransitionShadeController> (); cooldown = 3; soundHandler = GameObject.Find("Game Manager").GetComponent <SoundHandler> (); }
// Use this for initialization void Start() { leaveHome = true; coinNumberCount = 0; touchOn = true; soundHandler = GameObject.Find("Game Manager").GetComponent <SoundHandler> (); }
// Use this for initialization void Start() { StartCoroutine("FindTargetsWithDelay", .2f); idleTarget = transform.position; animator = GetComponent <Animator>(); soundHandler = GetComponent <SoundHandler>(); }
/// <summary> /// Create an alive object /// </summary> /// <param name="team">the team of the game object</param> /// <param name="coords">the position of the game object</param> /// <param name="drawable">the image to draw</param> /// <param name="soundHandler">the song container</param> /// <param name="life">the life of the imageObject</param> public AliveObject(Team team, Vector2D coords, Drawable drawable, SoundHandler soundHandler, int life) : base(team, coords, drawable) { Coords -= new Vector2D(ImageDimentions.X / 2, 0); SoundHandler = GameException.RequireNonNull(soundHandler); Life = (int)GameException.RequirePositive(life); }
public void Update(GameTime gameTime, EventOperator handler) { menues[CurrentMenu].UpdateUnlocks(handler); int selection = -1; for (int i = 0; i < MenuConstants.MENUITEMS[CurrentMenu].Length; i++) { Vector2 measuredString = menues[CurrentMenu].Font.MeasureString(MenuConstants.MENUITEMS[CurrentMenu][i]); Point indexPosition = new Point((int)(menues[CurrentMenu].Position.X), (int)(menues[CurrentMenu].Position.Y + i * measuredString.Y)); //Might be inprecise for a large number of menuitems DUNNO Point origin = new Point((int)measuredString.X / 2, (int)measuredString.Y / 2); Rectangle boundBox = new Rectangle((int)menues[CurrentMenu].Position.X - origin.X, indexPosition.Y - origin.Y, (int)measuredString.X, (int)measuredString.Y); if (boundBox.Contains(InputHandler.mPosition)) { selection = i; } } selectedIndex = selection; if (InputHandler.isJustPressed(MouseButton.LEFT)) { if (selection != -1) { SoundHandler.PlaySoundEffect((int)IDs.MENUCLICK); } int changedMenu = menues[CurrentMenu].HandleSelection(CurrentMenu, selectedIndex, handler); if (changedMenu >= 0) { selectedIndex = 0; CurrentMenu = changedMenu; } } }
// Use this for initialization void Start() { soundHandler = GameObject.Find("Game Manager").GetComponent <SoundHandler> (); GameObject.Find("Game Manager").GetComponent <GameManagerScript> ().SetFirstMoveMade(false); cooldown = 1; timeStamp = Time.time; }
void Endstand() { if (ActiveStand == null) { return; } if (StandSFXLoop != null) { SoundHandler.StopSound(StandSFXLoop); } var stand = ActiveStand; if (HordeMode.IsActive) { if (!string.IsNullOrWhiteSpace(stand.SFXStop)) { var def = new SoundDefinition(stand.SFXStop); if (stand.GlobalSFX) { SoundHandler.PlaySound(def, 1.0f); } else { SoundHandler.PlaySound3D(def, stand.Position, 5000 + stand.Range, 1.0f); } } } ActiveStand = null; messageTimer.Stop(); }
private void Start() { levelManager = GameManager.Instance.levelManager; environment = GameManager.Instance.levelManager.environnement; environnement = levelManager.environnement; soundHandler = GameManager.Instance.soundHandler; levelManager.submarineEntitiesInScene.Add(this); levelManager.enemyEntitiesInScene.Add(this); _transform = transform; coords.position = Coordinates.ConvertWorldToVector2(_transform.position); currentSeaLevel = SeaLevel.submarine; PickRandomInterrestPoint(); ship = Object.FindObjectOfType <Ship>(); subZoneAngleWidth12 = 360 / subZone12Subdivision; subZoneAngleWidth3 = 360 / (subZone12Subdivision * subZone3SubSubdivision); for (int i = 0; i < levelManager.submarineEntitiesInScene.Count; i++) { if (levelManager.submarineEntitiesInScene[i].GetType() != typeof(Submarine)) { bioElements.Add(levelManager.submarineEntitiesInScene[i].transform); } } }
public SoundHandler PlayMusic(global::Utils.Sound.Sound sound) { if (sound == null) { return(null); } if (sound.Clip == null) { return(null); } if (MusicHandler != null) { MusicHandler.Source.clip = sound.Clip; //MusicHandler.Volume = clip.VolumeModifier; MusicHandler.Source.volume = sound.VolumeModifier; MusicHandler.IsLooped = sound.Loop; MusicHandler.Pitch = sound.Pitch; MusicHandler.Source.Play(); MusicHandler.MixerGroup = sound.MixerGroup; return(MusicHandler); } var handler = Play(sound); DontDestroyOnLoad(handler.Source.gameObject); MusicHandler = handler; return(handler); }
void Start() { sounds.Clear(); sounds.Add("wood", chop); sounds.Add("rock", mine); sounds.Add("kill", kill); sounds.Add("equip", equip); sounds.Add("dequip", dequip); sounds.Add("gameBGM", gameBGM); sounds.Add("menuBGM", menuBGM); if (Application.loadedLevelName.Equals("MainMenu")) { SoundHandler.PlaySound("menuBGM", true, true); } if (Application.loadedLevelName.Equals("Options")) { SoundHandler.PlaySound("menuBGM", true, true); } if (Application.loadedLevelName.Equals("Game")) { SoundHandler.PlaySound("gameBGM", true, true); } if (Application.loadedLevelName.Equals("GameOver")) { SoundHandler.PlaySound("menuBGM", true, true); } }
public GameClass(bool startFullScreen, Size size, bool enableNetwork) { this.startFullscreen = startFullScreen; this.Size = size; this.networkEnabled = enableNetwork; this.Text = "SpaceWar3D-Step11"; statusMessageTimer = Constants.StatusMessageDisplayTime; drawingFont = new GraphicsFont("Verdana", System.Drawing.FontStyle.Regular); input = new InputClass(this); mouseInput = new MouseInput(this); this.MouseMove += new MouseEventHandler(GameClass_MouseMove); this.Cursor = Cursors.NoMove2D; camera = new Camera(); soundHandler = new SoundHandler(this); if (networkEnabled) { peer = new PlayClass(this); if (peer.IsHost) { hullColor = HullColors.Red; } } }
static bool doDrawItemSound = true; //improveme void PlayDrawItemSound(ItemInst item, bool undraw) { if (!doDrawItemSound) { return; } SoundDefinition sound; switch (item.Definition.Material) { case ItemMaterials.Metal: sound = undraw ? sfx_UndrawMetal : sfx_DrawMetal; break; case ItemMaterials.Wood: sound = undraw ? sfx_UndrawWood : sfx_DrawWood; break; default: sound = sfx_DrawGeneric; break; } SoundHandler.PlaySound3D(sound, this.BaseInst); }
public Missile Initialize() { _animator = transform.parent.GetComponent <Animator>(); _soundHandler = GameInitializer.GetSoundHandler(); _soundHandler.PlaySound(SoundHandler.Sounds.MISSILEHIT); return(this); }
/// <summary> /// Create an alive object /// </summary> /// <param name="team">the team of the game object</param> /// <param name="coords">the position of the game object</param> /// <param name="drawable">the image to draw</param> /// <param name="soundHandler">the song container</param> /// <param name="life">the life of the imageObject</param> /// <param name="speed">move speed in pixels</param> /// <param name="speedDecalage">move acceleration in pixels when the direction changes</param> public MovingObject(Team team, Vector2D coords, Drawable drawable, SoundHandler soundHandler, int life, double speed, double speedDecalage) : base(team, coords, drawable, soundHandler, life) { Speed = GameException.RequirePositive(speed); SpeedDecalage = GameException.RequirePositive(speedDecalage); }
// Use this for initialization void Start() { bombHandler = GameObject.Find("Level Controller").GetComponent <RockLevelBombHandler> (); touchHandler = GameObject.Find("Level Controller").GetComponent <RockLevelTouchHandler> (); movementChecker = GameObject.Find("Level Controller").GetComponent <RockLevelMovementChecker> (); soundHandler = GameObject.Find("Game Manager").GetComponent <SoundHandler> (); instantiator = GameObject.Find("Level Controller").GetComponent <RockLevelInstantiator> (); // timeCountdown1 = GameObject.Find ("Time Countdown 1"); // spriteRenderer1 = timeCountdown1.GetComponent<SpriteRenderer> (); // // timeCountdown2 = GameObject.Find ("Time Countdown 2"); // spriteRenderer2 = timeCountdown2.GetComponent<SpriteRenderer> (); // // timeCountdown3 = GameObject.Find ("Time Countdown 3"); // spriteRenderer3 = timeCountdown3.GetComponent<SpriteRenderer> (); // // timeBombScreenList = new List<GameObject> (); // timeScreenRenderers = GameObject.Find ("Time Bomb Level Screen").GetComponentsInChildren<SpriteRenderer> (); // alphaIncrease = .03f; // increaseAlpha = true; // cooldown = 1; // timeStamp = Time.time; // playSound = true; timeStamp = Time.time; cooldown = 1; }
void PlaySound(SoundDefinition snd) { if (sndEnabled) { SoundHandler.PlaySound(snd, 1.5f); } }
public NetworkedAgent(System.Net.IPEndPoint endpoint, SoundHandler handler) { #if DEBUG this.receiver = new UDPReceiver(new System.Net.IPEndPoint(IPAddress.Loopback, 45001)); // localhost on port 45001 #else this.receiver = new UDPReceiver(endpoint); #endif this.receiver.onMessageRecieved += this.playerUpdateReceived; this.ship = new SpriteObjects.Ship(handler, 0, 0); }
public SelectShipScreen(int screenHeight, int screenWidth, Type gameType, SoundHandler handler, int numOfPlayers) : base(screenHeight, screenWidth) { if (gameType.BaseType != typeof(BaseGame) && gameType.BaseType.BaseType != typeof(BaseGame)) { throw new ArgumentException("Awww shit N***a What the f**k u playing at gaim type aint a base game"); } this.gameType = gameType; settingsWindow = new ShipSettings(screenWidth, screenWidth, handler, numOfPlayers); settingsWindow.okClicked += new EventHandler<EventArgs>(settingsWindow_okClicked); }
public MenuScreen(int ScreenWidth, int ScreenHeight, SoundHandler player, GraphicsDeviceManager dMan, Microsoft.Xna.Framework.Content.ContentManager cm) { currentMenuScreen = new MainMenu(ScreenWidth, ScreenHeight, player); currentMenuScreen.gameSelected += gameSelectedHandler; this.dMan = dMan; this.cm = cm; this.mPlayer = player; this.mScreenHeight = ScreenHeight; this.mScreenWidth = ScreenWidth; }
public MainMenu(int ScreenWidth, int ScreenHeight, SoundHandler player, SpriteObjects.Ship selectedShip) : base(ScreenWidth, ScreenHeight) { this.mPlayer = player; this.mScreenWidth = ScreenWidth; Title = "Gravitation"; createBackground(ref mBackground, 0.5f, 0.5f); this.mShip = selectedShip; this.createMenuButtons(); this.detailedSelectionContainer = new MenuL2Selection(); }
public GameClass(bool startFullScreen, Size size, bool enableNetwork) { this.startFullscreen = startFullScreen; this.Size = size; this.networkEnabled = enableNetwork; this.Text = "SpaceWar3D-Step06"; drawingFont = new GraphicsFont( "Verdana", System.Drawing.FontStyle.Regular); input = new InputClass(this); mouseInput = new MouseInput(this); this.MouseMove +=new MouseEventHandler(GameClass_MouseMove); camera = new Camera(); soundHandler = new SoundHandler(this); if (networkEnabled) { peer = new PlayClass(this); } }
public Ship(SoundHandler player, float power, float sheildStrength) { this.world = null; this.mPosition = new Vector2(100f, 100f); this.mPlayer = player; this.damage = (int)power; // need to change this this.sheilds = this.sheilds - (10*(int)sheildStrength); // and this too Vector2 y = new Vector2(0,0); for (int x = 0; x < numberOfRayCasts; x++) { raycastHitList.Add(false); raycastPointList.Add(y); raycastStartPointList.Add(y); raycastEndPointList.Add(y); raycastNormalList.Add(y); rayCastLengths.Add(BASE_SHIP_RAYCAST_LENGTH); } }
public void setPlayer(SoundHandler player) { this.mPlayer = player; }