public void LoadScene(Scenes scene) { Debug.Log("Loading scene: " + scene.ToString()); // this deliberately prevents explicitly loading the splash screen again, in case it has one-time initializations if (scene > 0 && scene < Scenes.SXX_END) Application.LoadLevel((int)scene); }
static public void Setup(Game game) { game.Components.Clear(); mode = "HELP"; currentScene = Scenes.OPENING; scene = new Opening(game); game.Components.Add(SceneManager.scene); }
public void StartGame() { if(currScene == Scenes.Main) { currScene = Scenes.Game; Application.LoadLevel(1); } }
public void ReturnToMain() { if(currScene == Scenes.Game) { currScene = Scenes.Main; Application.LoadLevel(0); } }
public void ChangeScene(Scenes loadScene, float delayTime = defaultDelayTime) { SceneToLoad = loadScene.ToString(); // start a coroutine that wais for the delay time and then loads the scene // also load the loading screen here and then load the requested scene. //Application.LoadLevel(sceneName); Invoke("CallChangeScene", defaultDelayTime); }
public void ChangeScene(Scenes _scene) { BottleBash._paused = false; switch (_scene) { case Scenes.SPLASH: _currentScene = new Splash(); break; case Scenes.MENU: _currentScene = new Menu(); break; case Scenes.PLAYSTATE: _currentScene = new BottleBash(); break; case Scenes.CREDITS: _currentScene = new Credits(); break; case Scenes.HOWTO: _currentScene = new TutorialScreen(); break; case Scenes.SCORE: _currentScene = new WinScreen(); //(); break; case Scenes.PAUSED: BottleBash._paused = true; break; case Scenes.UNPAUSED: BottleBash._paused = false; break; case Scenes.MUSIC: Menu _tempMenu = _currentScene as Menu; _tempMenu.DisplayMusicRequest(true); break; } }
public void startGame() { screenArea.Children.Clear(); currentScene = Scenes.Start; screenArea.Children.Add(startScreen); if (playSound) { sp.SoundLocation = "Resources/HDATE Main Theme.wav"; sp.PlayLooping(); } }
public void AdvanceState (Scenes state) { this.ReturnScene = state; Debug.Log ("Going to " + state); SceneManager.LoadScene ((int)state); if (OnStateCHange != null) { OnStateCHange (); } }
// Use this for initialization void Start() { if (Scenes.GetSceneParameters() != null) { time = Convert.ToString(Scenes.GetParam("time")); } else { time = ""; } text.text += time; }
/// <summary> シーンを指定してアンロード. </summary> public void UnloadScene(Scenes identifier) { if (currentScene.Identifier == identifier) { throw new ArgumentException("The current scene can not be unloaded"); } var sceneInstance = loadedScenes.GetValueOrDefault(identifier); // AddTo(this)されると途中でdisposableされてしまうのでIObservableで公開しない. UnloadScene(sceneInstance).Subscribe().AddTo(Disposable); }
public void nextLevel() { Scenes.currentLevel++; if (GAME[Scenes.currentLevel] != "Level2") { Scenes.Load(GAME[Scenes.currentLevel], Scenes.nextDimension(), true); } else { Scenes.Load(GAME[Scenes.currentLevel], Scenes.getDimension(), true); } }
void Scene_hide() { text.text = "You quickly hide behind the nearest pillar, and luckily, the Orc didn't see you. However, he has to take his rage out on someone, so he turns to Yondor. " + "He proceeds to start battering her shield, and Shior starts casting a spell behind Yondor. She releases it, and you think it normally would've killed the Orc, " + "but he instead shakes it off, even as he's bleeding and surely has even more blurred vision from the blow. Yondor can't hold her shield up much longer, but" + "you're too far away to do anything, so you watch in horror as the Orc deals a blow to Yondor, knocking her unconcious, and smashes Shior's head in, killing her." + "you decide to call to the other party members who were outside as lookouts to come help carry the two unconcious members out, and you retreat. P to proceed."; if (Input.GetKeyDown(KeyCode.P)) { PresScene = Scenes.gameover_retreat; } }
protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container) { YAMLMappingNode node = base.ExportYAMLRoot(container); node.AddSerializedVersion(GetSerializedVersion(container.ExportVersion)); node.Add(ScenesName, Scenes.ExportYAML(container)); if (IsReadConfigObjects(container.ExportVersion)) { node.Add(ConfigObjectsName, GetConfigObjects(container.Version).ExportYAML(container)); } return(node); }
private IEnumerator <float> IEOpenScene(Scenes scene, object data) { canChangeScene = false; if (onSceneChange != null) { onSceneChange(scene); } yield return(Timing.WaitForSeconds(0.12f)); OnProgressChangeScene(scene, data); canChangeScene = true; }
public static void Load(Scenes scene) { // Display loading screen onLoadManagerCallback = () => { SceneManager.LoadScene(Scenes.Loading.ToString()); }; // Load target scene LastLoadedLevel = scene.ToString(); SceneManager.LoadScene(scene.ToString()); }
public static void loadSnake(Scenes scene) { loaderReadyAction = () => { //Load Desired scene after load screen has updated. SceneManager.LoadScene(scene.ToString()); }; //Display loading screen... SceneManager.LoadScene(Scenes.LoadingScreen.ToString()); }
private void SetExportData(IExportContainer container) { // if < 3.0.0 this asset doesn't exist // 3.0.0 to 5.5.0 this asset is created by culling settings so it has set data already if (OcclusionCullingSettings.IsReadPVSData(container.Version)) { return; } // if >= 5.5.0 and !Release this asset containts renderer data if (IsReadStaticRenderers(container.Flags)) { return; } // if >= 5.5.0 and Release this asset doesn't containt renderers data so we need to create it List <OcclusionCullingSettings> cullingSettings = new List <OcclusionCullingSettings>(); foreach (Object asset in File.Collection.FetchAssets()) { if (asset.ClassID == ClassIDType.OcclusionCullingSettings) { OcclusionCullingSettings cullingSetting = (OcclusionCullingSettings)asset; if (cullingSetting.OcclusionCullingData.IsAsset(cullingSetting.File, this)) { cullingSettings.Add(cullingSetting); } } } int maxRenderer = Scenes.Max(j => j.IndexRenderers + j.SizeRenderers); m_staticRenderers = new SceneObjectIdentifier[maxRenderer]; int maxPortal = Scenes.Max(j => j.IndexPortals + j.SizePortals); m_portals = new SceneObjectIdentifier[maxPortal]; foreach (OcclusionCullingSettings cullingSetting in cullingSettings) { OcclusionScene scene = Scenes.First(t => t.Scene == cullingSetting.SceneGUID); if (scene.SizeRenderers != cullingSetting.StaticRenderers.Count) { throw new Exception($"Scene renderer count {scene.SizeRenderers} doesn't match with given {cullingSetting.StaticRenderers.Count}"); } if (scene.SizePortals != cullingSetting.Portals.Count) { throw new Exception($"Scene portal count {scene.SizePortals} doesn't match with given {cullingSetting.Portals.Count}"); } SetIDs(container, cullingSetting, scene); } }
private void LoadScenes(XmlNode parent) { if (parent.ChildNodes != null) { Scenes.Clear(); } SceneDescription d; foreach (XmlNode node in parent.ChildNodes) { d = new SceneDescription(); // traverse each attribute foreach (XmlAttribute a in node.Attributes) { switch (a.Name) { case XmlAttributeNames.Name: d.Name = a.Value; break; case XmlAttributeNames.Description: d.Description = a.Value; break; case XmlAttributeNames.Column: d.Column = Int32.Parse(a.Value); break; case XmlAttributeNames.TimePosition: d.TimePosition = Int32.Parse(a.Value); break; case XmlAttributeNames.Duration: d.Duration = Int32.Parse(a.Value); break; } } foreach (XmlNode contentNode in node.ChildNodes) { IContent content = new UnrecognizedContent(); foreach (IRiddleHandler h in ContentHandlers) { if (h.CanLoad(contentNode)) { content = h.Load(contentNode); } } d.Pages.Add(content); } Scenes.Add(d); } }
public void LoadScene(Scenes scene) { switch (scene) { case Scenes.PlayerCountSelection: { PlayerCountSelection mainMenu = new PlayerCountSelection(0, 0, 45, 35, '#'); playersCount = mainMenu.Start() + 2; LoadScene(Scenes.DiceSelection); break; } case Scenes.DiceSelection: { DiceSelection diceSelection = new DiceSelection(0, 0, 45, 35, '#'); diceSides = diceSelection.Start(); LoadScene(Scenes.DiceCountSelection); break; } case Scenes.DiceCountSelection: { DiceCountSelection diceCountSelection = new DiceCountSelection(0, 0, 45, 35, '#'); diceCount = diceCountSelection.Start(); LoadScene(Scenes.Play); break; } case Scenes.Play: { Dice typeOfDie = new Dice(diceSides); Battle battle = new Battle(playersCount, typeOfDie, diceCount); winnersCount = battle.Roll(); if (winnersCount > 1) { playersCount = winnersCount; LoadScene(Scenes.DiceSelection); } else { LoadScene(Scenes.PlayerCountSelection); } break; } default: { Console.WriteLine("Unknow Scene"); break; } } }
public override void OnInspectorGUI() { Scenes scene = (Scenes)target; base.OnInspectorGUI(); serializedObject.Update(); if (scene.head) { scene.head.scene = scene; } serializedObject.ApplyModifiedProperties(); }
private void InitializeMenu() { _pointer = new Coordinates() { x = 0, y = 1 }; _pointerChar = '>'; _lockX = true; _lockY = false; _drawCursor = true; InitializeBoard(); _actualScene = Scenes.Menu; }
internal virtual void OnDraw(GameTime gameTime) { watch.Restart(); GraphicsDevice.Clear(Color.CornflowerBlue); SpriteBatch.Begin(); Scenes.Draw(gameTime); this.Draw(gameTime); FpsCounter.Draw(gameTime); SpriteBatch.End(); watch.Stop(); FpsCounter.FrameTime = watch.Elapsed; watch2.Restart(); }
//Firebase databse reference private void Start() { FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://finalprojectunity-31171.firebaseio.com//"); reference = FirebaseDatabase.DefaultInstance.RootReference; ////Get email GameObject temp = GameObject.Find("Ground (1)"); ground = temp.GetComponent <Transform>(); vilID = Scenes.getParam("villageID"); turretRef = reference.Child("turrets"); }
/// <summary> /// Delegate that executes everytime a scene is loaded to update currentScene variable. /// </summary> /// <param name="scene">laoded scene</param> /// <param name="mode">mode used to load the sene</param> void OnSceneLoaded(Scene scene, LoadSceneMode mode) { switch (scene.name) { case "FinalScene_Construct": currentScene = Scenes.CONSTRUCT; break; case "FinalScene_HUD": currentScene = Scenes.HUD; break; } }
// Use this for initialization void Start() { endObjects = GameObject.FindGameObjectsWithTag("EndScreen"); foreach (GameObject i in endObjects) { i.SetActive(false); } if (Scenes.getParameter("numberOfPlayers") != "") { numberOfPlayers = int.Parse(Scenes.getParameter("numberOfPlayers")); } NumberOfPlayersPreparation(); }
public void SetSceneItemVisibility(string scene_id, string item_id, bool visible) { try { var scene_index = Scenes.FindIndex(x => x.Id == scene_id); var item_index = Scenes[scene_index].Items.FindIndex(x => x.Id == item_id); SetSceneItemVisibility(scene_index, item_index, visible); } catch (ArgumentNullException e) { } catch (Exception e) { } }
protected override void LoadContent() { SpriteBatch = new SpriteBatch(GraphicsDevice); var playerAnimation = Textures.Load(TextureNames.PlayerAnimation); var whitePixel = Textures.Load(TextureNames.WhitePixel, new Texture2D(GraphicsDevice, 1, 1)); whitePixel.SetData(new[] { Color.White }); Player = new Player(); Scenes.ChangeScene(TitleScreen.Title); }
/// <summary> /// Convert from enum to string /// </summary> public static string GetSceneName(Scenes scene) { int index = (int)scene; if (index > 0 && index < ScenesNameArray.Length) { return(ScenesNameArray[index]); } else { return(INVALID_SCENE); } }
private void SceneChangeUpdate(ActiveScene activeScene) { if (activeScene.Value == Scenes.Title) { DestroyHearts(); } else if (activeScene.Value == Scenes.Game) { SpawnHearts(); } m_CurrentScene = activeScene.Value; }
protected override void Update(GameTime gameTime) { Input.Update(gameTime); if (Input.Keyboard.IsKeyPressed(Keys.F1)) { IsDebug = !IsDebug; } Scenes.Update(gameTime); base.Update(gameTime); }
/// <summary> /// Initializes either offline mode or trial mode depending on whether the game remembers player's login data from last session. /// </summary> public void LoginOffline() { if (HasRememberedUser()) { connectionMode = ConnectionMode.Offline; } else { connectionMode = ConnectionMode.Trial; } Initialize(); Scenes.Load(Scenes.MAIN_MENU_SCENE); }
private void SetServerUrlAndRoomNo() { Dictionary <string, string> parameters = Scenes.getSceneParameters(); serverUrl = ServerUtils.GetSocketIOUrl(); roomNo = "123456"; if (parameters != null) { serverUrl = parameters ["serverUrl"]; roomNo = parameters ["roomNo"]; } Debug.Log("serverUrl = " + serverUrl); }
public void ValidateModifications() { Scenes.GetGOParameters().Clear(); foreach (Transform elementTransform in objectContainer.transform) { if (elementTransform.transform != objectContainer.transform) { Scenes.AddGOParam(elementTransform.gameObject.GetComponentInChildren <BoxCollider>().gameObject.name, elementTransform.gameObject); } } Scenes.CloseScene("EditObject"); }
private void TransitionScene_NewSceneWasLoaded(Scenes obj) { if (obj == Scenes.INGAME) { //Instance._canvas.enabled = true; gameObject.SetActive(true); } else { //Instance._canvas.enabled = false; gameObject.SetActive(false); } }
private void Update() { if (Input.GetMouseButtonDown(0)) { Debug.Log(type.ToString()); //change scene if (type != SceneType.none) { player.SavePlayerPos(); SceneManager.LoadScene(Scenes.SceneName(type)); } } }
/// <summary> /// Показ диалогов с использованием объекта события и указанием на каком диалоге вызвать ///0 : На каждом диалоге /// </summary> /// <param name="scene"></param> /// <param name="place"></param> /// <param name="eventHandler"></param> /// <param name="numberCallEvent"></param> public DialogManager(Scenes scene, Places place, IDialogEventHandler eventHandler = null, int numberCallEvent = 0) { this.numberCallEvent = numberCallEvent; if (eventHandler is null) { finishedHandler = null; } else { finishedHandler = eventHandler.FinishedHandler; } WriteDialogs(scene, place); }
/// <summary> /// Default behavior - create scene selected in the combo-box. /// Can handle InitSceneDelegate, InitSceneParamDelegate or CSscript file-name /// </summary> public IRayScene SceneByComboBox() { string sceneName = (string)ComboScene.Items[selectedScene]; if (sceneRepository.TryGetValue(sceneName, out object definition)) { return(Scripts.SceneFromObject(new DefaultRayScene(), sceneName, definition, TextParam.Text, (sc) => Scenes.DefaultScene(sc), SetText)); } // fallback to a default scene; return(Scenes.DefaultScene()); }
public void AddScene(IGraphScene <TItem, TEdge> scene) { if (scene != null && !Scenes.Contains(scene)) { Scenes.Add(scene); var graph = scene.Graph; RegisterBackGraph(graph); graph.GraphChange -= this.VisualGraphChange; graph.GraphChange += this.VisualGraphChange; graph.ChangeData -= this.VisualGraphChangeData; graph.ChangeData += this.VisualGraphChangeData; } }
private void Awake() { theTransform = transform; anim = GetComponent<Animator>(); playerH = GetComponent<PlayerHealth>(); rigid = GetComponent<Rigidbody2D>(); positions = GameObject.FindWithTag("Scripts").GetComponent<Positions>(); reset = GameObject.FindWithTag("Scripts").GetComponent<Reset>(); enemies = GameObject.FindGameObjectsWithTag("Enemy"); tips = GameObject.FindWithTag("UI").GetComponent<HelpfulTips>(); showPanels = GameObject.FindWithTag("UI").GetComponent<ShowPanels>(); scenes = GameObject.FindWithTag("Scripts").GetComponent<Scenes>(); if (!isRight) reset.ResetHelmet(); rigid.gravityScale = 0f; GetComponentInChildren<SpriteRenderer>().enabled = false; }
/// <summary> /// Loads scene by given scene enum value. Prints an error message in the console if no scene info found. /// </summary> /// <param name="scene"></param> public static IEnumerator AsyncMapLoad(Scenes sceneName) { string sceneNameString = ""; if (ScenesDictionary.TryGetValue(sceneName, out sceneNameString) == true) { CurrentScene = sceneName; AsyncOperation LoadingOperation = Application.LoadLevelAsync(sceneNameString); if (LoadingOperation.isDone == false) { // still loading, maybe show loading indication // LoadingOperation.progress for [0; 1] loading status value yield return null; } // loading complete after this point } else { Debug.LogError("Failed to find a scene of type " + sceneName); } }
void GoToNextScene() { switch (currScene) { case Scenes.Loading: currScene = Scenes.MainMenu; Application.LoadLevel("Main"); break; case Scenes.MainMenu: currScene = Scenes.Game; Application.LoadLevel("TestScene"); break; case Scenes.Game: currScene = Scenes.MainMenu; Application.LoadLevel("Main"); break; default: currScene = Scenes.MainMenu; Application.LoadLevel("Main"); break; } }
private GameStateStore () { ReturnScene = Scenes.Intro; }
/// <summary> /// Event on scene startup /// </summary> /// <param name="scene"></param> void OnSceneStartup(Scenes scene) { switch (scene) { case Scenes.Menu: Application.LoadLevel("Menu"); if (finishedAGame) GameObject.FindGameObjectWithTag("cucumber").GetComponent<TiltShakeMotor>().isInTendresse = true; break; case Scenes.LoadingGame: CanvasGroup loading = GameObject.FindWithTag("MainMenuRef").GetComponent<MainMenuRefUI>().loading; loading.DOFade(1, 0.75f); loading.GetComponent<LoadingUI>().StartAnim(); message messa = new message("queueMatch"); NetManager.instance.SendMessage(messa); break; case Scenes.Main: Application.LoadLevel("Main"); message mes = new message("requestDateStart"); NetManager.instance.SendMessage(mes); break; } }
/// <summary> /// Event when the scene end /// </summary> /// <param name="scene"></param> void OnSceneEnd(Scenes scene) { switch (scene) { case Scenes.Menu: GameObject.FindWithTag("MainMenuRef").GetComponent<MainMenuRefUI>().mainMenu.DOFade(0, 0.75f); AudioManager.instance.StopMusic(); break; case Scenes.LoadingGame: CanvasGroup loading = GameObject.FindWithTag("MainMenuRef").GetComponent<MainMenuRefUI>().loading; loading.DOFade(0, 0.75f); loading.GetComponent<LoadingUI>().StopAllCoroutines(); break; case Scenes.Main: finishedAGame = true; break; } }
//FUNCTIONS /// <summary> /// Switch between scenes /// </summary> /// <param name="scene"></param> public void SwitchScene(Scenes scene) { OnSceneEnd(currentScene); currentScene = scene; OnSceneStartup(currentScene); }
public void LoadLevel(Scenes target){ GameSceneManager.ins.LoadScene((int)target); }
private void fleeButton_Click(object sender, RoutedEventArgs e) { endCombat(false); if (p1.HP <= 0) { if (playSound) { sp.Stop(); sp.SoundLocation = "Resources/Death Theme.wav"; sp.PlayLooping(); } clearScreenArea(); deathScreen.characterName.Content = inGameScreen.charName.Content; currentScene = Scenes.Dead; screenArea.Children.Add(deathScreen); } }
/// <summary> /// Awake (Unity) function /// This is called FIRST, you may have to increase priority to load this in the Script /// Execution Order (already done in template project). Below are goals of this function: /// * Verify attached files to game Manager for referencing other managers /// other sort of information from outside the particular script you are in. /// * Identify and store the current device / OS that the game is running on and store it. /// * Update Scene To Load Next, This is used for development to quickly change the first scene when you hit play. /// * If this is not Unity Editor make sure levelEditMode is false, to avoid problems where wrong states are called (like input processing sent to levelEditor) /// </summary> protected override void Awake() { Debug.Log("GM_Awake()"); gameManager = GetComponent<GM>() as GM; //if (useAtlas) setAtlas(); if (scene == null) scene = GameObject.FindGameObjectWithTag("_SM").GetComponent<sceneManager>(); #if UNITY_EDITOR if (scene.thisScene != currentScene) { currentScene = scene.thisScene; } if (scene.debugOn) { framework.gMode = (int)GameMode.Slots; } #else //levelMan.levelEditMode = false; #endif DontDestroyOnLoad(this.gameObject); base.Awake(); // Call Parent Awake }
void callSceneChangeAction(Scenes scene) { if (OnSceneChange != null) { OnSceneChange(scene); } }
public IEnumerator loadLevelAsync() { AsyncOperation async; Debug.Log("LoadLevelAsync = " + (int)nextScene + " = " + nextScene.ToString()); #if UNITY_EDITOR if (!debugSaveMode) data.saveGame(); #else data.saveGame(); #endif async = SceneManager.LoadSceneAsync(nextScene.ToString()); yield return async; currentScene = nextScene; secondStart(); }
public void loadLevel() { Debug.Log("LoadLevel = " + (int)Scenes.MAIN + " = " + Scenes.MAIN.ToString()); #if UNITY_EDITOR if (!debugSaveMode) data.saveGame(); #else data.saveGame(); #endif SceneManager.LoadScene((int) Scenes.MAIN); // yield return new WaitForSeconds(0.1f); currentScene = Scenes.MAIN; secondStart(); }
//navigation logic private void keyPressed(object sender, KeyEventArgs e) { if (currentScene == Scenes.Ingame) { switch (e.Key) { case Key.W: testMap.playerMoveUp(); break; case Key.A: testMap.playerMoveLeft(); break; case Key.S: testMap.playerMoveDown(); break; case Key.D: testMap.playerMoveRight(); break; } if (testMap.layout[testMap.playerPosition.x][testMap.playerPosition.y].type == TileType.monster) { battle(); if (testMap.currentFloor % 5 != 0) testMap.layout[testMap.playerPosition.x][testMap.playerPosition.y].type = TileType.open; else { testMap.layout[testMap.playerPosition.x][testMap.playerPosition.y - 1].type = TileType.end; testMap.layout[testMap.playerPosition.x][testMap.playerPosition.y].type = TileType.open; } } if (testMap.layout[testMap.playerPosition.x][testMap.playerPosition.y].type == TileType.end) { shopIsReadyToReset = true; if (p1.maxFloorReached != 0) { hookUpELW(); ELW.levelSlider.Maximum = p1.maxFloorReached; ELW.Show(); } else { p1.maxFloorReached = 1; generateMap(1); displayMap(); } } if (testMap.layout[testMap.playerPosition.x][testMap.playerPosition.y].type == TileType.trap) { testMap.layout[testMap.playerPosition.x][testMap.playerPosition.y].type = TileType.triggeredTrap; p1.HP -= (int)(p1.MaxHP * trapDamagePercent); string message = "You stepped on a trap! \n\tHaha you fool! Take " + (int)(p1.MaxHP * trapDamagePercent) + " damage!"; hookUpTrapMW(message); } if (p1.HP <= 0) { if (playSound) { sp.Stop(); sp.SoundLocation = "Resources/Death Theme.wav"; sp.PlayLooping(); } clearScreenArea(); deathScreen.characterName.Content = inGameScreen.charName.Content; screenArea.Children.Clear(); currentScene = Scenes.Dead; screenArea.Children.Add(deathScreen); } if (testMap.layout[testMap.playerPosition.x][testMap.playerPosition.y].type == TileType.store || testMap.layout[testMap.playerPosition.x][testMap.playerPosition.y].type == TileType.npc) { inGameScreen.Shop1.Visibility = Visibility.Visible; if (shopIsReadyToReset) { shopIsReadyToReset = false; int itemLevel = (p1.maxFloorReached < p1.Level ? p1.maxFloorReached : p1.Level); clearShopItems(); if (itemLevel == 0) itemLevel = 1; if (itemLevel > 2) assignShopItems(itemLevel - 2); assignShopItems(itemLevel); Random rGen = new Random(); if (rGen.Next(0, 15) > 12) { assignShopItems(itemLevel + 2); } } } else { inGameScreen.Shop1.Visibility = Visibility.Hidden; } } }
private void attkButton_Click(object sender, RoutedEventArgs e) { int damage = 0; if (p1.EquippedWeapon != null && p1.EquippedWeapon.type == WeaponType.Staff) { float dmgmod = (float)((1 - (0.01 * (CombatGUI.m1.intellect/50)))); if (dmgmod < .5) { dmgmod = (float).5; } damage = (int)Math.Round(dmgmod * (p1.Attack()/2)); } else if (p1.EquippedWeapon != null && p1.EquippedWeapon.type == WeaponType.Bow) { float dmgmod = (float)((1 - (0.01 * (CombatGUI.m1.dexterity / 50)))); if (dmgmod < .5) { dmgmod = (float).5; } damage = (int)Math.Round(dmgmod * (p1.Attack() / 2)); } else if (p1.EquippedWeapon != null && p1.EquippedWeapon.type == WeaponType.Sword) { float dmgmod = (float)((1 - (0.01 * (CombatGUI.m1.strength / 50)))); if (dmgmod < .5) { dmgmod = (float).5; } damage = (int)Math.Round(dmgmod * (p1.Attack() / 2)); } else { damage = p1.Attack()/2; } if (CombatGUI.m1.takeDamage(damage)) endCombat(true); else { if (CombatGUI.m1.type == "dexMonster") { float dmgmod=(float)(1 - (0.01 * (p1.Dexterity/50))); if (dmgmod < .5) { dmgmod = (float).5; } damage = (int)Math.Round((dmgmod* (CombatGUI.m1.damage/2+(.01*CombatGUI.m1.Level)))); if (damage < 1) { damage = 1; } } else if (CombatGUI.m1.type == "strMonster") { float dmgmod = (float)(1 - (0.01 * (p1.Strength/50))); if (dmgmod < .5) { dmgmod = (float).5; } damage = (int)Math.Round((dmgmod * (CombatGUI.m1.damage / 2 + (.01 * CombatGUI.m1.Level)))); if (damage < 1) { damage = 1; } } else if (CombatGUI.m1.type == "intMonster") { float dmgmod=(float)(1 - (0.01 * (p1.Intelligence/50))); if (dmgmod < .5) { dmgmod = (float).5; } damage = (int)Math.Round((dmgmod * (CombatGUI.m1.damage / 2 + (.01 * CombatGUI.m1.Level)))); if (damage < 1) { damage = 1; } } p1.HP -= damage; } if (p1.HP <= 0) { if (playSound) { sp.Stop(); sp.SoundLocation = "Resources/Death Theme.wav"; sp.PlayLooping(); } clearScreenArea(); deathScreen.characterName.Content = inGameScreen.charName.Content; currentScene = Scenes.Dead; screenArea.Children.Add(deathScreen); //MessageBox.Show("You Died!"); //startGame(); } }
private void HandleGenericCollisionEvent(CollisionEventUpdate update, Scenes.ScriptEvents eventType, EventManager.ScriptColliding callback, bool playSound) { // play the sound. if (playSound && CollisionSound != UUID.Zero && eventType == ScriptEvents.collision_start && CollisionSoundVolume > 0.0f) { SendSound(CollisionSound.ToString(), CollisionSoundVolume, true, (byte)0); } SceneObjectPart handlingPart = FindCollisionHandlingPart(eventType); if (handlingPart == null) return; //no one to handle the event ColliderArgs colliderArgs = new ColliderArgs(); List<DetectedObject> colliding = new List<DetectedObject>(); bool otherIsPrim; if (update.Type == CollisionEventUpdateType.CollisionBegan || update.Type == CollisionEventUpdateType.CollisionContinues || update.Type == CollisionEventUpdateType.BulkCollisionsContinue || update.Type == CollisionEventUpdateType.CollisionEnded) { otherIsPrim = true; } else { otherIsPrim = false; } if (update.BulkCollisionData == null) { TryExtractCollider(update.OtherColliderLocalId, colliding, otherIsPrim, update.OtherColliderUUID); } else { foreach (uint localId in update.BulkCollisionData) { TryExtractCollider(localId, colliding, otherIsPrim, update.OtherColliderUUID); } } if (colliding.Count > 0) { colliderArgs.Colliders = colliding; // always running this check because if the user deletes the object it would return a null reference. if (m_parentGroup == null) return; if (m_parentGroup.Scene == null) return; callback(handlingPart.LocalId, colliderArgs); } }
private void HandleGenericLandCollisionEvent(CollisionEventUpdate update, Scenes.ScriptEvents eventType, EventManager.ScriptLandColliding callback, bool playSound) { // play the sound. if (playSound && CollisionSound != UUID.Zero && eventType == ScriptEvents.collision_start && CollisionSoundVolume > 0.0f) { SendSound(CollisionSound, CollisionSoundVolume, (byte)SoundFlags.None, true); } SceneObjectPart handlingPart = FindCollisionHandlingPart(eventType); if (handlingPart == null) return; //no one to handle the event if (m_parentGroup == null) return; if (m_parentGroup.Scene == null) return; callback(handlingPart.LocalId, update.CollisionLocation); }
public void startLoadedGame() { if (playSound) { sp.SoundLocation = "Resources/HDATE Main Theme.wav"; sp.PlayLooping(); } inGameScreen = new inGame(ref p1); hookUpInterface(); currentScene = Scenes.Ingame; clearPlayArea(); generateMap(0); displayMap(); screenArea.Children.Add(inGameScreen); }
/// <summary> /// Finds the part (this one or its parent or none) that should be handling collision events /// </summary> /// <param name="eventType"></param> /// <returns></returns> private SceneObjectPart FindCollisionHandlingPart(Scenes.ScriptEvents eventType) { SceneObjectPart handlingPart = null; //check this part first for the event, then if it doesnt exist here check the root PhysicsActor myPhyActor = this.PhysActor; if ((this.ScriptEvents & eventType) != 0 && (IsAttachment || (myPhyActor != null && (this.IsRootPart() || !myPhyActor.Properties.PassCollisions)))) { handlingPart = this; } else if (!this.IsRootPart()) { //can the root handle it? SceneObjectPart parentPart = this.ParentGroup.RootPart; PhysicsActor parentPhyActor = parentPart.PhysActor; if ((parentPart.ScriptEvents & eventType) != 0 && parentPhyActor != null) { handlingPart = parentPart; } } return handlingPart; }
public void startNewGame() { if (playSound) { sp.SoundLocation = "Resources/HDATE Main Theme.wav"; sp.PlayLooping(); } currentScene = Scenes.CharacterCreation; p1 = new Player(); hookUpInterface(); clearPlayArea(); screenArea.Children.Add(charCreation); }
void Start() { currScene = Scenes.Main; }
private void completeButton_Click(object sender, RoutedEventArgs e) { p1.AddItemToInventory(new Armor(Classes.Items.Type.Bronze, 0, "", "Bronze Armor")); if (p1.Strength > p1.Intelligence && p1.Strength > p1.Dexterity) p1.AddItemToInventory(new Weapon(Classes.Items.Type.Bronze, WeaponType.Sword, 0, "", "Bronze Sword")); else if(p1.Dexterity > p1.Strength && p1.Dexterity > p1.Intelligence) p1.AddItemToInventory(new Weapon(Classes.Items.Type.Bronze, WeaponType.Bow, 0, "", "Bronze Bow")); else if(p1.Intelligence > p1.Strength && p1.Intelligence > p1.Dexterity) p1.AddItemToInventory(new Weapon(Classes.Items.Type.Bronze, WeaponType.Staff, 0, "", "Bronze Staff")); else p1.AddItemToInventory(new Weapon(Classes.Items.Type.Bronze, WeaponType.Sword, 0, "", "Bronze Sword")); inGameScreen.charName.Content = p1.Name; currentScene = Scenes.Ingame; clearPlayArea(); generateMap(0); displayMap(); screenArea.Children.Add(inGameScreen); }