void Start() { introText = GetComponent <Text>(); StartCoroutine(playIntro()); SoundMan = GameObject.FindGameObjectWithTag("SoundEffectManager").GetComponent <SoundEffectManager>(); }
/// <summary> /// Adds quick revive heart to lives. /// Plays quick revive sound. /// Precondition: none /// Post-condition: QuickReviveHeart.Sprite = Visible /// PlayerAbilities.HasQuickRevive = true /// </summary> public override void Activate() { base.Activate(); PlayerStats.Lives.MoveQuickReviveHeart(); PlayerAbilities.HasQuickRevive = true; SoundEffectManager.PlaySound(SoundEffectType.QuickRevive); }
protected override void ConsumeItem() { if (!GameManager.instance.CanFireEvent(false)) { return; } List <Skill> skills = SkillManager.instance.Skills; TeleportCanvas.instance.SetButtons("Choose Skill", skills.Select(x => x.skillName).ToList(), (index) => { if (!GameManager.instance.CanFireEvent(true)) { return; } Skill skill = skills[index]; float xpToGive = skill.GetNextLevelRelativeXPRequirement() * 0.5f; SkillManager.instance.AddXpToSkill(skill.skillType, xpToGive); MessageBox.AddMessage("You smash the gem into the ground and it provides " + xpToGive.ToString("0.#") + " xp in " + skill.skillName); EntityManager.instance.PlayerInventory.RemoveItem(base.ID, 1); SoundEffectManager.Play(AudioClipAsset.UseGem, AudioMixerGroup.SFX); } ); TeleportCanvas.instance.Open(); }
public override void MoveToTile(Tile tile) { GameManager.Instance.IsPlayersTurn = false; GameManager.Instance.IsSelectingTile = false; HighlightTiles(); CurrentTile.Player = null; base.MoveToTile(tile); if (CurrentTile.Player == null) { CurrentTile.Player = this; } else { CurrentTile.Player.Count += Count; if (CurrentTile.IsGoal) { SoundEffectManager.PlayGoalClip(); GameManager.Instance.PlayerSafe += Count; } MustRemove = true; } }
private void DrawFreezeLockIfRequired(SpriteBatch spriteBatch) { if ((PlayerMotionEngine.SpeedChangesAreLockedOut) && (!_displayingLock)) { Scale = 0.0f; AnimationEngine.Sequence = AnimationDataManager.Sequences["image-popup-entry-with-bounce"]; SoundEffectManager.PlayEffect("freeze-speedo"); _displayingLock = true; } else if ((!PlayerMotionEngine.SpeedChangesAreLockedOut) && (_displayingLock)) { _displayingLock = false; AnimationEngine.Sequence = AnimationDataManager.Sequences["exit-with-bounce"]; } spriteBatch.Draw( TextureManager.Textures["speedo-snowflake"], CenterPosition + _centerOffset, null, Color.White, Rotation, new Vector2(TextureManager.Textures["speedo-snowflake"].Bounds.Width, TextureManager.Textures["speedo-snowflake"].Bounds.Height) / 2.0f, Scale, SpriteEffects.None, 0.4f); }
/// <summary> /// Initializes the framework. /// Should be called once and only once. /// </summary> /// <param name="owner">application's main window.</param> /// <param name="bgmMenuItem">"BGM" sub-menu</param> /// <param name="progressHandler"> /// <param name="args"></param> /// <param name="constructionMode"></param> /// Receives initializtion progress report. Can be null. /// </param> public static void Init(string[] args, Control owner, MenuItem bgmMenuItem, ProgressHandler progressHandler, bool constructionMode) { isConstructionMode = constructionMode; if (progressHandler == null) { progressHandler = new ProgressHandler(silentProgressHandler); } if (owner != null) { soundEffectManager = new SoundEffectManager(owner); } if (args == null) { PluginManager.Init(getDefaultProfile(), progressHandler, new DefaultPluginErrorHandler(5)); } else { // load plug-ins PluginManager.Init( args.Length == 0 ? getDefaultProfile() : parseProfile(args[0]), progressHandler, new DefaultPluginErrorHandler(5)); } //if (bgmMenuItem != null) _bgmManager = new BGMManager(bgmMenuItem); bgmManager = new BGMManager(); }
private void AnnounceResults() { switch (Outcome) { case Definitions.RaceOutcome.OwnPlayerWin: _avatar.AnimationEngine.Sequence = AnimationDataManager.Sequences["player-front-win"]; SoundEffectManager.PlayEffect("race-winner"); _glowBurst.Visible = true; if (LivesAwarded) { _displayLivesAward = true; } break; case Definitions.RaceOutcome.OpponentPlayerWin: _avatar.AnimationEngine.Sequence = AnimationDataManager.Sequences["player-front-lose"]; SoundEffectManager.PlayEffect("race-loser"); break; case Definitions.RaceOutcome.Incomplete: _avatar.AnimationEngine.Sequence = AnimationDataManager.Sequences["player-front-lose"]; SoundEffectManager.PlayEffect("race-loser"); break; } _outcomePopup.Activate(); }
public void Miss() { enabled = false; renderer.enabled = false; processed = true; if (connector) { var renderer = connector.GetComponent <SpriteRenderer>(); var color = renderer.color; color.a /= 2; renderer.color = color; if ((int)type >= 2) { renderer.enabled = false; } else { connector.getSecondJoint().GetComponent <note>().Miss(); connector.SetFirstJoint(transform.parent); } } EffectShower.Get().Miss(transform); SoundEffectManager.Get().PlayHitSound(); checker.Next(); }
private void Start() { btnClose.onClick.Add(new EventDelegate(() => { SoundEffectManager.effectSoundAction(); this.gameObject.SetActive(false); ui_MyInfo.gameObject.SetActive(true); ui_MyInfo.Open(); })); SetHero(hero_id); btnNext.onClick.Add(new EventDelegate(() => { SoundEffectManager.effectSoundAction(); if (hero_id < 5) { hero_id += 1; } else if (hero_id == 5) { hero_id = 1; } SetHero(hero_id); })); btnPrev.onClick.Add(new EventDelegate(() => { SoundEffectManager.effectSoundAction(); if (hero_id > 1) { hero_id -= 1; } else if (hero_id == 1) { hero_id = 5; } SetHero(hero_id); })); }
protected virtual void CheckForAndHandleSelection(Input.InputProcessorBase inputSource) { bool selectionMade = inputSource.SelectionTriggered; if ((selectionMade) && (inputSource.SelectionLocation != Vector2.Zero)) { selectionMade = CheckForSelectionAtTouchLocation(inputSource.SelectionLocation); } if (inputSource.BButtonPressed) { selectionMade = true; _activeButtonCaption = _cancelButtonCaption; } if (selectionMade) { ActuatingController = inputSource; Dismiss(); if (SelectionCallback != null) { SelectionCallback(_activeButtonCaption); } if (!string.IsNullOrEmpty(ActivateSelectionSoundEffectName)) { SoundEffectManager.PlayEffect(ActivateSelectionSoundEffectName); } } }
public void FrontScene() { SoundEffect = GameObject.Find("SoundEffectManager(Clone)").GetComponent <SoundEffectManager>(); string sceneName = Scene_Name(); Debug.Log(sceneName); if (sceneName == "StartScene") { SceneManager.LoadScene(2); } else if (sceneName == "RuleScene1") { SceneManager.LoadScene(3); } else if (sceneName == "RuleScene2") { SceneManager.LoadScene(4); } else if (sceneName == "RuleScene3") { SceneManager.LoadScene(5); } else if (sceneName == "RuleScene4") { SceneManager.LoadScene(6); } else if (sceneName == "RuleScene5") { SceneManager.LoadScene(0); } SoundEffect.TurnPageVoice(); }
private void SetBtnSelectComm() { btnPrevCommander.onClick.Add(new EventDelegate(() => { SoundEffectManager.effectSoundAction(); this.presentCommander_id -= 1; if (presentCommander_id < 1) { presentCommander_id = 5; } Debug.Log($"presentCommander_id:{presentCommander_id}"); OnSetCommObjCallback(presentCommander_id); })); btnNextCommander.onClick.Add(new EventDelegate(() => { SoundEffectManager.effectSoundAction(); this.presentCommander_id += 1; if (presentCommander_id > 5) { presentCommander_id = 1; } Debug.Log($"presentCommander_id:{presentCommander_id}"); OnSetCommObjCallback(presentCommander_id); })); }
protected override void CheckForAndHandleInputFromSingleSource(InputProcessorBase inputSource, int millisecondsSinceLastUpdate) { if (!Rotating) { if ((!_carouselDisabled) && (inputSource.MoveLeft)) { _targetRotation += _rotationStep; Rotating = true; } else if ((!_carouselDisabled) && (inputSource.MoveRight)) { _targetRotation -= _rotationStep; Rotating = true; } if (Rotating) { SoundEffectManager.PlayEffect("carousel-spin"); } } if (!Rotating) { CheckMasterSelectActivation(inputSource); CheckForButtonAction(inputSource.BButtonPressed, BButtonPressedValue); CheckForButtonAction(inputSource.XButtonPressed, XButtonPressedValue); CheckForButtonAction(inputSource.YButtonPressed, YButtonPressedValue); } }
private void StartDeathSequence() { DisableAllMovement(); IsDead = true; LifeCycleState = Leda.Core.LifeCycleStateValue.Exiting; SoundEffectManager.PlayEffect("player-death"); }
void Start() { gameController = FindObjectOfType <GameController>(); soundEffects = FindObjectOfType <SoundEffectManager>(); this.transform.GetChild(0).gameObject.SetActive(false); dataController = FindObjectOfType <DataController>(); }
protected override void ConsumeItem() { if (!GameManager.instance.CanFireEvent(true)) { return; } float overallHealAmount = EntityManager.instance.PlayerCharacter.Health.MaxHealth * 0.4f; float modified = overallHealAmount + (overallHealAmount * TalentManager.instance.GetTalentModifier(TalentType.BigGulp)); EntityManager.instance.PlayerCharacter.Health.HealOverTime(modified, 1, 30); MessageBox.AddMessage(string.Format("The effects of the {0} wears off", Name), MessageBox.Type.Warning, 30); MessageBox.AddMessage(string.Format("You eat the {0}. It's begins to heal you over time.", Name)); SoundEffectManager.Play(EntityManager.instance.eatSoundEffects.GetRandom(), AudioMixerGroup.SFX); if (UnityEngine.Random.value < TalentManager.instance.GetTalentModifier(TalentType.Resourceful)) { MessageBox.AddMessage("Your " + TalentManager.instance.GetTalent(TalentType.Resourceful).talentData.talentName + " talent saves the Nitro Bits from being consumed."); } else { EntityManager.instance.PlayerInventory.RemoveItem(base.ID, 1); } }
private void Start() { SoundEffectManager effectManager = FindObjectOfType <SoundEffectManager>(); sprayFull = effectManager.GetSoundEffect(GeneralVariables.SFX.SPRAY_FULL); sprayEmpty = effectManager.GetSoundEffect(GeneralVariables.SFX.SPRAY_EMPTY); }
static Assets() { Texture2D = new Texture2DManager(); SpriteFont = new SpriteFontManager(); SoundEffect = new SoundEffectManager(); Song = new SongManager(); }
void Start () { manager = GameObject.FindGameObjectWithTag("Manager").GetComponent<GameManager>(); PartM = manager.PM; SFX = manager.SFX; projectileFolder = manager.ProjectilesFolder; currentHealth = InitialHealth; }
public void HandleCollision() { HandleScore(); if (enemy is Boo) { HandlePacMarioCollision(); } else if (!MarioDeadState() && !mario.IsStarMario() && enemy is GreenKoopa && ((GreenKoopa)enemy).IsHit) { WeaponizedKoopa(); } else if (!MarioDeadState() && !mario.IsStarMario() && side is TopSideCollision && !enemy.IsFlipped) { MarioEnemyTopSide(); } else if (!MarioDeadState() && !mario.IsStarMario() && !mario.IsHurt() && enemy.CanDealDamage && !(enemy is Boo)) { collision.ResolveOverlap(mario, side); if (mario.IsBigMario()) { SoundEffectManager.ShrinkingOrPipeEffect(); } mario.Damage(); } else if (mario.IsStarMario()) { enemy.CanDealDamage = false; enemy.Flipped(); } }
/// <summary> /// Moves to the specified movingDirection and calls moveComplete method when the gameObject arrives /// at the destination. /// </summary> /// <param name="movingDirection">Moving direction (relative to the gameobject's rotation).</param> /// <param name="moveComplete">Method to be called when moving is finished.</param> public void Move(FourDirections movingDirection, MovementCallback moveComplete) { if (!moving) { this.moveComplete = moveComplete; startPosition = transform.position; Vector3 globalMovingDirection = GetGlobalMovingDirection(movingDirection); // Check for obstacles int obstacles = LayerMask.GetMask(new string[] { "Obstacle" }); if (Physics.Raycast(startPosition, globalMovingDirection, GridMovement.tileSize, obstacles)) { // If there's an obstacle in front of the player bump forward and then back a little bit. endPosition = startPosition + globalMovingDirection * GridMovement.tileSize * 0.2f; BlockedMoveForward(); SoundEffectManager.playSoundEffectOnce("WalkAgainstObstacle"); } else { // Otherwis just move to the next tile. endPosition = startPosition + globalMovingDirection * GridMovement.tileSize; MoveToNextTile(); } moving = true; } }
private void HandleFlagCollision(Flag collider) { if (IsHorizontallyCloseEnoughForEffect(collider, Flag_Effect_Distance)) { bool colliderIsNotLastRestartPointPassed = (LastRaceRestartPointTouched != collider); LastRaceRestartPointTouched = collider; if (Data.Profile.PlayingRaceMode) { if (IsMovingLeft != collider.ActivatedWhenMovingLeft) { SoundEffectManager.PlayEffect("turn-round"); ChangeHorizontalMovementDirection(); LastEvent = PlayerEvent.Restart_Point_Changed_Direction;; } else if ((colliderIsNotLastRestartPointPassed) && (!(collider is GoalFlag))) { LastEvent = PlayerEvent.Restart_Point_Touched; } } if (collider is GoalFlag) { _hasTouchedGoalFlag = true; } } }
private void AddEventsInGameButtons() { btnInGameSetting.onClick.Add(new EventDelegate(() => { SoundEffectManager.effectSoundAction(); //this.uiPopup_InGameSetting.gameObject.SetActive(true); //this.uiPopup_InGameSetting.Init(); if (this.uiPopup_InGameSetting != null) { this.uiPopup_InGameSetting.Open(); } else { //var prefab = (GameObject)(from obj in App.instance.resource // where obj.name == "UIPopup_InGameSetting" // select obj).FirstOrDefault(); var prefab = Resources.Load <GameObject>("Prefab/UI/UIPopup_InGameSetting"); this.uiPopup_InGameSetting = Instantiate <GameObject>(prefab).GetComponent <UIPopup_InGameSetting>(); this.uiPopup_InGameSetting.transform.SetParent(this.uiRoot.transform); this.uiPopup_InGameSetting.transform.localScale = Vector3.one; this.uiPopup_InGameSetting.transform.localPosition = Vector3.zero; this.uiPopup_InGameSetting.CheckMusic(); this.uiPopup_InGameSetting.Init(); } })); }
protected override void HandlePlayerEvent() { switch (_player.LastEvent) { case Player.PlayerEvent.Died: ResetPowerUpDisplayFollowingPlayerDeath(); break; case Player.PlayerEvent.Restart_Point_Touched: SoundEffectManager.PlayEffect("race-checkpoint"); _opaqueParticleEffectManager.LaunchFlagStars(_player.LastRaceRestartPointTouched); _progressCoordinator.CheckAndUpdateRestartPoint(); break; case Player.PlayerEvent.Restart_Point_Changed_Direction: _raceEventPopup.StartPopupForRaceInfo("popup-race-wrong-way"); break; case Player.PlayerEvent.Goal_Passed: _progressCoordinator.CheckAndUpdateRestartPoint(); HandleLapCompleted(); break; } base.HandlePlayerEvent(); }
public void HandleCollision() { HandleBooAI(); HandleScore(); if (!enemy.IsFlipped) { collision.ResolveOverlap(enemy, side); } if (side is LeftSideCollision) { enemy.ShiftDirection(); if (enemy is GreenKoopa && ((GreenKoopa)enemy).IsWeaponized) { SoundEffectManager.EnemyFlippedEffect(); enemy.Physics.Velocity = new Vector2(-enemy.Physics.Velocity.X, enemy.Physics.Velocity.Y); } } else if (side is RightSideCollision) { enemy.ShiftDirection(); if (enemy is GreenKoopa && ((GreenKoopa)enemy).IsWeaponized) { SoundEffectManager.EnemyFlippedEffect(); enemy.Physics.Velocity = new Vector2(-enemy.Physics.Velocity.X, enemy.Physics.Velocity.Y); } } else if (side is TopSideCollision && ((Block)block).IsBumped) { enemy.CanDealDamage = false; enemy.Flipped(); } }
public void DisplayEquipmentStatus() { var itemData = DataManager.GetInstance().dicItemData; var itemInfo = DataManager.GetInstance().dicItemInfo; if (selectedItem_id != 0) { SoundEffectManager.effectSoundAction(); var item_id = (from item in itemData where item.Value.id == selectedItem_id select item.Value.id).First(); SetIcon(iconSelectedItem, itemData[item_id].icon_name); SetLabel(lbSelectedDmg, itemData[item_id].damage, lbSelectedAspd, itemData[item_id].atkSpeed); var type = itemData[item_id].type; var arrIds = (from item in itemInfo where item.Value.isEquipped == true select item.Value.id).ToArray(); Debug.Log($"Selected:{selectedItem_id}"); //Debug.Log($"wearing arrIds:{arrIds[0]}, {arrIds[1]}"); var wearingItem_id = (from id in arrIds where itemData[id].type == type select id).First(); Debug.Log($"wearingItem_id: {wearingItem_id}"); this.wearingItem_id = wearingItem_id; SetIcon(iconWearingItem, itemData[wearingItem_id].icon_name); SetLabel(lbWearingDmg, itemData[wearingItem_id].damage, lbWearingAspd, itemData[wearingItem_id].atkSpeed); } }
public void Start() { if (Instance == null) { Instance = this; } }
public GameState(Camera camera, int gridSize, ContentManager content) { mGridSize = gridSize; mCamera = camera; UnitsByPlayer = new Dictionary <Players, List <IUnit> >(); SpatialUnitsByPlayer = new SpatialStructuredUnits(mGridSize); BuildingsByPlayer = new Dictionary <Players, List <IUnit> >(); HeroesByPlayer = new Dictionary <Players, Hero>(); UnitsByModel = new Dictionary <ModelManager.Model, List <IUnit> >(); Resources = new Dictionary <Players, Dictionary <Resources, int> >(); VillagePos = new Dictionary <Players, Vector2>(); VillagesByPlayer = new Dictionary <Players, Village>(); mMap = new TileStates[0, 0]; mPathZones = new PathFindingZones(0, 0, mGridSize); IsPaused = true; mCollision = new CollisionHandler(gridSize, UnitsByPlayer, IsObstructed); mEnemy = new DummyKi(); HeroRespawnManager = new HeroRespawnManager(); mDamageFactor = new Dictionary <Players, float>(); foreach (var player in PlayerConstants.sPlayers) { mDamageFactor.Add(player, 1f); } mBlockedSound = new SoundEffectManager(content, "sounds/Logo_miss"); mStatistics = new Statistics(content, null, null); StatisticsByPlayer = new Dictionary <Players, Dictionary <string, int> >(); InitStatisticsByPlayer(Players.Player); InitStatisticsByPlayer(Players.Ai); mPathFinderInstances = new ThreadLocal <PathFinder>(() => new PathFinder(IsObstructed, gridSize)); mContent = content; }
public static void Init(SoundEffectManager soundEffectManager, MusicManager musicManager) { Debug.Assert(sSoundEffectManager == null); Debug.Assert(sMusicManager == null); sSoundEffectManager = soundEffectManager; sMusicManager = musicManager; }
private void Awake() { //------------------------------------------------------ //Erstelle eine Instanz falls nicht vorhanden //------------------------------------------------------ if (Instance == null) { Instance = this; } //------------------------------------------------------ //Oder lösche falls diese Instanz nicht die Instanz ist //------------------------------------------------------ else if (Instance != this) { Destroy(this); } //------------------------------------------------------ //Füge eine Standartsource hinzu //------------------------------------------------------ m_MustnPlay = SoundUtilities.AddSourceToObject(gameObject, false, 1.0f, false); //------------------------------------------------------ //Starte Cleanup Routine //------------------------------------------------------ StartCoroutine(CleanUp()); }
private void SetListeners() { EventTrigger.Entry enter = new EventTrigger.Entry(); enter.eventID = EventTriggerType.PointerEnter; enter.callback.AddListener((baseEventData) => { if (Input.GetMouseButton(0) || Input.GetMouseButton(1) || Input.GetMouseButton(2)) { return; } SoundEffectManager.Play(AudioClipAsset.UIButtonHover, AudioMixerGroup.UI); }); EventTrigger.Entry exit = new EventTrigger.Entry(); exit.eventID = EventTriggerType.PointerExit; exit.callback.AddListener((baseEventData) => { if (Input.GetMouseButton(0) || Input.GetMouseButton(1) || Input.GetMouseButton(2)) { return; } SoundEffectManager.Play(AudioClipAsset.UIButtonHoverExit, AudioMixerGroup.UI); }); EventTrigger.Entry click = new EventTrigger.Entry(); click.eventID = EventTriggerType.PointerClick; click.callback.AddListener((baseEventData) => { SoundEffectManager.Play(AudioClipAsset.UIButtonClick, AudioMixerGroup.UI); }); eventTrigger.triggers.Add(enter); eventTrigger.triggers.Add(exit); eventTrigger.triggers.Add(click); }
void Awake() { if( Instance == null ){ Instance = this; }else{ Destroy(this); } }
void Start () { manager = GameObject.FindGameObjectWithTag("Manager").GetComponent<GameManager>(); SFX = manager.SFX; PM = manager.PM; lane = manager.obtainLane(transform); floordistance = manager.obtainDistanceBetweenLanes(); distanceBetweenLanes = manager.obtainDistanceBetweenLanes(); projectileFolder = manager.ProjectilesFolder; }
private void Awake() { _effects = new Dictionary<string, AudioClip>(); foreach (AudioClip clip in Effects) { _effects.Add(clip.name, clip); } _voices = new List<AudioSource>(); for (int i = 0; i < VoiceCount; i++) { _voices.Add(gameObject.AddComponent<AudioSource>()); } _instance = this; }
void Start () { manager = GameObject.FindGameObjectWithTag("Manager").GetComponent<GameManager>(); SFX = manager.SFX; originalDamage = Damage; originalSpeed = speed; originalMaterial = renderer.material; if (direction == movementDirection.left) directionOfProjectile = -1; else directionOfProjectile = 1; }
void Start () { manager = GameObject.FindGameObjectWithTag("Manager").GetComponent<GameManager>(); SFX = manager.SFX; weapon.manager = manager; currentHealth = initialHealth; }
void Start () { manager = GameObject.FindGameObjectWithTag("Manager").GetComponent<GameManager>(); SFX = manager.SFX; originalColor = renderer.color; currentHealth = initialHealth; }
void setOtherScripts() { direction = Random.Range(0, 2) * 2 - 1; manager = GameObject.FindGameObjectWithTag("Manager").GetComponent<GameManager>(); manager.SendMessage("addEnemyInLevel"); PartM = manager.PM; SFX = manager.SFX; projectileFolder = manager.ProjectilesFolder; }
/// <summary> /// The main game constructor. /// </summary> public GameStateManagementGame() { Application.Current.UnhandledException += (s, e) => { if (!System.Diagnostics.Debugger.IsAttached) { try { LittleWatson.ReportException(e.ExceptionObject, GetType().Assembly.FullName); } catch { // We do not want to throw exceptions in our exception handler } } }; LittleWatson.CheckForPreviousException(); Content.RootDirectory = "Content"; //// test if any issues with different language settings //System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); //System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("pl-PL"); //Set up save system GlobalSave.Initialize(); Config.Initialize(); Config.loadSavedData(); Instance = this; graphics = new GraphicsDeviceManager(this); graphics.IsFullScreen = true; TargetElapsedTime = TimeSpan.FromTicks(333333); // you can choose whether you want a landscape or portait // game by using one of the two helper functions. InitializeLandscapeGraphics(); // InitializeLandscapeGraphics(); // Create the screen factory and add it to the Services screenFactory = new ScreenFactory(); Services.AddService(typeof(IScreenFactory), screenFactory); // Create the screen manager component. screenManager = new ScreenManager(this, graphics); Components.Add(screenManager); //// Load and display FPS counter //dgcFPS FPSComponent = new dgcFPS(this, @"Fonts\Tahoma14"); //this.Components.Add(FPSComponent); // Create our music manager component and add it to the game. musicManager = new MusicManager(this); musicManager.PromptGameHasControl += MusicManagerPromptGameHasControl; musicManager.PlaybackFailed += MusicManagerPlaybackFailed; Components.Add(musicManager); soundManager = new SoundEffectManager(this); Components.Add(soundManager); this.Components.Add(new AccelerometerInput(this)); if (Config.ControlOption == 3) AccelerometerInput.Instance.Enabled = true; else AccelerometerInput.Instance.Enabled = false; //////////// IsFixedTimeStep = true; //////////// //FPSComponent.ShowFPS = false; //#if DEBUG // Guide.SimulateTrialMode = true; //#endif soundManager.LoadSound("Shot", @"SoundEffects\Shot2"); //Instance.soundManager.LoadSound("coin", @"SoundEffects\coin"); //Instance.soundManager.LoadSound("ShipSpawn", @"SoundEffects\ShipSpawn"); Instance.soundManager.LoadSound("ShipExplode", @"SoundEffects\Explosions\explodeice3"); //Instance.soundManager.LoadSound("HardKick", @"SoundEffects\Explosions\HardKick"); //Instance.soundManager.LoadSound("Kick1", @"SoundEffects\Explosions\Kick1"); //Instance.soundManager.LoadSound("Kick2", @"SoundEffects\Explosions\Kick2"); //Instance.soundManager.LoadSound("Kick3", @"SoundEffects\Explosions\Kick3"); //Instance.soundManager.LoadSound("Kick4", @"SoundEffects\Explosions\Kick4"); //Instance.soundManager.LoadSound("Kick5", @"SoundEffects\Explosions\Kick5"); //Instance.soundManager.LoadSound("Kick6", @"SoundEffects\Explosions\Kick6"); //Instance.soundManager.LoadSound("hat10", @"SoundEffects\Powerup\hat10"); //Instance.soundManager.LoadSound("hat2", @"SoundEffects\Powerup\hat2"); Instance.soundManager.LoadSound("FX1", @"SoundEffects\Powerup\FX1"); //Instance.soundManager.LoadSound("Coin", @"SoundEffects\Powerup\item_pickup"); #if WINDOWS_PHONE // Hook events on the PhoneApplicationService so we're notified of the application's life cycle Microsoft.Phone.Shell.PhoneApplicationService.Current.Launching += new EventHandler<Microsoft.Phone.Shell.LaunchingEventArgs>(GameLaunching); Microsoft.Phone.Shell.PhoneApplicationService.Current.Activated += new EventHandler<Microsoft.Phone.Shell.ActivatedEventArgs>(GameActivated); Microsoft.Phone.Shell.PhoneApplicationService.Current.Deactivated += new EventHandler<Microsoft.Phone.Shell.DeactivatedEventArgs>(GameDeactivated); #else // On Windows and Xbox we just add the initial screens AddInitialScreens(); #endif }
/// <summary> /// Initialize script state. /// </summary> internal void Start() { this.soundEffectManager = FindObjectOfType<SoundEffectManager>(); }
void Start() { manager = GameObject.FindGameObjectWithTag("Manager").GetComponent<GameManager>(); PM = manager.PM; SFX = manager.SFX; }
/* /// <summary> /// This structure defines our teams. /// TODO: This could be configurable in a menu, or extended to include more/fewer teams with more/fewer players. /// </summary> private Dictionary<int, List<PlayerId>> teamToPlayers = new Dictionary<int, List<PlayerId>> { { 0, new List<PlayerId> { PlayerId.One, PlayerId.Two } }, { 1, new List<PlayerId> { PlayerId.Three, PlayerId.Four } } }; /// <summary> /// This structure gives us the team a given player is on. /// </summary> private Dictionary<PlayerId, int> playerToTeam; */ /// <summary> /// Initialize script state. /// </summary> internal void Start() { this.cachedSoundEffects = GameObject.FindObjectOfType<SoundEffectManager>(); //Test persistance of Globals.cs from menu scene //Debug.Log("Globals instance = " + Globals.Instance.Objective[PlayerId.One] + Globals.Instance.Objective[PlayerId.Two]); // initialize score structure this.scores = new Dictionary<int, Dictionary<ScoreType, int>>(); for (int teamNumber = 0; teamNumber < Globals.Instance.ManageTeam.NumberOfTeams; teamNumber++) { this.scores.Add(teamNumber, new Dictionary<ScoreType, int>()); foreach (ScoreType scoreType in Enum.GetValues(typeof(ScoreType))) { this.scores[teamNumber].Add(scoreType, 0); } } /* // initialize player score structure this.playerScores = new Dictionary<PlayerId, Dictionary<ScoreType, int>>(); foreach (PlayerId playerId in Enum.GetValues(typeof(PlayerId))) { this.playerScores.Add(playerId, new Dictionary<ScoreType, int>()); foreach (ScoreType scoreType in Enum.GetValues(typeof(ScoreType))) { if (scoreType != ScoreType.None) { this.playerScores[playerId].Add(scoreType, 0); } } } // initialize reverse lookup team lookup, playerToTeam this.playerToTeam = new Dictionary<PlayerId, int>(); for (int teamNumber = 0; teamNumber < this.teamToPlayers.Count; teamNumber++) { foreach (var playerId in this.teamToPlayers[teamNumber]) { this.playerToTeam.Add(playerId, teamNumber); } }*/ // enable only relevant scoreboards for (int teamNumber = 0; teamNumber < this.scoreboards.Count; teamNumber++) { this.scoreboards[teamNumber].gameObject.SetActive(teamNumber < Globals.Instance.ManageTeam.NumberOfTeams); } //this.StartCoroutine(this.WaitAndInvoke(1f, () => this.StartCountdown())); this.InvokeRepeating("Countdown", 1f, 1f); }