void OnVesselSituationChange(GameEvents.HostedFromToAction<Vessel, Vessel.Situations> change) { //Debug.Log("[KSP Interstellar] OnVesselSituationChange is called with situation " + change.from.ToString() + " to " + change.to.ToString() + " on vessel " + change.host.name); bool shouldReinitialise = false; if (change.from == Vessel.Situations.DOCKED) { //Debug.Log("[KSP Interstellar] GameEventSubscriber - OnVesselSituationChange situation changed from Docked"); shouldReinitialise = true; } if (change.to == Vessel.Situations.DOCKED) { //Debug.Log("[KSP Interstellar] GameEventSubscriber - OnVesselSituationChange situation changed to Docked"); shouldReinitialise = true; } if (shouldReinitialise) { Debug.Log("[KSP Interstellar] GameEventSubscriber - OnVesselSituationChange reinitialising"); var generators = change.host.FindPartModulesImplementing<FNGenerator>(); generators.ForEach(g => g.OnStart(PartModule.StartState.Docked)); var radiators = change.host.FindPartModulesImplementing<FNRadiator>(); radiators.ForEach(g => g.OnStart(PartModule.StartState.Docked)); } //Debug.Log("[KSP Interstellar] GameEventSubscriber - OnVesselSituationChange is finished"); }
public void receiveEvent(GameEvents.GameEvent e) { if(e.GetType().Name.Equals("UpdateHud")) { updateHud(); } }
public void receiveEvent(GameEvents.GameEvent e) { if(e.GetType().Name.Equals("PassGateEvent")) { PassGate(); } }
void OnVesselSituationChange(GameEvents.HostedFromToAction<Vessel, Vessel.Situations> change) { bool shouldReinitialise = false; if (change.from == Vessel.Situations.DOCKED) shouldReinitialise = true; if (change.to == Vessel.Situations.DOCKED) shouldReinitialise = true; if (shouldReinitialise) { ORSHelper.removeVesselFromCache(change.host); Debug.Log("[KSP Interstellar] GameEventSubscriber - OnVesselSituationChange reinitialising"); var generators = change.host.FindPartModulesImplementing<FNGenerator>(); generators.ForEach(g => g.OnStart(PartModule.StartState.Docked)); var radiators = change.host.FindPartModulesImplementing<FNRadiator>(); radiators.ForEach(g => g.OnStart(PartModule.StartState.Docked)); } }
public void receiveEvent(GameEvents.GameEvent e) { if(e.GetType().Name.Equals("CelebrateEvent")) { confetti.Play(); } }
private void OnGameSceneSwitchRequested(GameEvents.FromToAction<GameScenes,GameScenes> e) { if(e.from!=GameScenes.MAINMENU && e.to==GameScenes.MAINMENU) { configuration.Save(); } }
public void onCrewBoardVessel(GameEvents.FromToAction<Part, Part> data) { this.FromPartToPartHelper( this.getStringBuilder(), data ); }
public void receiveEvent(GameEvents.GameEvent e) { if(e.GetType().Name.Equals("CelebrateEvent")) { GetComponent<BalloonFaceAnim>().Celebrate(); } }
public void receiveEvent(GameEvents.GameEvent e) { if(e.GetType().Name.Equals("BackgroundScrollEvent")) { amountToMoveX += ((BackgroundScrollEvent) e).MoveX; amountToMoveY += ((BackgroundScrollEvent) e).MoveY; } }
private void onPartCoupled(GameEvents.FromToAction<Part, Part> data) { if (data.from == part) { ghostConnectionFrom = part.parent; ghostConnectionTo = data.to.parent; } }
public void onEvaStart(GameEvents.FromToAction<Part, Part> data) { double fuel = data.from.RequestResource("MonoPropellant", 5); if (fuel < 5) { data.to.RequestResource("EVA Propellant", 5 - fuel); } }
private void OnRenameVessel(GameEvents.HostedFromToAction<Vessel, string> data) { UnityEngine.Debug.Log("SmartRename: " + part.name); if( vessel.id == data.host.id && data.from == initialName) { UnityEngine.Debug.Log($"[{nameof(ShipSections)}] [{nameof(SmartRename)}] Updating initial vessel name to {data.to}"); initialName = data.to; } }
public void receiveEvent(GameEvents.GameEvent e) { if(e.GetType().Name.Equals("InputEvent")) { InputEvent inputEvent = (InputEvent) e; GetInput(inputEvent.GetDevice()); } }
public void receiveEvent(GameEvents.GameEvent e) { string gateExistScreenEventName = "GateExitScreenEvent"; if(e.GetType().Name.Equals(gateExistScreenEventName)) { AddGateToPool(((GateExitScreenEvent) e).GetGate()); } }
protected void OnVesselSituationChange(GameEvents.HostedFromToAction<Vessel, Vessel.Situations> hfta) { if (hfta.to == Vessel.Situations.SUB_ORBITAL || hfta.to == Vessel.Situations.ORBITING || hfta.to == Vessel.Situations.ESCAPING) { SetState(ParameterState.Complete); } }
public void receiveEvent(GameEvents.GameEvent e) { if(e.GetType().Name.Equals("DamagePlayer")) { int damage = ((DamagePlayer) e).getDamageValue(); bool doKnockback = !(tookDamage || invunerable) && ((DamagePlayer) e).bounceAfterTakingDamage(); doDamage(damage); if(doKnockback) { GameObject damager = ((DamagePlayer) e).getDamager(); if(damager.tag.Equals("Enemy")) { Vector2 direction = new Vector2(transform.position.x - damager.transform.position.x, transform.position.y - damager.transform.position.y); rigidbody2D.AddForce(direction * bounceForce); } else { Vector2 direction = rigidbody2D.velocity.normalized * -1;; rigidbody2D.AddForce(direction * bounceForce); } } } else if(e.GetType().Name.Equals("EnterRoom")) { bool isFirstTime = ((EnterRoom) e).isFirstTime(); if(isFirstTime) { gainShieldCharge(); } } else if(e.GetType().Name.Equals("CollectPower")) { shipSounds.playPowerup(); int type = ((CollectPower) e).getPowerupType(); if(type == 1) { gainShield(); } else if(type == 2) { gainDamage(); } else if(type == 3) { gainRateofFire(); } else if(type == 4) { has5Shot = true; } } }
public void receiveEvent(GameEvents.GameEvent e) { if(e.GetType().Name.Equals("InputEvent")) { InputEvent inputEvent = (InputEvent) e; if(inputEvent.GetPlayerNumber() == playerNumber) { GetInput(inputEvent.GetDevice()); } } }
public void receiveEvent(GameEvents.GameEvent e) { if(e.GetType().Name.Equals("Restart")) { Application.LoadLevel(2); } if(e.GetType().Name.Equals("Win")) { Invoke ("TriggerWin", 3f); } }
public void OnCrewEVA(GameEvents.FromToAction<Part, Part> action) { if (action.to.Modules["KerbalEVA"] != null) { CollisionFX cfx = action.to.AddModule("CollisionFX") as CollisionFX; cfx.scrapeSparks = _scrapeSparks; cfx.collisionSound = _collisionSound; cfx.scrapeSound = _scrapeSound; cfx.sparkSound = _sparkSound; } }
/// <summary> /// Adds magnetic boots to a Kerbal who just EVA'ed. /// </summary> /// <param name="action">Vessel/crew part where the Kerbal EVA'ed from and the Kerbal himself</param> public void AddMagneticBoots(GameEvents.FromToAction<Part,Part> action) { if (action.to.Modules["KerbalEVA"] != null) { if (!action.to.Modules.Contains("MagneticBootsModules")) { action.to.AddModule("MagneticBootsModule"); Debug.Log("MagneticBoots added"); } } }
/// <summary> /// Removes magnetic boots from a Kerbal who is in the process of boarding a crew part. /// </summary> /// <param name="action">Kerbal who is boarding and the crew part which he wants to board</param> private void RemoveMagneticBoots(GameEvents.FromToAction<Part, Part> action) { if (action.from.Modules["KerbalEVA"] != null) { if (action.from.Modules.Contains("MagneticBootsModules")) { action.from.RemoveModule(action.from.Modules["MagneticBootsModule"]); Debug.Log("MagneticBoots removed"); } } }
public void receiveEvent(GameEvents.GameEvent e) { if(e.GetType().Name.Equals("EnterRoom")) { target = ((EnterRoom) e).getNewRoom(); } if(e.GetType ().Name.Equals("CameraShake")) { jiggleAmt = ((CameraShake) e).getAmount(); StartCoroutine(jiggleCam2(((CameraShake) e).getDuration())); } }
private void HandlePartAttach(GameEvents.HostTargetAction<Part, Part> data) { var parts = GetPartList(data.host); var modules = parts.Where(p => p.Modules.Contains(ModuleName)).Select(p => p.Modules[ModuleName] as USI_Converter).ToList(); foreach (var module in modules) { module.ID = Guid.NewGuid(); } lock (_moduleListLock) { foreach (var module in modules.Where(module => !ListContainsModule(module))) { _moduleList.Add(new USI_ConverterModuleWrapper(module)); } } }
void OnVesselSituationChange(GameEvents.HostedFromToAction<Vessel, Vessel.Situations> vs) { if (vs.host.DiscoveryInfo.Level != DiscoveryLevels.Owned) { return; } /*if (vs.from == Vessel.Situations.FLYING) { if (vs.to == Vessel.Situations.SUB_ORBITAL) { record = (double)vs.host.mainBody.maxAtmosphereAltitude; Complete(); OnStow(); Terminate(); } }*/ }
private void OnVesselSituationChanged(GameEvents.HostedFromToAction<Vessel, Vessel.Situations> data) { //fix landed to splashed on fluids if (data.to == Vessel.Situations.LANDED) { //if a part with water contact exists, force splashed situation foreach (Part part in data.host.Parts) { if (part.WaterContact) { Debug.Log("found part with water contact in LANDED situation, changing situation to SPLASHED"); data.host.situation = Vessel.Situations.SPLASHED; data.host.Splashed = true; return; } } }//endif }//end onsituation
// ==================================================================== // Game Event Hooks // ==================================================================== /// <summary> /// Set the Sort Bar position and enable it on Launch Window spawn. (Callback) /// </summary> /// <param name="blah">?</param> protected void LaunchScreenSpawn(GameEvents.VesselSpawnInfo blah) { try { Transform tab_crewavail = availableCrew.transform.parent.Find("tab_crewavail"); BTButton tab = tab_crewavail.GetComponent<BTButton>(); // Set position: Vector3 tabPos = Utilities.GetPosition(tab_crewavail); float x = tabPos.x + tab.width + 5; float y = tabPos.y - 1; sortBar.SetPos(x, y); sortBar.enabled = true; launchScreenUp = true; } catch( Exception e ) { Debug.LogError("KerbalSorter: Unexpected error in LaunchWindowHook: " + e); } }
private void HandlePartRemove(GameEvents.HostTargetAction<Part, Part> data) { var parts = GetPartList(data.target); var modules = parts.Where(p => p.Modules.Contains(ModuleName)).Select(p => p.Modules[ModuleName] as USI_Converter).ToList(); lock (_moduleListLock) { foreach (var module in modules.Where(ListContainsModule)) { foreach (var moduleWrapper in _moduleList) { if (moduleWrapper.Module != null && moduleWrapper.Module.ID == module.ID) { _moduleList.Remove(moduleWrapper); break; } } } } }
private void OnDock(GameEvents.FromToAction<Part, Part> action) { if (this.Root.ContractState == Contract.State.Active) { if (HighLogic.LoadedSceneIsFlight) { if (FlightGlobals.ready) { foreach (ModuleAsteroid asteroid in action.from.vessel.FindPartModulesImplementing<ModuleAsteroid>()) { if (asteroid.vessel.DiscoveryInfo.Level.ToString() != "Owned") { //This is a new asteroid. Keep track of any new asteroids in a list. if (asteroid.vessel.DiscoveryInfo.size.Value == asteroidClass) { addAsteroid(asteroid.seed); ScreenMessages.PostScreenMessage("This asteroid fits " + this.Root.Agent.Name + "'s requirements.", 5.0f, ScreenMessageStyle.UPPER_LEFT); } else ScreenMessages.PostScreenMessage("This asteroid is not the size that " + this.Root.Agent.Name + " requested.", 5.0f, ScreenMessageStyle.UPPER_LEFT); } else { bool isNew = false; foreach (int savedSeed in asteroidSeeds) { if (asteroid.seed == savedSeed) isNew = true; } if (!isNew) ScreenMessages.PostScreenMessage(this.Root.Agent.Name + " notes that this is not a newly discovered asteroid.", 5.0f, ScreenMessageStyle.UPPER_LEFT); else ScreenMessages.PostScreenMessage("This asteroid fits " + this.Root.Agent.Name + "'s requirements.", 5.0f, ScreenMessageStyle.UPPER_LEFT); } } } } } }
public void DeadBall() { ActiveInning.Stats(ActivePlayer).DeadBalls++; GameEvents.Push(GameEvent.DeadBall); }
// Start is called before the first frame update void Start() { GameEvents.InvokeDialogInitiated(_startingDialogue); }
/// <summary> Dispatch to the listeners. </summary> void OnFinishedCurrentPlayerTurn(IPlayer currentPlayer) => GameEvents.Notify <IFinishPlayerTurn>(i => i.OnFinishPlayerTurn(currentPlayer));
public void ReturnToMenu() { GameEvents.GameReset(); GameEvents.ReturnToMenu(); }
public void OnMediatorMessageReceived(GameEvents events, GeneralData data) { if (data is PlayerInputData inputMessage) { if (inputMessage.id != playerNumber || sleeping) { return; } if (inputMessage.key_charge) { if (alowedToCharge) { Charging(inputMessage.axis); } } else { if (isCharging) { ReleaseCharge(inputMessage.axis); } } } if (events.HasFlag(GameEvents.PLAYER_GROUND_CHECK)) { if (data is GroundCheckData groundCheckData) { if (playerNumber == groundCheckData.id) { alowedToCharge = groundCheckData.isGrounded; if (groundCheckData.isGrounded) { if (chargePower > powerDamageThresholdWhenHittingFloor) { GlobalMediator.SendMessage(GameEvents.PLAYER_TAKE_DAMAGE, new PlayerData { id = playerNumber, }); } Reset(); } } } } if (events.HasFlag(GameEvents.PLAYER_IS_MOUNTING)) { if (data is PlayerTriggerBoxData isMounting) { if (playerNumber == isMounting.id) { alowedToCharge = isMounting.enterExit; } } } if (events.HasFlag(GameEvents.PLAYER_GOT_MOUNTED)) { if (data is PlayerData isMounted) { if (playerNumber == isMounted.id) { alowedToCharge = true; } } } if (events.HasFlag(GameEvents.PLAYER_SLEEP)) { if (data is PlayerData isSleeping) { if (playerNumber == isSleeping.id) { sleeping = true; } } } if (events.HasFlag(GameEvents.PLAYER_REPAIRED)) { if (data is PlayerData isSleeping) { if (playerNumber == isSleeping.id) { sleeping = false; } } } if (events.HasFlag(GameEvents.PLAYER_RESPAWN)) { if (data is PlayerData tagData) { if (tagData.id == playerNumber) { sleeping = false; alowedToCharge = true; } } } }
void OnDisable() { GameEvents.StopListening("BossDie", Die); GameEvents.StopListening("BossDamaged", PlayParticles); }
public void Scream(string EventName) { GameEvents.ScreamEvent(EventName); }
private void Awake() { instance = this; //DontDestroyOnLoad(this.gameObject); }
public void SubscribeToEvents() { GameEvents.onGUILaunchScreenSpawn.Add(launchScreenOpenEvent); GameEvents.onVesselRecovered.Add(vesselRecoverEvent); //GameEvents.onLaunch.Add(vesselSituationChange); GameEvents.onVesselSituationChange.Add(vesselSituationChange); GameEvents.onGameSceneLoadRequested.Add(gameSceneEvent); GameEvents.OnTechnologyResearched.Add(TechUnlockEvent); //if (!ToolbarManager.ToolbarAvailable || !KCT_GameStates.settings.PreferBlizzyToolbar) GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady); GameEvents.onEditorShipModified.Add(ShipModifiedEvent); GameEvents.OnPartPurchased.Add(PartPurchasedEvent); //GameEvents.OnVesselRecoveryRequested.Add(RecoveryRequested); GameEvents.onGUIRnDComplexSpawn.Add(TechEnableEvent); GameEvents.onGUIRnDComplexDespawn.Add(TechDisableEvent); GameEvents.OnKSCFacilityUpgraded.Add(FacilityUpgradedEvent); GameEvents.onGameStateLoad.Add(PersistenceLoadEvent); GameEvents.OnKSCStructureRepaired.Add(FaciliyRepaired); GameEvents.OnKSCStructureCollapsed.Add(FacilityDestroyed); GameEvents.Modifiers.OnCurrencyModified.Add(OnCurrenciesModified); GameEvents.StageManager.OnGUIStageAdded.Add(StageCountChangedEvent); GameEvents.StageManager.OnGUIStageRemoved.Add(StageCountChangedEvent); GameEvents.StageManager.OnGUIStageSequenceModified.Add(StagingOrderChangedEvent); GameEvents.StageManager.OnPartUpdateStageability.Add(PartStageabilityChangedEvent); GameEvents.FindEvent <EventVoid>("OnSYInventoryAppliedToVessel")?.Add(SYInventoryApplied); GameEvents.FindEvent <EventVoid>("OnSYReady")?.Add(SYReady); // The following was changed to a function because the Mono compiler available on Linux was causing errors with this call // GameEvents.FindEvent<EventData<Part>>("OnSYInventoryAppliedToPart")?.Add((p) => { KerbalConstructionTime.instance.editorRecalcuationRequired = true; }); GameEvents.FindEvent <EventData <Part> >("OnSYInventoryAppliedToPart")?.Add(OnSYInventoryAppliedToPart); // GameEvents.OnKSCStructureRepairing.Add(FacilityRepairingEvent); // GameEvents.onLevelWasLoaded.Add(LevelLoadedEvent); /* GameEvents.OnCrewmemberHired.Add((ProtoCrewMember m, int i) => * { * foreach (KCT_KSC ksc in KCT_GameStates.KSCs) * { * ksc.RecalculateBuildRates(); * ksc.RecalculateUpgradedBuildRates(); * } * }); * GameEvents.OnCrewmemberSacked.Add((ProtoCrewMember m, int i) => * { * foreach (KCT_KSC ksc in KCT_GameStates.KSCs) * { * ksc.RecalculateBuildRates(); * ksc.RecalculateUpgradedBuildRates(); * } * });*/ GameEvents.onGUIAdministrationFacilitySpawn.Add(HideAllGUIs); GameEvents.onGUIAstronautComplexSpawn.Add(HideAllGUIs); GameEvents.onGUIMissionControlSpawn.Add(HideAllGUIs); GameEvents.onGUIRnDComplexSpawn.Add(HideAllGUIs); GameEvents.onGUIKSPediaSpawn.Add(HideAllGUIs); // The following was changed to a function because the Mono compiler available on Linux was causing errors with this call // GameEvents.onEditorStarted.Add(() => { KCT_Utilities.HandleEditorButton(); }); GameEvents.onEditorStarted.Add(OnEditorStarted); GameEvents.onFacilityContextMenuSpawn.Add(FacilityContextMenuSpawn); subscribedToEvents = true; }
void OnDisable() { GameEvents.StopListening("CheckTP", CheckTP); }
void OnDisable() { GameEvents.StopListening("GamePaused", SetVisible); GameEvents.StopListening("GameResumed", SetInvisible); }
private void OnCrewOnEva(GameEvents.FromToAction<Part,Part> data) { KMPClientMain.DebugLog("EVA event"); if (data.from.vessel != null) sendVesselMessage(data.from.vessel); }
public void TimeOut() { ActiveInning.Stats(ActivePlayer).TimeOuts++; GameEvents.Push(GameEvent.TimeOut); }
public void OnPointerClick(PointerEventData eventData) { IsSelected = true; GameEvents.SquareSelectedMethod(SquareIndex); }
private void Dead() { this.gameObject.SetActive(false); GameEvents.ScreamEvent("BossDead"); Destroy(this.gameObject); }
private void Awake() { instance = this; }
void OnDestroy() { GameEvents.Unsubscribe("NextLevel", UpdateText); }
protected override Composite CreateBehavior() { return(new PrioritySelector( new Decorator(ret => ZetaDia.IsLoadingWorld, new Action() ), new Decorator(ret => ZetaDia.IsInTown && !DataDictionary.ForceTownPortalLevelAreaIds.Contains(Player.LevelAreaId), new Action(ret => { ForceClearArea = false; AreaClearTimer.Reset(); _isDone = true; }) ), new Decorator(ret => !ZetaDia.IsInTown && !ZetaDia.Me.CanUseTownPortal(), new Action(ret => { ForceClearArea = false; AreaClearTimer.Reset(); _isDone = true; }) ), new Decorator(ret => ZetaDia.Me.HitpointsCurrent < _startHealth, new Action(ret => { _startHealth = ZetaDia.Me.HitpointsCurrent; AreaClearTimer.Restart(); ForceClearArea = true; }) ), new Decorator(ret => AreaClearTimer.IsRunning, new PrioritySelector( new Decorator(ret => AreaClearTimer.ElapsedMilliseconds <= WaitTime, new Action(ret => ForceClearArea = true) // returns RunStatus.Success ), new Decorator(ret => AreaClearTimer.ElapsedMilliseconds > WaitTime, new Action(ret => { Logger.Log("Town Portal timer finished"); ForceClearArea = false; AreaClearTimer.Reset(); }) ) ) ), new Decorator(ret => !ForceClearArea, new PrioritySelector( new Decorator(ret => ZetaDia.Me.Movement.IsMoving, new Sequence( CommonBehaviors.MoveStop(), new Sleep(1000) ) ), new Decorator(ret => PortalCastTimer.IsRunning && PortalCastTimer.ElapsedMilliseconds >= 7000, new Sequence( new Action(ret => { Logger.Log("Stuck casting town portal, moving a little"); Navigator.MoveTo(Navigator.StuckHandler.GetUnstuckPos(), "Unstuck Position"); PortalCastTimer.Reset(); }) ) ), new Decorator(ret => PortalCastTimer.IsRunning && ZetaDia.Me.LoopingAnimationEndTime > 0, // Already casting, just wait new Action(ret => RunStatus.Success) ), new Sequence( new Action(ret => { PortalCastTimer.Restart(); GameEvents.FireWorldTransferStart(); ZetaDia.Me.UseTownPortal(); }), new WaitContinue(3, ret => ZetaDia.Me != null && ZetaDia.Me.LoopingAnimationEndTime > 0, new Sleep(100) ) ) ) ) )); }
// Use this for initialization void Start() { rect = GetComponent <RectTransform>(); gameManager = GameObject.Find("GameManager_mn"); eventScript = gameManager.GetComponent <GameEvents>(); }
private void Start() { GameEvents.GetInstance().OnPlayerChanged += DoCapturings; }
public void SetVolume(float sliderValue) { AudioController.SetSoundVol(thistag, sliderValue); GameEvents.ScreamEvent("changevolume"); }
public static void Init() { eventManager = new Crowd.EventManager(); if (taskManager == null) { taskManager = new Crowd.TaskManager(); } if (GameObject.Find("PathFinder")) { pathFindingManager = GameObject.Find("PathFinder").GetComponent<PathFindingManager>(); } else { pathFindingManager = null; } if (GameObject.Find("LevelEvents")) { levelEventsController = GameObject.Find("LevelEvents").GetComponent<LevelEventsControl>(); } else { levelEventsController = null; } if (GameObject.FindGameObjectWithTag("GameController")) { mainController = GameObject.FindGameObjectWithTag("GameController").GetComponent<MainControl>(); inputController = mainController.gameObject.GetComponent<InputControl>(); sceneController = mainController.gameObject.GetComponent<SceneControl>(); gameEvents = mainController.gameObject.GetComponent<GameEvents>(); dotweenEvents = mainController.gameObject.GetComponent<DotweenEvents>(); if (inputController != null && inputController.groundEnabled) { tileMarkerManager = new TileMarkerManager(); tileMarkerManager.Init(); } else { tileMarkerManager = null; } } else { mainController = null; inputController = null; sceneController = null; gameEvents = null; dotweenEvents = null; } if (GameObject.FindGameObjectWithTag("Transition")) { sceneTransitionController = GameObject.FindGameObjectWithTag("Transition").GetComponent<SceneTransitionControl>(); } else { sceneTransitionController = null; } //if (GameObject.FindGameObjectWithTag("Comic")) //{ // comicEvents = GameObject.FindGameObjectWithTag("Comic").GetComponent<ComicEvents>(); //} //else { comicEvents = null; } if (soundController == null) { soundController = new SoundControl(); soundController.Init(); } if (fmodController == null) { fmodController = new FmodControl(); fmodController.Init(); } if (GameObject.Find("CameraSystem")) { cameraController = GameObject.Find("CameraSystem").GetComponent<CameraControl>(); } else { cameraController = null; } //if (GameObject.FindGameObjectWithTag("SoundSystem")) //{ // soundController = GameObject.FindGameObjectWithTag("SoundSystem").GetComponent<SoundControl>(); // fmodController = GameObject.FindGameObjectWithTag("SoundSystem").GetComponent<FmodControl>(); //} //else //{ // soundController = null; // fmodController = null; //} if (GameObject.Find("Canvas")) { hudController = GameObject.Find("Canvas").GetComponent<HUDControl>(); } else { hudController = null; } utils = new Utils(); men = new List<GameObject>(GameObject.FindGameObjectsWithTag("Man")); menParentObj = GameObject.Find("Actors"); navMeshMinBound = new Vector3(float.MaxValue, float.MaxValue); navMeshMaxBound = new Vector3(-float.MaxValue, -float.MaxValue); GameObject[] navs = GameObject.FindGameObjectsWithTag("Ground"); foreach (GameObject nav in navs) { Collider collider = nav.GetComponent<BoxCollider>(); if (collider != null) { Vector3 c_min = collider.bounds.min; Vector3 c_max = collider.bounds.max; navMeshMinBound = new Vector2( Mathf.Min(c_min.x, navMeshMinBound.x), Mathf.Min(c_min.y, navMeshMinBound.y) ); navMeshMaxBound = new Vector2( Mathf.Max(c_max.x, navMeshMaxBound.x), Mathf.Max(c_max.y, navMeshMaxBound.y) ); } } }
public void WriteToFile(GameEvents gameEvents, string fileName) { JsonToFileSerializer <GameEvents> .WriteToFile(gameEvents, fileName); }
private void Awake() { current = this; }
private void Awake() { m_Current = this; }
public void AddPoint() { ActiveInning.Stats(ActivePlayer).Points++; GameEvents.Push(GameEvent.AddPoint); }
public void Clicked() { GameEvents.StartMainGame(); Destroy(GetComponentInParent <Canvas>().gameObject); }
public void Safety() { ActiveInning.Stats(ActivePlayer).Safeties++; GameEvents.Push(GameEvent.Safety); }
// Update is called once per frame void Update() { BtnEscapeUpdate(); BackgroundUpdate(); switch (_state) { case 0: _state = 1; Init(); return; case 1: /*if (isHint) { * if (hintSprite.color.a < 1f) { * Color _color = hintSprite.color; * _color.a += 0.05f; * hintSprite.color = _color; * } * }*/ break; case 2: if (_isNextLevel) { //bubbleField.NextLevel (); _isNextLevel = false; } else { //if (!DefsGame.wowSlider.UpdateSlider ()) { // GameOver (); // return; //} } break; case 3: _time += Time.deltaTime; if (_time >= _missDelay) { _time = 0f; _screenAnimation.SetAlphaMax(0.93f); _screenAnimation.SetAnimation(false, 0.1f); _screenAnimation.Show(); _screenAnimation.SetAnimation(true, 0.02f); _screenAnimation.SetColor(1.0f, 0.21f, 0.21f); _screenAnimation.SetAutoHide(true); _state = 4; } break; case 4: if (!_screenAnimation.isActiveAndEnabled) { _state = 5; Camera.main.transform.position = new Vector3(_cameraStartPos.x, _cameraStartPos.y, _cameraStartPos.z); EndCurrentGame(); } else { Camera.main.transform.position = new Vector3(_cameraStartPos.x + Random.Range(-0.015f, 0.015f), _cameraStartPos.y + Random.Range(-0.015f, 0.015f), _cameraStartPos.z); } break; case 5: break; case 6: /*FlurryEventsManager.SendEndEvent ("attempt_length"); * FlurryEventsManager.SendEventPlayed (isReviveUsed, fail_reason); * * if ((DefsGame.gameBestScore == DefsGame.currentPointsCount)&&(DefsGame.gameBestScore != 0)) { * DefsGame.gameServices.SubmitScore (DefsGame.gameBestScore); * PlayerPrefs.SetInt ("BestScore", DefsGame.gameBestScore); * }*/ PlayerPrefs.SetInt("coinsCount", DefsGame.CoinsCount); DefsGame.RingManager.Miss(); HintCheck(); IsGameOver = false; NextBackground(); GameEvents.Send(OnShowMenu); DefsGame.CurrentScreen = DefsGame.SCREEN_MENU; _state = 7; break; case 7: _time += Time.deltaTime; if (_time >= 0.8f) { _time = 0f; Init(); _state = 1; } break; } /*if ((!isHint)&&(hint)&&(hint.activeSelf)) { * if (hintSprite.color.a > 0f) { * Color _color = hintSprite.color; * _color.a -= 0.05f; * hintSprite.color = _color; * } else { * hint.SetActive (false); * } * }*/ }
// Update is called once per frame void Update() { if (!_isActive) { return; } transform.RotateAround(_goalPoint, Vector3.forward, CurrVelocity * Time.deltaTime); if (_isCrash) { if (CurrVelocity > 1f) { CurrVelocity -= 1.7f; } else if (CurrVelocity < -1f) { CurrVelocity += 1.7f; } else { Stop(); //Invoke("Respown", 0.5f); GameEvents.Send(OnGameOver); } } else if (_isMoving) { bool accIsChanged = false; if (DefsGame.CurrentPointsCount < 30) { _acceleration = 0.03f; accIsChanged = true; } else if (DefsGame.CurrentPointsCount < 50) { _acceleration = 0.015f; accIsChanged = true; } else if (DefsGame.CurrentPointsCount < 100) { _acceleration = 0.01f; accIsChanged = true; } else if (DefsGame.CurrentPointsCount < 200) { _acceleration = 0.005f; accIsChanged = true; } if (accIsChanged) { if (CurrVelocity < 0f) { _acceleration *= -1; } } CurrVelocity += _acceleration; _speedToAddPoints += _accToAddPoints; _pointsValue += _speedToAddPoints; if (_pointsValue - _oldAddPointsValue >= 1.0f) { GameEvents.Send(OnAddPoints, (int)(_pointsValue - _oldAddPointsValue)); _oldAddPointsValue = _pointsValue; } if ((InputController.IsTouchOnScreen(TouchPhase.Began)) && (DefsGame.CameraMovement.IsMovingToTarget)) { Vector2 currentForwardNormal = transform.up * -_radius; _goalPoint = new Vector3(transform.position.x + currentForwardNormal.x, transform.position.y + currentForwardNormal.y, transform.position.z); CurrVelocity *= -1f; _acceleration *= -1f; //Body.transform.DORotate(Vector3.forward*180f, 1f); transform.Rotate(Vector3.forward, 180f); //Car.Rotate(new Vector3(0f, 0f, transform.rotation.z)); Defs.PlaySound(_sndRotate, 0.4f); } } }
private void OnPartCouple(GameEvents.FromToAction<Part,Part> data) { docking = true; KMPClientMain.DebugLog("Dock event: " + data.to.vessel.id + " " + data.from.vessel.id); //Destroy old vessels for other players removeDockedVessel(data.to.vessel); removeDockedVessel(data.from.vessel); //Fix displayed crew while (KerbalGUIManager.ActiveCrew.Count > 0) { KMPClientMain.DebugLog("Removed extra displayed crew member"); KerbalGUIManager.RemoveActiveCrew(KerbalGUIManager.ActiveCrew.Find(k => true)); } Invoke("setDoneDocking",3f); }
void OnEnable() { GameEvents.StartListening("CheckTP", CheckTP); }