/// <summary> /// Executes the day and night process /// </summary> public override void Execute() { try { if (PlusEnvironment.GetGame() == null) { return; } if (PlusEnvironment.GetGame().GetRoomManager() == null) { return; } if (PlusEnvironment.GetGame().GetRoomManager().GetRooms().Count <= 0) { return; } DayNightManager.SetTime(); } catch (Exception e) { Logging.LogRPTimersError("Error in Execute() void: " + e); base.EndTimer(); } }
/// <summary> /// Calls the specified callback at the first passing of the h/m/s specified in the scheduledExecutionTime. Once the first /// runtime passes, a new timer is created to execute the callback every 24 hours. /// </summary> private void StartTimers() { KillTimers(); int millisecondsToFirstExecution = (int)DayNightManager.GetDateIndependentTimeSpan(DateTime.Now, ScheduledExecutionTime).TotalMilliseconds; //If setting the schedule to a time of day that has already passed, calculate the time until its execution the following day if (millisecondsToFirstExecution < 0) { millisecondsToFirstExecution = dayMilliseconds + millisecondsToFirstExecution; } InitialRunTimer = Constants.CREATE_TIMER( () => { Application.Current.Dispatcher.Invoke(() => { Callback(); TaskTimer?.Stop(); TaskTimer = Constants.CREATE_TIMER(Callback, dayMilliseconds); TaskTimer.Start(); }); }, millisecondsToFirstExecution ); InitialRunTimer.AutoReset = false; }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Home") && !DayNightManager.GetDay()) { hasWon = true; winTransition = WINTRANSITIONTIME; } }
private void Awake() { if (Instance != null) { Destroy(gameObject); } else { Instance = this; } }
void Start() { DayNightManager.InitDay(); player = GameObject.FindGameObjectWithTag("Player"); deathByFall = false; stormHasStarted = false; currentStormTimer = initialStormTimer; stormImage = transform.Find("GameOverCanvas").GetComponentInChildren <Image>(); gameOverTextMesh = GameObject.FindGameObjectWithTag("GameOverText").GetComponent <TextMeshProUGUI>(); gameOverRestartTextMesh = GameObject.FindGameObjectWithTag("GameOverRestartText").GetComponent <TextMeshProUGUI>(); if (stormImage == null) { Debug.LogError("Storm sprite not attached to Storm object !"); } }
// Update is called once per frame void Update() { var targetX = Input.GetAxisRaw("Horizontal"); var targetY = Input.GetAxisRaw("Vertical"); Vector3 targetVelocity = new Vector2(targetX, targetY); targetVelocity.Normalize(); targetVelocity *= movementSpeed; rigidBody.velocity = Vector3.SmoothDamp(rigidBody.velocity, targetVelocity, ref velocity, smoothing); if (Input.GetKeyDown(KeyCode.N)) { DayNightManager.ChangeTime(); } if (Input.GetKeyDown(KeyCode.M)) { Debug.Log(DayNightManager.Time); } }
// Update is called once per frame void Update() { if (pictureHasStartedDisplaying) { if (!picturehasDisplayed) { currentPictureFadingTime -= Time.deltaTime; backgroundPictureSprite.color = new Color(1, 1, 1, 1 - currentPictureFadingTime / INITIALPICTUREFADINGINTIME); memoryPicture.color = new Color(1, 1, 1, 1 - currentPictureFadingTime / INITIALPICTUREFADINGINTIME); if (currentPictureFadingTime < 0) { GameObject.Find("PlayerAndCamera/UI/CompassBase").SetActive(false); picturehasDisplayed = true; } } else { if (Input.GetButtonDown("Pickup") && !pictureIsSkipped) { pictureIsSkipped = true; DayNightManager.SetDay(false); currentPictureFadingOutTime = INITIALPICTUREFADINGOUTTIME; } } if (pictureIsSkipped && !pictureHasFadedOut) { currentPictureFadingOutTime -= Time.deltaTime; backgroundPictureSprite.color = new Color(1, 1, 1, currentPictureFadingOutTime / INITIALPICTUREFADINGOUTTIME); memoryPicture.color = new Color(1, 1, 1, currentPictureFadingOutTime / INITIALPICTUREFADINGOUTTIME); if (currentPictureFadingOutTime < 0) { pictureHasFadedOut = true; player.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation; GetComponent <Storm>().StartStorm(); } } } }
// Update is called once per frame void Update() { if (hasWon) { Debug.Log(winTransition); winTransition -= Time.deltaTime; backgroundImage.color = new Color(1, 1, 1, 1 - winTransition / WINTRANSITIONTIME); if (winTransition < 0) { switch (SceneManager.GetActiveScene().name) { case "01_Level_TUTO": PlayerPrefs.SetFloat("Photo0", 1); SceneManager.LoadScene("MainMenu"); break; case "02_Level_Cliff": PlayerPrefs.SetFloat("Photo1", 1); SceneManager.LoadScene("MainMenu"); break; case "03_Level_Hole": PlayerPrefs.SetFloat("Photo2", 1); SceneManager.LoadScene("MainMenu"); break; case "04_Level_Final": PlayerPrefs.SetFloat("Photo3", 1); SceneManager.LoadScene("MainMenu"); break; default: SceneManager.LoadScene("MainMenu"); break; } } } // TODO : Remove if (Input.GetKeyDown("n")) { Debug.Log("Cheat code activated"); DayNightManager.SetDay(!DayNightManager.GetDay()); } if (Input.GetKeyDown("r")) { Debug.Log("Reloading level"); SceneManager.LoadScene(SceneManager.GetActiveScene().name); } GetComponentInChildren <InteractionCollider>().canInteract(DayNightManager.GetDay()); if (Input.GetButtonDown("Pickup") && !GetComponent <CharacterMovement>().IsJumping() && !storm.IsFalling()) { Queue <GameObject> items = new Queue <GameObject>(interactibles); if (items.Count > 0) { GameObject item = items.Dequeue(); if (item.CompareTag("Neon") && DayNightManager.GetDay()) { RemoveNeon(item); } if (item.CompareTag("Door") && DayNightManager.GetDay()) { item.GetComponentInParent <DoorManager>().Open(); interactibles.Remove(item); GameObject.Find("Frame").gameObject.SetActive(false); } if (item.CompareTag("Rift")) { Destroy(item); GameObject.FindGameObjectWithTag("Storm").GetComponent <PictureBehaviour>().StartAnimation(); } } } if (Input.GetButtonDown("PlaceObject") && !GetComponent <CharacterMovement>().IsJumping() && !storm.IsFalling() && DayNightManager.GetDay()) { if (currentNeonCount > 0) { PlaceNeon(); } } }
void Start() { disableManager = GameObject.FindGameObjectWithTag("DisableController").GetComponent <DisableManager> (); dayNightManager = GameObject.FindGameObjectWithTag("DayNightManager").GetComponent <DayNightManager> (); }
// Persistent (Singleton) /* void Awake () { if ( instance == null ) { instance = this; DontDestroyOnLoad ( gameObject ); } else { Destroy ( this ); } }*/ // Use this for initialization void Start() { KeyItems = new Dictionary<string,bool>(); m_audio = GetComponent<AudioManager> (); m_input = GetComponent<InputManager> (); m_daynight = GetComponent<DayNightManager> (); m_dialogue = GetComponent<DialogueSystem> (); KeyItems.Add ( "Backpack", true ); KeyItems.Add ( "Boat", true ); KeyItems.Add ( "Bow", true ); KeyItems.Add("wood", true); KeyItems.Add("rope", true); KeyItems.Add("hammer", true); KeyItems.Add ( "JournalPageBeach", true ); KeyItems.Add ( "JournalPageSeaCave", true ); KeyItems.Add ( "JournalPageDocks", true ); KeyItems.Add ( "JournalPagePlains", true); KeyItems.Add("watch", true); KeyItems.Add("glasses", true); KeyItems.Add("map", true); KeyItems.Add("photo", true); CurrentSceneIndex = 0; PreviousSceneIndex = -1; // On purpose for day night check m_audio.PlayLoop ( "main" ); // Start with main theme music locationTimestamps.Add ( "Main Menu - " + Time.time ); if (Application.loadedLevelName != "0_MainMenu") { m_Char = GameObject.FindGameObjectWithTag("Char").GetComponent<Character>(); } }
// Update is called once per frame void Update() { if (DayNightManager.IsDay()) { highlightMap.ClearAllTiles(); return; } if (Input.GetKeyDown(KeyCode.R)) { objectIndex = mod((objectIndex - 1), placeableObjects.Count); Debug.Log("Index of item: " + objectIndex); } if (Input.GetKeyDown(KeyCode.F)) { objectIndex = mod((objectIndex + 1), placeableObjects.Count); Debug.Log("Index of item: " + objectIndex); } if (Input.GetKeyDown(KeyCode.Q)) { rotation = mod(rotation + 90, 360); Debug.Log("Rotation increased: " + rotation); } if (Input.GetKeyDown(KeyCode.E)) { rotation = mod(rotation - 90, 360); Debug.Log("Rotation decreased: " + rotation); } if (Input.GetMouseButtonDown(1)) { Vector3Int negativePos = objectMap.WorldToCell(Camera.main.ScreenToWorldPoint(Input.mousePosition)); Vector3Int intPos = new Vector3Int(negativePos.x + worldWidth / 2, negativePos.y + worldHeight / 2, 0); if (abstractFactories[intPos.x, intPos.y] != null) { Destroy(abstractFactories[intPos.x, intPos.y].gameObject); abstractFactories[intPos.x, intPos.y] = null; } } if (Input.GetMouseButtonDown(0)) { Vector3Int negativePos = objectMap.WorldToCell(Camera.main.ScreenToWorldPoint(Input.mousePosition)); Vector3Int intPos = new Vector3Int(negativePos.x + worldWidth / 2, negativePos.y + worldHeight / 2, 0); if (abstractFactories[intPos.x, intPos.y] == null) { Vector3 pos = objectMap.CellToWorld(negativePos); Vector3 worldPos = new Vector3(pos.x + 0.4f, pos.y + 0.4f, pos.z); GameObject go = Instantiate(placeableObjects[objectIndex], worldPos, Quaternion.Euler(new Vector3(0, 0, 0))); AbstractFactoryObject abstractFactoryObject = go.GetComponent <AbstractFactoryObject>(); abstractFactories[intPos.x, intPos.y] = abstractFactoryObject; if (rotation == 0) { abstractFactoryObject.setDirection(AbstractFactoryObject.DIRECTION.SOUTH); } else if (rotation == 90) { abstractFactoryObject.setDirection(AbstractFactoryObject.DIRECTION.WEST); } else if (rotation == 180) { abstractFactoryObject.setDirection(AbstractFactoryObject.DIRECTION.NORTH); } else if (rotation == 270) { abstractFactoryObject.setDirection(AbstractFactoryObject.DIRECTION.EAST); } else { Debug.LogError("This should not be happening. If happening consult consultant functional ab"); } if (intPos.x > 0 && intPos.x < worldWidth) { if (abstractFactories[intPos.x - 1, intPos.y] != null && abstractFactories[intPos.x - 1, intPos.y].currentDirection == AbstractFactoryObject.DIRECTION.EAST) { abstractFactories[intPos.x - 1, intPos.y].nextConveyor = abstractFactoryObject; Debug.Log("nextConveyour set!"); } if (abstractFactories[intPos.x + 1, intPos.y] != null && abstractFactories[intPos.x + 1, intPos.y].currentDirection == AbstractFactoryObject.DIRECTION.WEST) { abstractFactories[intPos.x + 1, intPos.y].nextConveyor = abstractFactoryObject; Debug.Log("nextConveyour set!"); } } if (intPos.y > 0 && intPos.y < worldHeight) { if (abstractFactories[intPos.x, intPos.y + 1] != null && abstractFactories[intPos.x, intPos.y + 1].currentDirection == AbstractFactoryObject.DIRECTION.SOUTH) { abstractFactories[intPos.x, intPos.y + 1].nextConveyor = abstractFactoryObject; Debug.Log("nextConveyour set!"); } if (abstractFactories[intPos.x, intPos.y - 1] != null && abstractFactories[intPos.x, intPos.y - 1].currentDirection == AbstractFactoryObject.DIRECTION.NORTH) { abstractFactories[intPos.x, intPos.y - 1].nextConveyor = abstractFactoryObject; Debug.Log("nextConveyour set!"); } } } } Vector3Int tilemapPos = objectMap.WorldToCell(Camera.main.ScreenToWorldPoint(Input.mousePosition)); Vector3Int highlightIntPos = new Vector3Int(tilemapPos.x + worldWidth / 2, tilemapPos.y + worldHeight / 2, 0); if (tilemapPos.x + worldWidth / 2 >= 0 && tilemapPos.x + worldWidth / 2 <= worldWidth && tilemapPos.y + worldHeight / 2 >= 0 && tilemapPos.y + worldHeight / 2 <= worldHeight) { HighlightTile(tilemapPos); } else { highlightMap.ClearAllTiles(); } }
// Use this for initialization void Start() { GameObject[] wpObjs = GameObject.FindGameObjectsWithTag("waypoint"); m_Waypoints = new Vector3[wpObjs.Length]; for(int i=0; i<wpObjs.Length; i++){ m_Waypoints[i] = wpObjs[i].GetComponent<Transform>().position; } if(specialWaypoint != null){ specialLoc = specialWaypoint.GetComponent<Transform>().position; } m_Char = GameObject.FindGameObjectWithTag("Char"); //spawn the bird wherever you want and it will fly to an arbirary waypoint m_State = BirdState.Moving; //move the bird to an arbitrary waypoint curWaypoint = transform.position; nextWaypoint = m_Waypoints[(Random.Range(0, m_Waypoints.Length))]; moveTime = Time.time; journeyLength = Vector3.Distance(curWaypoint, nextWaypoint); daynight = GameObject.FindGameObjectWithTag("Manager").GetComponent<DayNightManager>(); mAudio = GameObject.FindGameObjectWithTag ( "Manager" ).GetComponent<AudioManager> (); mAnimator = GetComponent<Animator>(); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().GetMessenger() == null) { return; } if (!RoleplayManager.FollowFriends) { Session.SendWhisper("Opa, o gerenciamento do servidor desativou a capacidade de seguir seus amigos.", 1); return; } int BuddyId = Packet.PopInt(); bool IsVip = Session.GetHabbo().VIPRank < 1 ? false : true; int Cost = IsVip ? 0 : 3; int Time = IsVip ? (5 + DayNightManager.GetTaxiTime()) : (10 + DayNightManager.GetTaxiTime()); string TaxiText = IsVip ? " VIP" : ""; bool OnDuty = false; if (BuddyId == 0 || BuddyId == Session.GetHabbo().Id) { return; } GameClient Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(BuddyId); if (Client == null || Client.GetHabbo() == null) { return; } if (!Client.GetHabbo().InRoom) { Session.SendMessage(new FollowFriendFailedComposer(2)); Session.GetHabbo().GetMessenger().UpdateFriend(Client.GetHabbo().Id, Client, true); return; } else if (Session.GetHabbo().CurrentRoom != null && Client.GetHabbo().CurrentRoom != null) { if (Session.GetHabbo().CurrentRoom.RoomId == Client.GetHabbo().CurrentRoom.RoomId) { return; } } if (!Client.GetHabbo().AllowConsoleMessages) { if (Session.GetHabbo().InRoom) { Session.SendWhisper("Desculpe, mas esse cidadão desligou o telefone, então você não pode segui-lo.", 1); } else { Session.SendNotification("Desculpe, mas esse cidadão desligou o telefone, então você não pode segui-lo."); } return; } if (Session.GetRoleplay().IsDead) { Session.SendWhisper("Você não pode seguir seu amigo enquanto está morto!", 1); return; } if (Session.GetRoleplay().IsJailed) { Session.SendWhisper("Você não pode seguir seu amigo enquanto está preso!", 1); return; } if (Session.GetRoomUser() != null) { if (Session.GetRoomUser().Frozen) { Session.SendWhisper("Você não pode seguir seu amigo enquanto está congelado ou atordoado!", 1); return; } } if (Session.GetHabbo().GetPermissions().HasRight("mod_tool") && Session.GetRoleplay().StaffOnDuty) { OnDuty = true; } if (Session.GetHabbo().VIPRank > 1) { OnDuty = true; } if (Session.GetHabbo().CurrentRoom != null) { if (!Session.GetHabbo().CurrentRoom.TaxiFromEnabled&& !OnDuty) { Session.SendWhisper("[RPG Taxi] Desculpe, não podemos levá-lo para fora deste quarto!", 1); return; } } if (Session.GetRoleplay().Cuffed) { Session.SendWhisper("Os motoristas de taxi estão muito assustados para levá-lo com as algemas presas em você!", 1); return; } bool PoliceCost = false; if (HabboHotel.Groups.GroupManager.HasJobCommand(Session, "guide") && Session.GetRoleplay().IsWorking) { PoliceCost = true; } if (Session.GetHabbo().Credits < Cost && Cost > 0 && !OnDuty && !PoliceCost) { Session.SendWhisper("[RPG Taxi] Você não tem dinheiro suficiente para dar uma volta!", 1); return; } if (Session.GetRoleplay().InsideTaxi) { Session.SendWhisper("[RPG Taxi] Já estou indo te buscar! Digite ':ptaxi' se mudar de ideia!", 1); return; } RoomData roomData = PlusEnvironment.GetGame().GetRoomManager().GenerateRoomData(Client.GetHabbo().CurrentRoomId); if (roomData == null) { Session.SendWhisper("[RPG Taxi] Desculpe, não conseguimos encontrar esse quarto!", 1); return; } if (!roomData.TaxiToEnabled && !OnDuty) { Session.SendWhisper("[RPG Taxi] Desculpe, não podemos táxi você para este quarto!", 1); return; } if (roomData.TutorialEnabled && !OnDuty) { Session.SendWhisper("Você não pode ir para uma sala de tutorial, desculpe!", 1); return; } if (Session.GetHabbo().CurrentRoom != null) { if (Session.GetHabbo().CurrentRoom.TutorialEnabled&& !OnDuty) { Session.SendWhisper("Você não pode sair de uma sala de tutorial! Somente após concluir!", 1); return; } } if (Session.GetRoleplay().Game != null) { Session.SendWhisper("Você não pode pegar um taxi enquanto está dentro de um evento!", 1); return; } if (Session.GetRoleplay().TexasHoldEmPlayer > 0) { Session.SendWhisper("Você não pode pegar um taxi no meio de um jogo de Texas Hold!", 1); return; } Session.GetRoleplay().InsideTaxi = true; bool PoliceTaxi = false; if (!OnDuty) { if (HabboHotel.Groups.GroupManager.HasJobCommand(Session, "guide") && Session.GetRoleplay().IsWorking) { Cost = 0; Time = 5; if (Session.GetRoomUser() != null) { Session.GetRoomUser().ApplyEffect(597); } Session.Shout("*Puxa o rádio da Polícia e vai rapidamente para " + roomData.Name + " [ID: " + roomData.Id + "]*", 37); PoliceTaxi = true; } else { if (Session.GetRoomUser() != null) { Session.GetRoomUser().ApplyEffect(596); } Session.Shout("*Chama um Taxi" + TaxiText + " para " + roomData.Name + " [ID: " + roomData.Id + "]*", 4); } new Thread(() => { for (int i = 0; i < (Time + 1) * 10; i++) { if (Session.GetRoleplay() == null) { break; } if (Session.GetRoleplay().InsideTaxi) { Thread.Sleep(100); } else { break; } } if (Session.GetRoleplay() != null) { if (Session.GetRoleplay().InsideTaxi) { if (Cost > 0) { Session.GetHabbo().Credits -= Cost; Session.GetHabbo().UpdateCreditsBalance(); } if (PoliceTaxi) { if (Session.GetRoomUser() != null) { Session.GetRoomUser().ApplyEffect(EffectsList.CarPolice); } Session.Shout("*Pula dentro do carro da polícia do meu parceiro e vai para o local*", 37); } else { Session.Shout("*Pula no meu Taxi" + TaxiText + " e vai para o local*", 4); } RoleplayManager.SendUser(Session, roomData.Id); } } }).Start(); } else { Session.Shout("*Segue imediatamente " + Client.GetHabbo().Username + "*", 23); RoleplayManager.SendUser(Session, Client.GetHabbo().CurrentRoomId); PlusEnvironment.GetGame().GetChatManager().GetCommands().LogCommand(Session.GetHabbo().Id, "follow " + Client.GetHabbo().Username, Session.GetHabbo().MachineId, "staff"); } }
// Use this for initialization void Start() { _daynightuiImage = gameObject.GetComponent <Image>(); _daynightmanager = FindObjectOfType <DayNightManager>(); clock = gameObject.GetComponentInChildren <Text>(); }
public void Parse(HabboHotel.GameClients.GameClient Session, ClientPacket Packet) { int roomID = Packet.PopInt(); bool IsVip = Session.GetHabbo().VIPRank < 1 ? false : true; int Cost = IsVip ? 0 : 3; int Time = IsVip ? (5 + DayNightManager.GetTaxiTime()) : (10 + DayNightManager.GetTaxiTime()); string TaxiText = IsVip ? " VIP" : ""; bool RoomLoaded = false; bool OnDuty = false; if (Session.GetHabbo().GetPermissions().HasRight("mod_tool") && Session.GetRoleplay().StaffOnDuty) { OnDuty = true; } if (Session.GetHabbo().VIPRank > 1) { OnDuty = true; } #region Conditions if (Session.GetRoleplay().IsJailed || Session.GetRoleplay().IsDead) { return; } if (Session.GetRoleplay().Cuffed) { Session.SendWhisper("Os taxistas não querem levar você, pois estão com medo de você algemado!", 1); return; } if (Session.GetRoomUser() != null) { if (Session.GetRoomUser().Frozen) { Session.SendWhisper("Você não pode pegar um taxi enquanto está atordoado!", 1); return; } } #endregion RoomData roomData = PlusEnvironment.GetGame().GetRoomManager().GenerateRoomData(roomID); if (roomData == null) { return; } if (RoomLoaded) { return; } if (roomData.TutorialEnabled && !OnDuty) { Session.SendWhisper("[RPG Taxi] Você não pode ir para uma sala de Tutorial!", 1); return; } if (Session.GetRoomUser() != null && Session.GetRoomUser().GetRoom() != null) { if (Session.GetRoomUser().GetRoom().TutorialEnabled&& !OnDuty) { Session.SendWhisper("[RPG Taxi] Você não pode usar taxi em uma sala de tutorial, termine ele primeiro!", 1); return; } if (!Session.GetRoomUser().GetRoom().TaxiFromEnabled&& !OnDuty) { Session.SendWhisper("[RPG Taxi] Desculpe, não podemos pegar você neste quarto!", 1); return; } } if (roomID != Session.GetHabbo().CurrentRoomId) { if (Session.GetRoleplay().Game != null) { Session.SendWhisper("Você não pode pegar um texi no evento!", 1); return; } bool PoliceCost = false; if (HabboHotel.Groups.GroupManager.HasJobCommand(Session, "guide") && Session.GetRoleplay().IsWorking) { PoliceCost = true; } if (Session.GetHabbo().Credits < Cost && Cost > 0 && !OnDuty && !PoliceCost) { Session.SendWhisper("[RPG Taxi] Você não tem dinheiro suficiente para dar uma volta!", 1); return; } if (Session.GetRoleplay().InsideTaxi) { Session.SendWhisper("[RPG Taxi] Já estou indo pegar você! Digite ':ptaxi' se mudar de ideia!", 1); return; } bool PoliceTool = false; if (Session.GetRoleplay().GuideOtherUser != null) { if (HabboHotel.Groups.GroupManager.HasJobCommand(Session, "guide")) { if (Session.GetRoleplay().GuideOtherUser.GetHabbo() != null && Session.GetRoleplay().GuideOtherUser.GetRoomUser() != null) { if (roomID == Session.GetRoleplay().GuideOtherUser.GetRoomUser().RoomId) { PoliceTool = true; } } } } if (!roomData.TaxiToEnabled && !OnDuty && !PoliceTool) { Session.SendWhisper("[RPG Taxi] Desculpe, não podemos buscar você neste quarto!", 1); return; } bool Event = false; if (roomData.RoleplayEvent != null) { if (!roomData.RoleplayEvent.HasGameStarted()) { Event = true; } } Session.GetRoleplay().InsideTaxi = true; bool PoliceTaxi = false; if (!OnDuty && !PoliceTool && Session.GetHabbo().CurrentRoomId > 0 && !Event) { if (HabboHotel.Groups.GroupManager.HasJobCommand(Session, "guide") && Session.GetRoleplay().IsWorking) { Cost = 0; Time = 5; if (Session.GetRoomUser() != null) { Session.GetRoomUser().ApplyEffect(EffectsList.PoliceTaxi); } Session.Shout("*Puxa o rádio da Polícia e vai rapidamente para " + roomData.Name + " [ID: " + roomID + "]*", 37); PoliceTaxi = true; } else { if (Session.GetRoomUser() != null) { Session.GetRoomUser().ApplyEffect(EffectsList.Taxi); } Session.Shout("*Chama um Taxi" + TaxiText + " por " + roomData.Name + " [ID: " + roomID + "]*", 4); } new Thread(() => { for (int i = 0; i < (Time + 1) * 10; i++) { if (Session.GetRoleplay() == null) { break; } if (Session.GetRoleplay().InsideTaxi) { Thread.Sleep(100); } else { break; } } if (Session.GetRoleplay() != null) { if (Session.GetRoleplay().InsideTaxi) { if (Cost > 0) { Session.GetHabbo().Credits -= Cost; Session.GetHabbo().UpdateCreditsBalance(); } if (PoliceTaxi) { if (Session.GetRoomUser() != null) { Session.GetRoomUser().ApplyEffect(EffectsList.CarPolice); } Session.Shout("*Entra no meu carro de polícia e vai para o local*", 37); } else { Session.Shout("*Pula dentro do meu Taxi" + TaxiText + " e vai rapidamente para o local*", 4); } RoleplayManager.SendUser(Session, roomData.Id); } } }).Start(); } else { if (PoliceTool) { if (Session.GetRoomUser() != null) { Session.GetRoomUser().ApplyEffect(EffectsList.CarPolice); } Session.Shout("*Entra no meu carro de polícia e dirige para ajudar um cidadão em necessidade*", 4); } else if (OnDuty) { Session.Shout("*Pula dentro do meu Carro Staff*", 23); } RoleplayManager.SendUser(Session, roomData.Id); } } else { Session.SendMessage(new GetGuestRoomResultComposer(Session, roomData, true, false)); } }
private void Awake() { Instance = this; }
public void Execute(GameClients.GameClient Session, Rooms.Room Room, string[] Params) { UInt32 RoomId = 0; bool IsVip = Session.GetHabbo().VIPRank < 1 ? false : true; int Cost = IsVip ? 0 : 3; int Time = IsVip ? (5 + DayNightManager.GetTaxiTime()) : (10 + DayNightManager.GetTaxiTime()); string TaxiText = IsVip ? "[Uber]" : ""; bool OnDuty = false; if (Params.Length == 1) { Session.SendWhisper("Opa, você esqueceu de inserir um ID de Quarto!", 1); return; } if (!UInt32.TryParse(Params[1].ToString(), out RoomId)) { Session.SendWhisper("Por favor insira um número válido.", 1); return; } if (Session.GetRoleplay().IsDead) { Session.SendWhisper("Você não pode táxi enquanto está morto!", 1); return; } if (Session.GetRoleplay().IsJailed) { Session.SendWhisper("Você não pode táxi enquanto está preso!", 1); return; } if (Session.GetRoomUser() != null) { if (Session.GetRoomUser().Frozen) { Session.SendWhisper("Você não pode táxi enquanto está congelado ou atordoado!", 1); return; } } if (Session.GetHabbo().GetPermissions().HasRight("mod_tool") && Session.GetRoleplay().StaffOnDuty) { OnDuty = true; } if (Session.GetHabbo().VIPRank > 1) { OnDuty = true; } if (!Room.TaxiFromEnabled && !OnDuty) { Session.SendWhisper("[RPG TAXI]Desculpe, não podemos levá-lo fora deste quarto!", 1); return; } if (Session.GetRoleplay().Cuffed) { Session.SendWhisper("Os motoristas de táxi estão muito assustados para levá-lo com essas algemas presas a você!", 1); return; } if (RoomId == Session.GetHabbo().CurrentRoomId) { Session.SendWhisper("Você já está nesta sala!", 1); return; } bool PoliceCost = false; if (HabboHotel.Groups.GroupManager.HasJobCommand(Session, "guide") && Session.GetRoleplay().IsWorking) { PoliceCost = true; } if (Session.GetHabbo().Credits < Cost && Cost > 0 && !OnDuty && !PoliceCost) { Session.SendWhisper("[RPG TAXI] Você não tem dinheiro suficiente para dar uma volta!", 1); return; } if (Session.GetRoleplay().InsideTaxi) { Session.SendWhisper("[RPG TAXI] Já estou indo te pegar! Digite ':ptaxi' se você mudar de ideia!", 1); return; } RoomData roomData = PlusEnvironment.GetGame().GetRoomManager().GenerateRoomData(Convert.ToInt32(RoomId)); if (roomData == null) { Session.SendWhisper("[RPG TAXI] Desculpe, não conseguimos encontrar esse quarto!", 1); return; } if (!roomData.TaxiToEnabled && !OnDuty) { Session.SendWhisper("[RPG TAXI] Desculpe, não podemos levá-lo para este quarto!", 1); return; } if (roomData.TutorialEnabled && !OnDuty) { Session.SendWhisper("Você não pode pegar taxi em uma sala de tutorial, desculpe!", 1); return; } if (Session.GetHabbo().CurrentRoom != null) { if (Session.GetHabbo().CurrentRoom.TutorialEnabled&& !OnDuty) { Session.SendWhisper("Você não pode pegar um taxi na sala de Tutorial! Conclua o tutorial para sair.", 1); return; } } if (Session.GetRoleplay().Game != null) { Session.SendWhisper("Você não pode taxi enquanto está dentro de um evento!", 1); return; } if (Session.GetRoleplay().TexasHoldEmPlayer > 0) { Session.SendWhisper("Você não pode táxi enquanto está dentro de um evento", 1); return; } Session.GetRoleplay().InsideTaxi = true; bool PoliceTaxi = false; if (!OnDuty) { if (HabboHotel.Groups.GroupManager.HasJobCommand(Session, "guide") && Session.GetRoleplay().IsWorking) { Cost = 0; Time = 5; if (Session.GetRoomUser() != null) { Session.GetRoomUser().ApplyEffect(597); } Session.Shout("*Entra no seu carro de Polícia e vai rapidamente para o " + roomData.Name + " [ID: " + RoomId + "]*", 37); PoliceTaxi = true; } else { if (Session.GetRoomUser() != null) { Session.GetRoomUser().ApplyEffect(596); } Session.Shout("*Pega um Taxi " + TaxiText + " para " + roomData.Name + " [ID: " + RoomId + "]*", 4); } new Thread(() => { for (int i = 0; i < (Time + 1) * 10; i++) { if (Session.GetRoleplay() == null) { break; } if (Session.GetRoleplay().InsideTaxi) { Thread.Sleep(100); } else { break; } } if (Session.GetRoleplay() != null) { if (Session.GetRoleplay().InsideTaxi) { if (Cost > 0) { Session.GetHabbo().Credits -= Cost; Session.GetHabbo().UpdateCreditsBalance(); } if (PoliceTaxi) { if (Session.GetRoomUser() != null) { Session.GetRoomUser().ApplyEffect(EffectsList.CarPolice); } Session.Shout("*Pula dentro do carro da polícia de seu parceiro e vai para o local*", 37); } else { Session.Shout("*Pula dentro do seu " + TaxiText + " Taxi e vai para o local*", 4); } RoleplayManager.SendUser(Session, roomData.Id); } } }).Start(); } else { Session.Shout("*Pula no seu Carro Staff e vai para " + roomData.Name + " [ID: " + RoomId + "]*", 23); RoleplayManager.SendUser(Session, roomData.Id); } }
void Update() { if (!stormHasStarted && deathByFall) { fallingTimer -= Time.deltaTime; float newScale = fallingTimer / INITIALFALLINGTIMER; player.transform.localScale = new Vector3(newScale, newScale, newScale); if (fallingTimer < 0) { stormHasStarted = true; } } if (currentStormTimer > 0 && stormHasStarted) { if (!deathByFall) { currentStormTimer -= Time.deltaTime; } else { currentStormTimer -= Time.deltaTime * (initialStormTimer / 4); } if (currentStormTimer < initialStormTimer / 2) { stormImage.color = new Color(deathByFall ? 0 : 1, deathByFall ? 0 : 1, deathByFall ? 0 : 1, 1 - currentStormTimer / (initialStormTimer / 10)); } } else if (!runningOutOfTime && stormHasStarted) { runningOutOfTime = true; TriggerGameOver(); } if (runningOutOfTime && !gameOverIsDisplayed) { if (gameOverIsFadingIn) { currentGameOverApparitionTimer -= Time.deltaTime; Color gameOverTextColor = gameOverTextMesh.color; gameOverTextMesh.color = new Color(gameOverTextColor.r, gameOverTextColor.g, gameOverTextColor.b, 1 - currentGameOverApparitionTimer / INITIALGAMEOVERAPPARITIONTIMER); if (currentGameOverApparitionTimer < 0) { gameOverIsDisplayed = true; } } else { currentGameOverWaitTimer -= Time.deltaTime; if (currentGameOverWaitTimer < 0) { gameOverIsFadingIn = true; } } } if (gameOverIsDisplayed && !gameOverRestartIsDisplayed) { if (gameOverRestartIsFadingIn) { currentGamerOverRestartApparitionTimer -= Time.deltaTime; Color gameOverTextColor = gameOverTextMesh.color; gameOverRestartTextMesh.color = new Color(gameOverTextColor.r, gameOverTextColor.g, gameOverTextColor.b, 1 - currentGamerOverRestartApparitionTimer / INITIALGAMEOVERRESTARTAPPARITIONTIMER); if (currentGamerOverRestartApparitionTimer < 0) { gameOverRestartIsDisplayed = true; } } else { currentGamerOverRestartWaitTimer -= Time.deltaTime; if (currentGamerOverRestartWaitTimer < 0) { gameOverRestartIsFadingIn = true; } } } if (gameOverIsFadingIn && Input.GetButtonDown("Pickup")) { // TODO : Replace the scene loading with the correct behaviour to restart the night deathByFall = false; player.transform.localScale = new Vector3(1, 1, 1); player.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation; if (DayNightManager.GetDay()) { Scene scene = SceneManager.GetActiveScene(); SceneManager.LoadScene(scene.name); } else { player.transform.position = GetComponent <PictureBehaviour>().GetPlayerNightInitialPosition(); stormHasStarted = false; runningOutOfTime = false; currentStormTimer = initialStormTimer; gameOverIsFadingIn = false; gameOverIsDisplayed = false; gameOverRestartIsFadingIn = false; gameOverRestartIsDisplayed = false; stormImage.color = new Color(1f, 1f, 1f, 0f); Color gameOverTextColor = gameOverTextMesh.color; gameOverTextMesh.color = new Color(gameOverTextColor.r, gameOverTextColor.g, gameOverTextColor.b, 0); gameOverRestartTextMesh.color = new Color(gameOverTextColor.r, gameOverTextColor.g, gameOverTextColor.b, 0); DayNightManager.ChangeCycle(); StartStorm(); } } }
public Slider timeSlider; // assign in inspector // Use this for initialization void Awake() { // instance = GetComponent<DayNightManager>(); instance = this; }