void OnGUI() { if (startText) { GUI.backgroundColor = Color.clear; Time.timeScale = 1.0F; if (GUI.Button(startRect, " ")) { mainCam.transform.position = floorCam.transform.position; startText = false; onMenu = false; LevelChange.setLevel(1); player.transform.position = spawn.transform.position; PlayerCharacter.setMaxHealth(10); PlayerCharacter.setHealth(10); PlayerCharacter.setAttack(2); PlayerCharacter.setDefense(0); } if (GUI.Button(exitRect, " ")) { Application.Quit(); } } }
public object PlayerLevelSet(LookupKey lookupKey, [FromBody] LevelChange change) { if (lookupKey.IsInvalid) { return(Request.CreateErrorResponse( HttpStatusCode.BadRequest, lookupKey.IsIdInvalid ? @"Invalid player id." : @"Invalid player name." )); } var(client, player) = Player.Fetch(lookupKey); if (player != null) { player.SetLevel(change.Level, true); if (player.Online) { PacketSender.SendEntityDataToProximity(player); } using (var context = DbInterface.CreatePlayerContext(false)) { context.Update(player); context.SaveChanges(); } return(player); } return(Request.CreateErrorResponse( HttpStatusCode.NotFound, lookupKey.HasId ? $@"No player with id '{lookupKey.Id}'." : $@"No player with name '{lookupKey.Name}'." )); }
private void SendLevelChange(LevelChange levelChange) { var outMessage = CreateLevelChangeMessage(levelChange); SendMessageToIds(GetReadyConnectionIds(), outMessage, MessageDeliveryMethod.ReliableOrdered, 2); _readyConnections.Clear(); }
private void OnLevelChange(LevelChange change) { var door = levelManager.LevelScript.Door; door.GetComponent <DoorController>().OnDoorInteract += OnDoorOpen; waveController.SetLevel(levelManager.LevelScript); }
private INetworkMessageOut CreateLevelChangeMessage(LevelChange levelChange) { var outMessage = CreateMessage(NetworkMessageType.ServerTravel); outMessage.Write(levelChange.NewGameState); outMessage.Write(levelChange.WorldBuilder); outMessage.Write(levelChange.LevelName); outMessage.Write(levelChange.Width); outMessage.Write(levelChange.Height); return(outMessage); }
//Takes in parameter the next scene, the color of the transition, and the transition time public static void Fade(int scene, Color col, float fadeTime) { GameObject init = new GameObject(); init.name = "LevelChange"; init.AddComponent <LevelChange>(); LevelChange scr = init.GetComponent <LevelChange>(); scr.fadeTime = fadeTime; scr.fadeScene = scene; scr.fadeColor = col; scr.start = true; }
// Update is called once per frame void Update() { if (guiBattle.wonBattle) { Camera.main.transform.position = statsCam.transform.position; points = maxPoints; textPoints = "" + points; health = "" + PlayerCharacter.getMaxHealth(); attack = "" + PlayerCharacter.getAttack(); defense = "" + PlayerCharacter.getDefense(); guiBattle.wonBattle = false; } if (points <= 0 && !MainScreen.onMenu) { Camera.main.transform.position = levels[LevelChange.getLevel() - 1].transform.position; } }
public Level(Hero hero, bool isTopLevel) { _tiles = new Dictionary<Location, Tile>(); _actors = new List<Actor>(); _items = new Dictionary<Location, Item>(); _walkables = new Dictionary<Location, Entity>(); _effectQueue = new LinkedList<EffectDescription>(); _actorLocations = new HashSet<Location>(); curActor = 0; upLevel = null; downLevel = null; levelChange = LevelChange.None; _isTopLevel = isTopLevel; _hero = hero; }
static void Change(UserGpio pin, LevelChange change, uint time) { if (change == LevelChange.LowToHigh) { lastHigh = time; } else if (change == LevelChange.HighToLow) { uint diff = time - lastHigh; if (diff >= TICKS_MIN_DCC_ONE && diff <= TICKS_MAX_DCC_ONE) { AddDidget(true); } else if (diff >= TICKS_MIN_DCC_ZERO && diff <= TICKS_MAX_DCC_ZERO) { AddDidget(false); } } }
public void ProcessElementalTick() { RoundTickCounter++; if (RoundTickCounter % 5 == 0) //only process every 5th round so we don't level up or down ever tick { LevelChange levelChange = GetLevelChange(); if (levelChange == LevelChange.Up) { if (Level < GlobalReference.GlobalValues.Settings.MaxLevel) { Level++; ResetStats(); RemoveEquipment(); FinishLoad(); ITranslationMessage translationMessage = new TranslationMessage($"The {KeyWords[0]} elemental grows stronger."); GlobalReference.GlobalValues.Notify.Room(this, null, Room, translationMessage, null, true); } } else if (levelChange == LevelChange.Down) { if (Level > 1) { Level--; ResetStats(); RemoveEquipment(); FinishLoad(); ITranslationMessage translationMessage = new TranslationMessage($"The {KeyWords[0]} elemental grows weaker."); GlobalReference.GlobalValues.Notify.Room(this, null, Room, translationMessage, null, true); } else { ITranslationMessage translationMessage = new TranslationMessage($"The {KeyWords[0]} elemental has grown so weak it can no longer hold its form in this realm and slowly fades away."); GlobalReference.GlobalValues.Notify.Room(this, null, Room, translationMessage, null, true); Room.RemoveMobileObjectFromRoom(this); } } } }
private LevelChange DrawPiratesAndCoins(TileLevel level, int levelIndex, int levelCount, Ship tileShip) { LevelChange levelChange = new LevelChange(); var pirates = level.Pirates; bool hasPirates = pirates != null && pirates.Count > 0; bool hasCoins = (tileShip != null && tileShip.Coins > 0) || level.Coins > 0; levelChange.hasPirates = hasPirates; levelChange.hasCoins = hasCoins; levelChange.Level = levelIndex; // draw pirates if (hasPirates) { DrawPirate pirate = new DrawPirate(); pirate.ForeColor = "white"; pirate.BackColor = GetTeamColor(pirates.First().TeamId); pirate.Text = pirates.Count().ToString(); levelChange.Pirate = pirate; } // draw coins if (hasCoins) { int coins = tileShip != null ? tileShip.Coins : level.Coins; DrawCoin coin = new DrawCoin(); coin.ForeColor = "black"; coin.BackColor = "gold"; coin.Text = coins.ToString(); levelChange.Coin = coin; } return(levelChange); }
// Start is called before the first frame update void Start() { gStatus = GetComponent <GameStatus>(); playerGun = GameObject.FindGameObjectWithTag("PlayerGun").GetComponent <Gun>(); EnemyObject = GameObject.FindGameObjectWithTag("Enemy"); EnemyScript = EnemyObject.GetComponent <TakeDamage>(); Star1_Image.color = EmpyStarColor; Star2_Image.color = EmpyStarColor; Star3_Image.color = EmpyStarColor; BlackScreenAnim = BlackScreen.GetComponent <Animator>(); timer = GetComponent <Timer>(); lvlChange = GameObject.FindGameObjectWithTag("GameManager").GetComponent <LevelChange>(); WinCount = 0; LoseCount = 0; nextLevelCheck = false; //RoundStart(); playerGun.StartRound(); BlackScreenAnim.Play("StartRound"); gameObject.GetComponent <AmmoCount>().Reset(); Gun.PlayerHealth = 100; Sıfırlama = false; }
public void changeLevel(LevelChange change) { if (change == LevelChange.Up && _isTopLevel) return; levelChange = change; if (levelChange == LevelChange.Down && downLevel == null) { downLevel = new Level(_hero, false); DungeonGenerator.generateDungeon(downLevel, 200, 200); downLevel.upLevel = this; } }
public static void ChangeLevel(Tuple <string, char[][]> level) { LevelChange?.Invoke(level); }
//難易度選択をinstantiateする void FCStart() { levelChangeObject = Instantiate(levelChangePrefab); levelChangeObject.transform.SetParent(this.transform); fChangeScript = levelChangeObject.GetComponent<LevelChange>(); fChangeScript.levelController = this; //メインカメラをノンアクにする GameScene gameScene = transform.root.gameObject.GetComponent<AppliController>().GetCurrentScene().GetComponent<GameScene>(); gameScene.mainCamera.transform.Rotate(new Vector3(0.0f, 0.0f, -lyingAngle),Space.Self); //gameScene.directionalLight.color = new Color(1.0f,1.0f,1.0f); //gameScene.gameController.gameObject.SetActive(false); gameScene.gameController.nodeController.gameObject.SetActive(false); gameScene.gameController.arrowControllerObject.SetActive(false); gameScene.gameController.frameControllerObject.SetActive(false); gameScene.gameUI.gameInfoCanvas.gameObject.SetActive(false); }
// used for game logic stuff void Update() { // reset angular velocity rigidbody.angularVelocity = Vector3.zero; FSM.Update(); if (Input.GetKeyUp(settings.KeyJump)) { JumpKeyReleased = true; } UpdateWhistling(); UpdateShouting(); UpdateShushing(); // Update control of voice input // Note that if both players are pressing, none gets voice control! if (Input.GetKey(settings.KeyPlayer1Input) && Input.GetKey(settings.KeyPlayer2Input)) { PlayerOneActive = PlayerTwoActive = false; BothPlayersActive = true; ConfusingSpawn.EnableSpawning(); } else if (Input.GetKey(settings.KeyPlayer1Input)) { PlayerOneActive = true; BothPlayersActive = false; ConfusingSpawn.DisableSpawning(); } else if (Input.GetKey(settings.KeyPlayer2Input)) { PlayerTwoActive = true; BothPlayersActive = false; ConfusingSpawn.DisableSpawning(); } else { PlayerOneActive = PlayerTwoActive = false; BothPlayersActive = false; ConfusingSpawn.DisableSpawning(); } if (PlayerOneActive) { meshRenderer.material.color = Color.blue; } else if (PlayerTwoActive) { meshRenderer.material.color = Color.red; } else { meshRenderer.material.color = Color.white; } // Check whether player wants to return to main menu if (Input.GetKey(KeyCode.Escape)) { LastCheckpoint = null; LevelChange.changeLevel(0); } }