//use this for initialization void Start() { bubble = GetComponent<TextBubble>(); //Calculate the X and Y offsets to center the speech balloon exactly on the center of the game object centerOffsetX = bubbleWidth/2; centerOffsetY = bubbleHeight/2; }
void Start() { _reminderTime = reminderTime; player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); controller = GameObject.FindGameObjectWithTag("Player").GetComponent <GameController>(); bubble = GameObject.FindGameObjectWithTag("Player").GetComponent <TextBubble>(); }
public override DebrisObject Drop(PlayerController player) { DebrisObject droppedSelf = base.Drop(player); TextBubble.DoAmbientTalk(droppedSelf.transform, new Vector3(0.5f, 2, 0), BraveUtility.RandomElement(DropDialogue), 2f); return(droppedSelf); }
public void ReactToRuntimeSpawnedChest(Chest chest) { string contentsComment = null; int type = GetChestType(chest); if (type == 0) { contentsComment = "That chest definitely has a gun in it!"; } else if (type == 1) { contentsComment = "That chest contains a passive item, I think."; } else if (type == 2) { contentsComment = "That chest contains an active item!"; } else if (type == -1) { contentsComment = "That chest doesn't seem to contain... any items at all?"; } else if (type == -2 && !GameStatsManager.Instance.IsRainbowRun) { contentsComment = "Oooh! A Rainbow Chest! Lucky you!"; } if (!string.IsNullOrEmpty(contentsComment)) { TextBubble.DoAmbientTalk(base.transform, new Vector3(0.5f, 2, 0), contentsComment, 1.5f); } }
private void Awake() { if (textBubble == null) { textBubble = GetComponentInChildren <TextBubble>(); } }
/// <summary> /// Processes a new piece of text. Basically the latest text we add will appear /// at the bottom of the screen, while the older text will "float" to the /// top of the screen. /// </summary> public void ProcessText(Text newText, int actorPosition, string actorName) { TextBubble newTextToAdd; if (newText == null) { newTextToAdd = null; } else // If the text happens to be not empty... { Image toAdd = Instantiate(_textBubbleImage) as Image; // If the actor is on the right, then we invert the textbubble. if (actorPosition % 2 != 0) { toAdd.transform.localEulerAngles = new Vector3(0, 180, 0); } newTextToAdd = new TextBubble(toAdd, newText, _newTextPosition, _oldTextPosition); // Record everything into the log. _logButtonManager.Record(newText.text, actorName); } if (activeTextBubbles[1] != null) { activeTextBubbles[1].Delete(); } activeTextBubbles[1] = null; if (activeTextBubbles[0] != null) { activeTextBubbles[0].Rise(); } activeTextBubbles[1] = activeTextBubbles[0]; activeTextBubbles[0] = newTextToAdd; }
public void ReactToSpawnedPedestal(RewardPedestal pedestal) { if (pedestal.IsMimic) { TextBubble.DoAmbientTalk(base.transform, new Vector3(0.5f, 2, 0), "Be careful... that pedestal's breathing!", 2.5f); } }
public static void OnLevelLoaded() { if (CurrentChallenge != ChallengeType.NONE) { //ETGModConsole.Log("Challenge was not null!"); PlayerController player1 = GameManager.Instance.PrimaryPlayer; if (player1 == null) { ETGModConsole.Log("ERRA PLAYA NULLA"); } PlayerController player2 = null; if (GameManager.Instance.SecondaryPlayer != null) { player2 = GameManager.Instance.SecondaryPlayer; } if (GameStatsManager.Instance.IsRainbowRun) { ETGModConsole.Log("<color=#ff0000ff>Challenge Voided: Played Rainbow Run</color>", false); TextBubble.DoAmbientTalk(player1.transform, new Vector3(1, 2, 0), "Challenge Voided: Played Rainbow Run", 4f); CurrentChallenge = ChallengeType.NONE; } else if (player1.CharacterUsesRandomGuns || (player2 && player2.CharacterUsesRandomGuns)) { ETGModConsole.Log("<color=#ff0000ff>Challenge Voided: Played Blessed Run</color>", false); CurrentChallenge = ChallengeType.NONE; TextBubble.DoAmbientTalk(player1.transform, new Vector3(1, 2, 0), "Challenge Voided: Played Blessed Run", 4f); } else if (player1.characterIdentity == PlayableCharacters.Gunslinger || (player2 && player2.characterIdentity == PlayableCharacters.Gunslinger)) { ETGModConsole.Log("<color=#ff0000ff>Challenge Voided: Played as Gunslinger</color>", false); CurrentChallenge = ChallengeType.NONE; TextBubble.DoAmbientTalk(player1.transform, new Vector3(1, 2, 0), "Challenge Voided: Played as Gunslinger", 4f); } else if (player1.characterIdentity == PlayableCharacters.Eevee || (player2 && player2.characterIdentity == PlayableCharacters.Eevee)) { ETGModConsole.Log("<color=#ff0000ff>Challenge Voided: Played as Paradox</color>", false); CurrentChallenge = ChallengeType.NONE; TextBubble.DoAmbientTalk(player1.transform, new Vector3(1, 2, 0), "Challenge Voided: Played as Paradox", 4f); } else if (GameManager.Instance.CurrentGameMode == GameManager.GameMode.SHORTCUT) { ETGModConsole.Log("<color=#ff0000ff>Challenge Voided: Took a Shortcut</color>", false); CurrentChallenge = ChallengeType.NONE; TextBubble.DoAmbientTalk(player1.transform, new Vector3(1, 2, 0), "Challenge Voided: Took a Shortcut", 4f); } else if (GameManager.Instance.CurrentGameMode == GameManager.GameMode.BOSSRUSH) { ETGModConsole.Log("<color=#ff0000ff>Challenge Voided: Entered Bossrush</color>", false); CurrentChallenge = ChallengeType.NONE; TextBubble.DoAmbientTalk(player1.transform, new Vector3(1, 2, 0), "Challenge Voided: Entered Bossrush", 4f); } else if (GameManager.Instance.InTutorial) { ETGModConsole.Log("<color=#ff0000ff>Challenge Voided: Entered Tutorial</color>", false); CurrentChallenge = ChallengeType.NONE; TextBubble.DoAmbientTalk(player1.transform, new Vector3(1, 2, 0), "Challenge Voided: Entered Tutorial", 4f); } } }
public void GenerateText(string text, TextBubble.Alignment align) { TextBubble tb = GameObjectPoolManager.Instance.PoolDict[GameObjectPoolManager.PrefabNames.TextBubble].AllocateGameObject <TextBubble>(TextContainer); tb.Init(text, align); TextBubbles.Add(tb); ScrollView.ScrollToBottom(); }
/* * public TextBubble smGreenBubble; * public TextBubble lgGreenBubble; * public TextBubble smBlueBubble; * public TextBubble lgBlueBubble; */ void SpawnBubble(BubbleColors color, string message) { numberOfBubbles++; TextBubble bubble = null; bool isGreen = false; int characterCount = message.Length; if (characterCount <= smallBubbleLimit) { if (color == BubbleColors.BLUE) { isGreen = false; bubble = smBlueBubble; //bubble = Instantiate(smBlueBubble); } else if (color == BubbleColors.GREEN) { isGreen = true; bubble = smGreenBubble; //bubble = Instantiate(smGreenBubble); } else { Debug.LogError("Yo you don't have the right color some how. Way to go."); } } else if (characterCount <= largeBubbleLimit) { if (color == BubbleColors.BLUE) { isGreen = false; bubble = lgBlueBubble; // bubble = Instantiate(lgBlueBubble); } else if (color == BubbleColors.GREEN) { isGreen = false; bubble = lgGreenBubble; //bubble = Instantiate(lgGreenBubble); } else { Debug.LogError("Yo you don't have the right color some how. Way to go."); } } else { Debug.LogError("The string entered is too long."); } //bubble.transform.parent = targetCanvas.transform; TextManager.Instance.SpawnBox(bubble, message, isGreen); UnityEngine.UI.Text textObject = bubble.GetComponentInChildren <UnityEngine.UI.Text>(); textObject.text = message; }
public void createBubble(string text, GameObject gameObject, float time) { GameObject gm = GameObject.Instantiate(Resources.Load <GameObject>("UI/TextBubble")); TextBubble tbubble = gm.GetComponent <TextBubble>(); tbubble.setFindObject(gameObject); tbubble.changeText(text); gm.transform.parent = transform; }
private IEnumerator Say(List <string> text) { foreach (string text2 in text) { TextBubble.DoAmbientTalk(base.transform, new Vector3(0.5f, 2, 0), text2, 2f); yield return(new WaitForSeconds(2f)); } yield break; }
public override void Pickup(PlayerController player) { base.Pickup(player); PickEnemies(); player.PostProcessProjectile += this.PostProcessProjectile; player.PostProcessBeam += this.PostProcessBeam; ETGMod.AIActor.OnPreStart += PreSpawn; TextBubble.DoAmbientTalk(player.transform, new Vector3(1, 2, 0), PickedEnemiesDialogue, 5f);; }
private void HandleSynergyDialogue(bool hasSynergy) { if (hasSynergy) { TextBubble.DoAmbientTalk(base.transform, new Vector3(0.5f, 2, 0), "Ooh! That tingles!", 2f); } else { TextBubble.DoAmbientTalk(base.transform, new Vector3(0.5f, 2, 0), "Aww, okay then", 2f); } }
private void CreateBubble(string[] author, string[] texts) { if (lines != null) { string conversationAuthor = ""; TextBubble[] textBubbles = new TextBubble[lines.Length]; for (int i = 0; i < lines.Length; i++) { textBubbles[i] = Instantiate(bubble, parent.transform.position, Quaternion.identity, parent.transform); textBubbles[i].transform. = false;
public override void OnReloadPressed(PlayerController player, Gun gun, bool bSOMETHING) { base.OnReloadPressed(player, gun, bSOMETHING); if ((gun.ClipCapacity == gun.ClipShotsRemaining) || (gun.CurrentAmmo == gun.ClipShotsRemaining)) { if (mode != 10) { mode += 1; TextBubble.DoAmbientTalk(player.transform, new Vector3(1, 2, 0), "Using " + mode + " ammo for " + mode + "x damage.", 4f); } else { mode = 1; TextBubble.DoAmbientTalk(player.transform, new Vector3(1, 2, 0), "Using 1 ammo for normal damage.", 4f); } } }
public void AddMessage(string text, string from, string chat = "") { GameObject bubble; if (from == null || from == "") { bubble = Instantiate(myBubblePrefab, bubbleContent); } else { bubble = (GameObject)Instantiate(otherBubblePrefab, bubbleContent); } TextBubble script = bubble.GetComponent <TextBubble>(); script.textPrefab = textTemplate; script.CreateBubble(text, from); AddBubble(bubble, chat); tempBubbles.Add(bubble); }
private int reactionKind = 4; //私有變量,記錄總共有多少種反應.主要是為了只修改這一處 //--- 構造函數 public VirtualPersonality(ref Canvas carrier, ref Grid textBubbleCarrier, ref TextBlock textBubbleWord) { //將自身carrier綁定到前台模塊 this.carrier = carrier; //綁定元素, 并生成對話框成員類 this.textBubbleCarrier = textBubbleCarrier; this.textBubbleWord = textBubbleWord; textBubble = new TextBubble(ref textBubbleCarrier, ref textBubbleWord); //默認每分鐘有20%的概率說話 speakFrequency = 20; //開啟計時器, 每分鐘概率說話 speakTimer = new DispatcherTimer(); speakTimer.Interval = TimeSpan.FromMinutes(1); speakTimer.Tick += speakTimer_Tick; speakTimer.Start(); }
public override void Update(Entity entity, GameTime gt, List <Entity> npcs, List <Tile> map, List <Vector2> points, TextBubble textBubble) { this.textBubble = textBubble; if (timer > 0) { timer -= gt.ElapsedGameTime.TotalSeconds; } else { doneTalking = true; } //checks if entity passed is player for movement checks if (entity.GetType() == typeof(Player)) { UseControllerInput(entity, delta, npcs, map, points); UseKeyboardInputs(entity, delta, npcs, map, points); } }
private Size CalculateTextSize(string text, Size rawTextSize, TextBubble bubble) { Size textSize = rawTextSize; if (rawTextSize.Width >= (bubble.TextScaleX / 2)) { // Wrap text nicely double area = Convert.ToDouble(rawTextSize.Width) * Convert.ToDouble(rawTextSize.Height); double factor = Math.Sqrt(area / (Convert.ToDouble(bubble.TextScaleX) * Convert.ToDouble(bubble.TextScaleY))); textSize.Width = Convert.ToInt32(Math.Round(factor * Convert.ToDouble(bubble.TextScaleX))); textSize.Height = Convert.ToInt32(Math.Round(factor * Convert.ToDouble(bubble.TextScaleY))); } else { textSize.Width += 40; // Short shouldn't get wrapped } return(textSize); }
public bool Smash (ParticleSystem system, TextBubble bubble, CSVReader reader) { if (smashed) return false; smashed = true; if (dialogueKey != null && dialogueKey.Length > 0) { var words = ""; try { words = reader.GetKey(dialogueKey); } catch (System.Exception e) { } finally { bubble.StartCoroutine(bubble.WriteText(words)); } } particleSystem = Instantiate<ParticleSystem>(system); particleSystem.transform.position = transform.position + Vector3.up; StartCoroutine(ExitRoutine()); return true; }
public void SpawnBox(TextBubble tb, string message, bool isGreen) { TextBubble displayBubble = Instantiate(tb); displayBubble.transform.SetParent(parent ?? canvas.transform); Vector3 v3 = displayBubble.transform.position; //Debug.Log(center); if (isGreen) { v3.x = center + centerOffset; v3.y += botOffset; if (tb.isLarge) { v3.y += 50; } } else { v3.x = center - centerOffset; v3.y += botOffset; if (tb.isLarge) { v3.y += 10; } } RectTransform rt = displayBubble.GetComponent <RectTransform>(); ShiftTextBubbles(rt.rect.height + 30); displayBubble.transform.position = v3; UnityEngine.UI.Text textObject = displayBubble.GetComponentInChildren <UnityEngine.UI.Text>(); textObject.text = message; playedBubbles.Add(displayBubble); }
public void BlankModHook(Action <SilencerInstance, BlankModificationItem, Vector2, PlayerController> orig, SilencerInstance silencer, BlankModificationItem bmi, Vector2 centerPoint, PlayerController user) { orig(silencer, bmi, centerPoint, user); if (user.HasPickupID(KeymmoletID)) { RoomHandler currentRoom = user.CurrentRoom; Chest[] allChests = FindObjectsOfType <Chest>(); foreach (Chest chest in allChests) { if (chest.transform.position.GetAbsoluteRoom() == currentRoom) { if (chest.ChestIdentifier == Chest.SpecialChestIdentifier.RAT && chest.IsLocked) { TextBubble.DoAmbientTalk(chest.transform, new Vector3(1, 2, 0), "Nice try", 4f); } else { chest.ForceUnlock(); } } } } }
void Start() { GameObject.FindGameObjectWithTag("persistentObject").GetComponent <CreateAndDestroyAppointment>().OnAppointmentStarted(); usedSeed = SeedTheLevel(); // spawn appropriate number of people and add them to the allPeople list allPeople.AddRange(SpawnPeople(currentLevelInfo.level)); InitiateLevel(); SaveStartingState(); // generate random order of faces int numFaces = GetAllPeople()[0].faces_normal.Count; List <int> sequentialList = new List <int>(); for (int i = 0; i <= numFaces; i++) { sequentialList.Add(i); } List <int> randomList = new List <int>(); for (int i = numFaces; i >= 0; i--) { int n = Random.Range(0, i); randomList.Add(sequentialList[n]); sequentialList.RemoveAt(n); } foreach (Person _person in GetAllPeople()) { _person.Initialize(randomList[0]); randomList.RemoveAt(0); } selectionCursorInst = Instantiate(selectionCursor) as GameObject; selectionCursorInst.GetComponent <Renderer>().enabled = false; selectionCursorInst.transform.parent = transform; cursorSecondaryInst = Instantiate ( cursorSecondary, new Vector3 ( selectionCursorInst.transform.position.x, selectionCursorInst.transform.position.y, selectionCursorInst.transform.position.z + 1.5f ), Quaternion.identity ) as GameObject; cursorSecondaryInst.GetComponent <Renderer>().enabled = false; cursorSecondaryInst.transform.parent = selectionCursorInst.transform; myAudioComponent = gameObject.GetComponent <AudioSource>() as AudioSource; if (SaveGame.GetAudioOn_sfx()) { isAudioOn_sfx = true; } else { isAudioOn_sfx = false; } // set restart button position (to the left of the audio icons) Vector3 MusicButtonPos = GameObject.Find("audioToggle_music").transform.position; Vector3 SFXButtonPos = GameObject.Find("audioToggle_sfx").transform.position; float difference = Vector3.Distance(MusicButtonPos, SFXButtonPos); GameObject restartLevelButton = GameObject.Find("restartLevel"); if (restartLevelButton != null) { restartLevelButton.transform.position = new Vector3(MusicButtonPos.x - difference, MusicButtonPos.y, MusicButtonPos.z); } specialEffects = GetComponent <SpecialEffects>(); // reset seed back to something random Random.seed = (int)System.DateTime.Now.Second; textBubble = GetComponent <TextBubble>(); textBubble.Init(allPeople); #if UNITY_WEBPLAYER GameObject.Find("redAndGreenButtons").GetComponent <Renderer>().material = redAndGreenButton_keys; #endif }
private void PositionFrameBubble(ComicTextBubble comicBubble, Bitmap image, ComicGenerator generator, TextBubble bubble, TextBubble squareBubble, TemplateItem templateItem, Point tag, ComicGenerator.ImageAlign alignment) { Rectangle textArea = new Rectangle(); // Measure text Size rawTextSize = generator.MeasureText(comicBubble.Text, comicBubble.Font).ToSize(); int charWidth = rawTextSize.Width / comicBubble.Text.Length; // Calc text bubble dimensions based on bubble x:y ratio Size textSize = this.CalculateTextSize(comicBubble.Text, rawTextSize, bubble); textSize.Width = Math.Min(textSize.Width, templateItem.Width); // Don't exceede template item area // Final measure textSize = generator.MeasureText(comicBubble.Text, textSize.Width, comicBubble.Font).ToSize(); textSize.Width += 6; // Measure error ? // Photos are anchored at the top. Sides and bottom are cropped to fit //Size templateSize = new Size(templateItem.Width, templateItem.Height); Rectangle templateArea = new Rectangle(templateItem.X, templateItem.Y, templateItem.Width, templateItem.Height); int centerOffset = (templateItem.Width - textSize.Width) / 2; if (tag != Point.Empty) { //Size fitSize = ComicGenerator.GetFitImageSize(new Size(image.Width, image.Height), templateSize); //Rectangle cropArea = ComicGenerator.GetCropImageSize(fitSize, templateSize, alignment); // Get fitSize face location //int tagX = fitSize.Width * tag.X / 100 - cropArea.X + templateItem.X; //int tagY = fitSize.Height * tag.Y / 100 - cropArea.Y + templateItem.Y; int bufferX = textSize.Width / 4 + 10; int bufferY = textSize.Height / 2 + 30; // Attempt to position around the tag Rectangle t = new Rectangle(tag.X - (textSize.Width / 2), tag.Y - textSize.Height - bufferY, textSize.Width, textSize.Height); Rectangle tl = new Rectangle(tag.X - textSize.Width - bufferX, tag.Y - textSize.Height - bufferY, textSize.Width, textSize.Height); Rectangle tr = new Rectangle(tag.X + bufferX, tag.Y - textSize.Height - bufferY, textSize.Width, textSize.Height); Rectangle bl = new Rectangle(tag.X - textSize.Width - bufferX, tag.Y + bufferY, textSize.Width, textSize.Height); Rectangle br = new Rectangle(tag.X + bufferX, tag.Y + bufferY, textSize.Width, textSize.Height); Rectangle b = new Rectangle(tag.X - (textSize.Width / 2), tag.Y + bufferY, textSize.Width, textSize.Height); // Allow for text to appear slightly outside the frame, but not outside the bounds of the comic Rectangle bubbleArea = new Rectangle(Math.Max(0, templateArea.X - 25), Math.Max(0, templateArea.Y - 25), templateArea.Width + 25, templateArea.Height); if (bubbleArea.X + bubbleArea.Width > templateItem.Template.Width) { bubbleArea.Width -= bubbleArea.X + bubbleArea.Width - templateItem.Template.Width; } if (bubbleArea.Y + bubbleArea.Height > templateItem.Template.Height) { bubbleArea.Height -= bubbleArea.Y + bubbleArea.Height - templateItem.Template.Height; } if (bubbleArea.Contains(br) && !comicBubble.Comic.ComicTextBubbles.Any(c => c.Position.IntersectsWith(br))) { textArea = br; comicBubble.TextBubbleDirection = bubble.TextBubbleDirections.First(d => d.Direction == "tl"); comicBubble.Position = br; } if (bubbleArea.Contains(tr) && !comicBubble.Comic.ComicTextBubbles.Any(c => c.Position.IntersectsWith(tr))) { textArea = tr; comicBubble.TextBubbleDirection = bubble.TextBubbleDirections.First(d => d.Direction == "bl"); comicBubble.Position = tr; } else if (bubbleArea.Contains(bl) && !comicBubble.Comic.ComicTextBubbles.Any(c => c.Position.IntersectsWith(bl))) { textArea = bl; comicBubble.TextBubbleDirection = bubble.TextBubbleDirections.First(d => d.Direction == "tr"); comicBubble.Position = bl; } else if (bubbleArea.Contains(tl) && !comicBubble.Comic.ComicTextBubbles.Any(c => c.Position.IntersectsWith(tl))) { textArea = tl; comicBubble.TextBubbleDirection = bubble.TextBubbleDirections.First(d => d.Direction == "br"); comicBubble.Position = tl; } else if (bubbleArea.Contains(b) && !comicBubble.Comic.ComicTextBubbles.Any(c => c.Position.IntersectsWith(b))) { textArea = b; comicBubble.TextBubbleDirection = bubble.TextBubbleDirections.First(d => d.Direction == "t"); comicBubble.Position = b; } else if (bubbleArea.Contains(t) && !comicBubble.Comic.ComicTextBubbles.Any(c => c.Position.IntersectsWith(t))) { comicBubble.TextBubbleDirection = bubble.TextBubbleDirections.First(d => d.Direction == "b"); comicBubble.Position = t; } else { if (tag.Y <= 50) { // Position at bottom - face is at top comicBubble.TextBubbleDirection = squareBubble.TextBubbleDirections.First(d => d.Direction == "n"); comicBubble.Position = new Rectangle(templateItem.X + centerOffset, templateItem.Y + templateItem.Height - textSize.Height, textSize.Width, textSize.Height); } else { // Position at top - face is at the bottom comicBubble.TextBubbleDirection = squareBubble.TextBubbleDirections.First(d => d.Direction == "n"); comicBubble.Position = new Rectangle(templateItem.X + centerOffset, templateItem.Y, textSize.Width, textSize.Height); } } } else { comicBubble.TextBubbleDirection = squareBubble.TextBubbleDirections.First(d => d.Direction == "n"); comicBubble.Position = new Rectangle(templateItem.X + centerOffset, templateItem.Y + templateItem.Height - textSize.Height, textSize.Width, textSize.Height); } }
void Start() { GameObject.FindGameObjectWithTag("persistentObject").GetComponent<CreateAndDestroyAppointment>().OnAppointmentStarted(); usedSeed = SeedTheLevel(); // spawn appropriate number of people and add them to the allPeople list allPeople.AddRange(SpawnPeople(currentLevelInfo.level)); InitiateLevel(); SaveStartingState(); // generate random order of faces int numFaces = GetAllPeople()[0].faces_normal.Count; List<int> sequentialList = new List<int>(); for (int i = 0; i <= numFaces; i++) { sequentialList.Add(i); } List<int> randomList = new List<int>(); for (int i = numFaces; i >= 0; i--) { int n = Random.Range(0, i); randomList.Add(sequentialList[n]); sequentialList.RemoveAt(n); } foreach (Person _person in GetAllPeople()) { _person.Initialize(randomList[0]); randomList.RemoveAt(0); } selectionCursorInst = Instantiate(selectionCursor) as GameObject; selectionCursorInst.GetComponent<Renderer>().enabled = false; selectionCursorInst.transform.parent = transform; cursorSecondaryInst = Instantiate ( cursorSecondary, new Vector3 ( selectionCursorInst.transform.position.x, selectionCursorInst.transform.position.y, selectionCursorInst.transform.position.z + 1.5f ), Quaternion.identity ) as GameObject; cursorSecondaryInst.GetComponent<Renderer>().enabled = false; cursorSecondaryInst.transform.parent = selectionCursorInst.transform; myAudioComponent = gameObject.GetComponent<AudioSource>() as AudioSource; if (SaveGame.GetAudioOn_sfx()) { isAudioOn_sfx = true; } else { isAudioOn_sfx = false; } // set restart button position (to the left of the audio icons) Vector3 MusicButtonPos = GameObject.Find("audioToggle_music").transform.position; Vector3 SFXButtonPos = GameObject.Find("audioToggle_sfx").transform.position; float difference = Vector3.Distance(MusicButtonPos, SFXButtonPos); GameObject restartLevelButton = GameObject.Find("restartLevel"); if (restartLevelButton != null) { restartLevelButton.transform.position = new Vector3(MusicButtonPos.x - difference, MusicButtonPos.y, MusicButtonPos.z); } specialEffects = GetComponent<SpecialEffects>(); // reset seed back to something random Random.seed = (int)System.DateTime.Now.Second; textBubble = GetComponent<TextBubble>(); textBubble.Init(allPeople); #if UNITY_WEBPLAYER GameObject.Find("redAndGreenButtons").GetComponent<Renderer>().material = redAndGreenButton_keys; #endif }
public void Init(TextBubble _textBubble, List <string> _dialogs) { this.textBubble = _textBubble; this.dialogs = _dialogs; }
private void ExecuteTask(object state) { CloudQueueMessage queueMessage = (CloudQueueMessage)state; this.Log.DebugFormat("Executing render task {0}", queueMessage.AsString); Data.Comic comic = null; RenderTask task = null; string connectionString = ConfigurationManager.ConnectionStrings["ComicModelContext"].ConnectionString; ComicModelContext entityContext = new ComicModelContext(connectionString); try { // Read task details from storage CloudBlobContainer container = this.BlobClient.GetContainerReference(ComicConfigSectionGroup.Blob.TaskContainer); CloudBlobDirectory directory = container.GetDirectoryReference(ComicConfigSectionGroup.Blob.RenderTaskDirectory); CloudBlob blob = directory.GetBlobReference(queueMessage.AsString); XmlSerializer serializer = new XmlSerializer(typeof(RenderTask)); using (MemoryStream stream = new MemoryStream()) { blob.DownloadToStream(stream); stream.Seek(0, SeekOrigin.Begin); task = (RenderTask)serializer.Deserialize(stream); task.Status = TaskStatus.Executing; this.UpdateTask(task); } User user = entityContext.TryGetUser(task.OwnerUid); FacebookClient facebook = new FacebookClient(task.FacebookToken); // Get template Template template = entityContext.ListTemplates().First(t => t.TemplateId == task.TemplateId); List <TemplateItem> templateItems = template.TemplateItems.OrderBy(t => t.Ordinal).ToList(); List <TextBubbleDirection> bubbles = entityContext.ListTextBubbles().SelectMany(b => b.TextBubbleDirections).ToList(); TextBubble speechBubble = entityContext.ListTextBubbles().First(b => b.Title == "speech"); TextBubble bubbleShout = entityContext.ListTextBubbles().First(b => b.Title == "shout"); TextBubble squareBubble = entityContext.ListTextBubbles().First(b => b.Title == "square"); comic = new Data.Comic(); entityContext.AddToComics(comic); comic.Author = user; comic.Template = template; comic.CreateTime = DateTime.Now; comic.UpdateTime = DateTime.Now; comic.PublishTime = null; comic.FeatureTime = null; comic.Title = ""; comic.Description = ""; comic.ShareText = ""; comic.IsPublished = false; comic.IsPrivate = false; comic.IsDeleted = false; comic.Locale = user.Locale ?? "en-US"; comic.StorageKey = Guid.NewGuid().ToString(); if (task.RemixComicId.HasValue) { comic.RemixedComic = entityContext.TryGetComic(task.RemixComicId.Value, user); } // Comic generator only used to size text ComicGenerator generator = new ComicGenerator(template.Width, template.Height); // Render effect parameters Dictionary <string, object> parameterValues = new Dictionary <string, object>(); switch (task.Effect) { case ComicEffectType.ColorSketch: case ComicEffectType.PencilSketch: parameterValues.Add("edging", 2); parameterValues.Add("coloring", 35); break; case ComicEffectType.Comic: default: parameterValues.Add("coloring", 6); break; } // Get photos for each frame for (int f = 0; f < task.Frames.Count && f < templateItems.Count; f++) { Photo photo = null; Bitmap image = null; string imageUrl = String.Empty; ComicGenerator.ImageAlign imageAlignment = ComicGenerator.ImageAlign.Center; Point tag = Point.Empty; bool tagConfident = false; if (task.PhotoSource == "Internal" && task.Frames[f].PhotoId.HasValue) { // Load image from database photo = entityContext.TryGetPhoto(task.Frames[f].PhotoId.Value); photo.ImageData = this.GetStoredImage(photo.StorageKey); image = new Bitmap(new MemoryStream(photo.ImageData)); } else { // Tagged facebook photos if (task.PhotoSource == "Tagged") { try { // List photos of the user Dictionary <string, object> args = new Dictionary <string, object>(); args.Add("limit", "50"); dynamic photoResult = facebook.Get(String.Format("/{0}/photos", task.Frames[f].Id), args); if (photoResult.data.Count > 0) { // Pick a random photo with 2 or fewer tags dynamic photoData = ((IList <dynamic>)photoResult.data) .OrderBy(p => Guid.NewGuid()) .FirstOrDefault(p => p.tags.data.Count <= 2); if (photoData != null) { imageUrl = (string)photoData.source; // Look for user tag location int id; dynamic tagData = ((IList <dynamic>)photoData.tags.data) .FirstOrDefault(t => int.TryParse(t.id, out id) && id == task.Frames[f].Id); if (tagData != null) { tag = new Point((int)Math.Round((double)tagData.x), (int)Math.Round((double)tagData.y)); tagConfident = false; } } } } catch (Exception x) { this.Log.Error("Unable to retrieve tagged photo from facebook.", x); } } // Look for any photo of the user else if (task.PhotoSource == "Any") { try { FaceRestAPI faceApi = this.CreateFaceApi(task.FacebookToken, user.Uid); List <string> ids = new List <string>(new string[] { String.Format("{0}@facebook.com", task.Frames[f].Id) }); FaceRestAPI.FaceAPI anyResult = faceApi.facebook_get(ids, null, "1", null, "random"); if (anyResult.status == "success" && anyResult.photos.Count > 0) { FaceRestAPI.Photo p = anyResult.photos[0]; imageUrl = p.url; tag = new Point((int)Math.Round(p.tags.First().mouth_center.x), (int)Math.Round(p.tags.First().mouth_center.y)); tagConfident = true; } } catch (Exception x) { this.Log.Error("Unable to retrieve photo through face.com api.", x); } } // Use profile photo as backup image if (String.IsNullOrEmpty(imageUrl)) { imageUrl = String.Format("https://graph.facebook.com/{0}/picture?access_token={1}&type=large", task.Frames[f].Id, facebook.AccessToken); } image = this.GetImage(imageUrl); // Find faces when confidence in tag location is low if (!tagConfident) { try { FaceRestAPI tagApi = this.CreateFaceApi(task.FacebookToken, user.Uid); //List<string> tagIds = new List<string>(new string[] { String.Format("{0}@facebook.com", task.Frames[f].Id) }); List <string> urls = new List <string>(new string[] { imageUrl }); FaceRestAPI.FaceAPI tagResult = tagApi.faces_detect(urls, null, "Normal", null, null); if (tagResult.status == "success" && tagResult.photos.Count > 0 && tagResult.photos[0].tags.Count > 0) { FaceRestAPI.Tag t = tagResult.photos[0].tags.First(); tag = new Point((int)Math.Round(t.mouth_center.x), (int)Math.Round(t.mouth_center.y)); tagConfident = true; } } catch (Exception x) { this.Log.Error("Unable to detected faces.", x); } } if (tag != Point.Empty && tag.Y <= image.Height / 3) { imageAlignment = ComicGenerator.ImageAlign.Top; } } // Resize to fit frame image = ComicGenerator.FitImage(new Size(templateItems[f].Width, templateItems[f].Height), image); // Apply render effect if (task.Effect != ComicEffectType.None) { RenderHelper effectHelper = new RenderHelper(image.Size); ImageRenderData renderResult = effectHelper.RenderEffect(image, task.Effect, parameterValues); image = new Bitmap(renderResult.RenderStream); } // Read raw photo into memory MemoryStream imageStream = new MemoryStream(); image.Save(imageStream, System.Drawing.Imaging.ImageFormat.Jpeg); imageStream.Seek(0, SeekOrigin.Begin); // Frame text bubbles if (!String.IsNullOrWhiteSpace(task.Frames[f].Message)) { ComicTextBubble comicBubble = new ComicTextBubble(); entityContext.AddToComicTextBubbles(comicBubble); comicBubble.Comic = comic; comicBubble.Text = task.Frames[f].Message; // Remove newlines comicBubble.Text = comicBubble.Text.Replace('\n', ' '); // Font size int fontSize = 7; if (comicBubble.Text.Length > 160) { fontSize = 6; } if (comicBubble.Text.Length > 200) { fontSize = 5; } comicBubble.Font = new Font(ComicGenerator.ComicFont, fontSize, FontStyle.Regular, GraphicsUnit.Point); // Shouting / excited? TextBubble bubble = speechBubble; if (comicBubble.Text.Contains('!') || Regex.Matches(comicBubble.Text, "[A-Z]").Count > comicBubble.Text.Length / 4) { bubble = bubbleShout; } // Calculate tag x/y coords relative to the whole comic if (tag != Point.Empty) { Size templateSize = new Size(templateItems[f].Width, templateItems[f].Height); Rectangle cropArea = ComicGenerator.GetCropImageSize(image.Size, templateSize, imageAlignment); tag.X = image.Size.Width * tag.X / 100 - cropArea.X + templateItems[f].X; tag.Y = image.Size.Height * tag.Y / 100 - cropArea.Y + templateItems[f].Y; } // Position text bubble this.PositionFrameBubble(comicBubble, image, generator, bubble, squareBubble, templateItems[f], tag, imageAlignment); // Add photo as template item photo = new Photo(); photo.User = user; photo.CreateTime = DateTime.Now; photo.ImageData = imageStream.ToArray(); photo.StorageKey = Guid.NewGuid().ToString(); photo.Width = image.Width; photo.Height = image.Height; entityContext.AddToPhotos(photo); } // Tag users //if (task.Frames[f].Id > 0) //{ // try // { // // Lookup existing user // User taggedUser = entityContext.TryGetUser(task.Frames[f].Id, true); // if (taggedUser == null) // { // // User doesn't exist in the db yet - grab from facebook // dynamic facebookUser = facebook.Get(String.Format("/{0}", task.Frames[f].Id)); // taggedUser = new User(); // taggedUser.Uid = long.Parse(facebookUser.id); // taggedUser.IsDeleted = false; // taggedUser.IsSubscribed = false; // taggedUser.Locale = facebookUser.locale; // taggedUser.Name = facebookUser.name; // taggedUser.Nickname = facebookUser.name; // taggedUser.FbLink = facebookUser.link; // entityContext.AddToUsers(taggedUser); // } // ComicTag comicTag = new ComicTag(); // comicTag.User = taggedUser; // comicTag.Comic = comic; // if (tag != Point.Empty) // { // comicTag.X = tag.X; // comicTag.Y = tag.Y; // } // } // catch (Exception x) // { // this.Log.ErrorFormat("Failed to tag user {0} in comic. {1}", task.Frames[f].Id, x.ToString()); // } //} ComicPhoto comicPhoto = new ComicPhoto(); comicPhoto.Comic = comic; comicPhoto.Photo = photo; comicPhoto.TemplateItem = templateItems[f]; comicPhoto.Alignment = imageAlignment; comic.ComicPhotos.Add(comicPhoto); // Update task progress task.CompletedOperations++; this.UpdateTask(task); } for (int b = 0; task.Bubbles != null && b < task.Bubbles.Count; b++) { ComicTextBubble comicBubble = new ComicTextBubble(); entityContext.AddToComicTextBubbles(comicBubble); comicBubble.Comic = comic; comicBubble.Text = task.Bubbles[b].Text; comicBubble.Font = new Font(ComicGenerator.ComicFont, 7, FontStyle.Regular, GraphicsUnit.Point); comicBubble.TextBubbleDirection = bubbles.First(d => d.TextBubbleDirectionId == task.Bubbles[b].TextBubbleDirectionId); comicBubble.Position = new Rectangle(new Point(task.Bubbles[b].X, task.Bubbles[b].Y), generator.MeasureText(comicBubble.Text, comicBubble.Font).ToSize()); } // Fix for position to x,y coordinates foreach (ComicTextBubble b in comic.ComicTextBubbles) { b.X = b.Position.X; b.Y = b.Position.Y; } this.SaveComic(comic, entityContext); task.CompletedOperations = task.TotalOperations; task.Status = TaskStatus.Complete; task.ComicId = comic.ComicId; this.UpdateTask(task); this.Log.DebugFormat("Completed render task {0}", task.TaskId); } catch (Exception x) { this.Log.Error("Unable to complete render task.", x); if (task != null) { task.Status = TaskStatus.Failed; this.UpdateTask(task); } if (comic != null) { this.Log.DebugFormat("Text bubble info [{0}] [{1}]", String.Join(",", comic.ComicTextBubbles.Select(b => b.ComicTextBubbleId.ToString()).ToArray()), String.Join(",", comic.ComicTextBubbles.Select(b => b.TextBubbleDirectionId.ToString()).ToArray())); } } }
public abstract void Update(Entity entity, GameTime gt, List <Entity> npcs, List <Tile> map, List <Vector2> points, TextBubble textBubble);
public override void LoadContent() { base.LoadContent(); camera = new Camera(); //Draws the player in the middle of the region player = new Player(new Vector2(1000, 1000)); textBubble = new TextBubble("pussy", new Vector2(500, 500)); player.LoadContent(Content); textBubble.LoadContent(Content); // Constructs All NPCs then iteratively loads their content. Villager villager = new Villager(new Vector2(500, 700)); villager.Response = "I hate eating ass"; Villager villager2 = new Villager(new Vector2(900, 900)); villager2.Response = "I love eating ass"; Villager villager3 = new Villager(new Vector2(1050, 400)); villager3.Response = "Where am I?"; Villager villager4 = new Villager(new Vector2(1050, 700)); villager4.Response = "Call me Mr Ass"; npcs.Add(villager); npcs.Add(villager2); npcs.Add(villager3); npcs.Add(villager4); foreach (Entity npc in npcs) { npc.LoadContent(Content); } controller = new ExplorationController(); //sets each tile images from the sprite sheet into their own variables Floor1 = new Tile(new Rectangle(new Point(0, 0), new Point(32, 32))); Stream = new Tile(new Rectangle(new Point(0, 32), new Point(32, 32)), Tile.TileTypes.Collidable); RoadSd = new Tile(new Rectangle(new Point(32, 0), new Point(32, 32))); RoadUp = new Tile(new Rectangle(new Point(64, 32), new Point(32, 32))); RoadFk = new Tile(new Rectangle(new Point(64, 0), new Point(32, 32))); Hou1p1 = new Tile(new Rectangle(new Point(96, 0), new Point(32, 32)), Tile.TileTypes.Collidable); Hou1p2 = new Tile(new Rectangle(new Point(128, 0), new Point(32, 32)), Tile.TileTypes.Collidable); Hou1p3 = new Tile(new Rectangle(new Point(162, 0), new Point(32, 32)), Tile.TileTypes.Collidable); Hou1p4 = new Tile(new Rectangle(new Point(96, 32), new Point(32, 32)), Tile.TileTypes.Collidable); Hou1p5 = new Tile(new Rectangle(new Point(128, 32), new Point(32, 32)), Tile.TileTypes.Collidable); Hou1p6 = new Tile(new Rectangle(new Point(162, 32), new Point(32, 32)), Tile.TileTypes.Collidable); WallBL = new Tile(new Rectangle(new Point(32, 64), new Point(32, 32)), Tile.TileTypes.Collidable); WallBR = new Tile(new Rectangle(new Point(64, 64), new Point(32, 32)), Tile.TileTypes.Collidable); WallLt = new Tile(new Rectangle(new Point(96, 64), new Point(32, 32)), Tile.TileTypes.Collidable); WallRt = new Tile(new Rectangle(new Point(128, 64), new Point(32, 32)), Tile.TileTypes.Collidable); WallTL = new Tile(new Rectangle(new Point(160, 64), new Point(32, 32)), Tile.TileTypes.Collidable); WallTR = new Tile(new Rectangle(new Point(192, 64), new Point(32, 32)), Tile.TileTypes.Collidable); WallTp = new Tile(new Rectangle(new Point(0, 64), new Point(32, 32)), Tile.TileTypes.Collidable); WallBt = new Tile(new Rectangle(new Point(224, 64), new Point(32, 32)), Tile.TileTypes.Collidable); /* * Floor1 = new Tile(new Rectangle(new Point(0, 0), new Point(64, 64))); * Stream = new Tile(new Rectangle(new Point(0, 64), new Point(64, 64))); * RoadSd = new Tile(new Rectangle(new Point(64, 0), new Point(64, 64))); * RoadUp = new Tile(new Rectangle(new Point(128, 64), new Point(64, 64))); * RoadFk = new Tile(new Rectangle(new Point(128, 0), new Point(64, 64))); * House = new Tile(new Rectangle(new Point(128, 0), new Point(64, 64))); * WallBL = new Tile(new Rectangle(new Point(64, 128), new Point(64, 64))); * WallBR = new Tile(new Rectangle(new Point(128, 128), new Point(64, 64))); * WallLt = new Tile(new Rectangle(new Point(192, 128), new Point(64, 64))); * WallRt = new Tile(new Rectangle(new Point(256, 128), new Point(64, 64))); * WallTL = new Tile(new Rectangle(new Point(320, 128), new Point(64, 64))); * WallTR = new Tile(new Rectangle(new Point(384, 128), new Point(64, 64))); * WallTp = new Tile(new Rectangle(new Point(0, 128), new Point(64, 64))); * WallBt = new Tile(new Rectangle(new Point(448, 128), new Point(64, 64))); */ SpriteSheet = Content.Load <Texture2D>("Backgrounds/cave3"); // Sets the region that is drawn for (var i = 0; i < ScreenManager.Instance.TileSize * height; i += ScreenManager.Instance.TileSize) { for (var j = 0; j < ScreenManager.Instance.TileSize * width; j += ScreenManager.Instance.TileSize) { points.Add(new Vector2(j, i)); } } // The height and width of the tiles. tileHeightAndWidth = new Point( ScreenManager.Instance.TileSize, ScreenManager.Instance.TileSize ); map = new List <Tile> { WallTL, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTp, WallTR, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Hou1p1, Hou1p2, Hou1p3, Floor1, Floor1, Floor1, RoadUp, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Hou1p4, Hou1p5, Hou1p6, Floor1, Floor1, Floor1, RoadUp, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, RoadUp, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, RoadUp, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, RoadUp, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, RoadSd, RoadSd, RoadSd, RoadSd, RoadSd, RoadSd, RoadSd, RoadFk, RoadSd, RoadSd, RoadSd, RoadSd, RoadSd, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, Stream, Stream, Stream, Stream, Stream, Floor1, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, Stream, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallLt, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallRt, WallBL, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, Floor1, WallBR }; }
private void Update() { if (m_attachedPlayer != null && !Dungeon.IsGenerating) { if (m_attachedPlayer.healthHaver.Armor != armourLastChecked) { if (!SaveAPIManager.GetFlag(CustomDungeonFlags.PLAYERHELDMORETHANFIVEARMOUR)) { int threshHold = 5; if (m_attachedPlayer.characterIdentity == PlayableCharacters.Robot) { threshHold = 11; } if (m_attachedPlayer.healthHaver.Armor >= threshHold) { SaveAPIManager.SetFlag(CustomDungeonFlags.PLAYERHELDMORETHANFIVEARMOUR, true); } } armourLastChecked = (int)m_attachedPlayer.healthHaver.Armor; } if (m_attachedPlayer.stats.GetStatValue(PlayerStats.StatType.Health) != hpStatLastChecked) { SaveAPIManager.UpdateMaximum(CustomTrackedMaximums.MAX_HEART_CONTAINERS_EVER, m_attachedPlayer.stats.GetStatValue(PlayerStats.StatType.Health)); hpStatLastChecked = (int)m_attachedPlayer.stats.GetStatValue(PlayerStats.StatType.Health); } if (m_attachedPlayer.passiveItems.Count != itemCountLastChecked) { OnInventoryItemsChanged(); itemCountLastChecked = m_attachedPlayer.passiveItems.Count; } if (m_attachedPlayer.CurrentGun) { if (m_attachedPlayer.CurrentGun.PickupObjectId != gunIDLastChecked) { OnCurrentGunChanged(); } } #region InvisibleO if (Challenges.CurrentChallenge == ChallengeType.INVISIBLEO && m_attachedPlayer.IsVisible == true) { playerIsInvisibleForChallenge = true; m_attachedPlayer.DoDustUps = false; m_attachedPlayer.IsVisible = false; } if (playerIsInvisibleForChallenge && Challenges.CurrentChallenge != ChallengeType.INVISIBLEO && m_attachedPlayer.IsVisible == false) { playerIsInvisibleForChallenge = false; m_attachedPlayer.DoDustUps = true; m_attachedPlayer.IsVisible = true; } if (playerIsInvisibleForChallenge && m_attachedPlayer.gameActor.ShadowObject.GetComponent <Renderer>().enabled == true && !playerShadowInvisible) { m_attachedPlayer.gameActor.ShadowObject.GetComponent <Renderer>().enabled = false; playerShadowInvisible = true; } else if (!playerIsInvisibleForChallenge && m_attachedPlayer.gameActor.ShadowObject.GetComponent <Renderer>().enabled == false && playerShadowInvisible) { m_attachedPlayer.gameActor.ShadowObject.GetComponent <Renderer>().enabled = true; playerShadowInvisible = false; } if (Challenges.CurrentChallenge == ChallengeType.INVISIBLEO && m_attachedPlayer.CurrentGun && m_attachedPlayer.CurrentGun.GetComponent <InvisibleGun>() == null) { m_attachedPlayer.CurrentGun.gameObject.AddComponent <InvisibleGun>(); } if (Challenges.CurrentChallenge == ChallengeType.INVISIBLEO && m_attachedPlayer.CurrentSecondaryGun && m_attachedPlayer.CurrentSecondaryGun.GetComponent <InvisibleGun>() == null) { m_attachedPlayer.CurrentSecondaryGun.gameObject.AddComponent <InvisibleGun>(); } if (playerIsInvisibleForChallenge && m_attachedPlayer.primaryHand.ForceRenderersOff == false) { m_attachedPlayer.primaryHand.ForceRenderersOff = true; } if (playerIsInvisibleForChallenge && m_attachedPlayer.secondaryHand.ForceRenderersOff == false) { m_attachedPlayer.secondaryHand.ForceRenderersOff = true; } if (Challenges.CurrentChallenge == ChallengeType.INVISIBLEO && GameUIRoot.Instance.GetReloadBarForPlayer(m_attachedPlayer)) { int i = m_attachedPlayer.PlayerIDX; GameUIRoot.Instance.ForceClearReload(i); } #endregion if (Challenges.CurrentChallenge == ChallengeType.KEEP_IT_COOL) { DeadlyDeadlyGoopManager goop = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(EasyGoopDefinitions.WaterGoop); goop.TimedAddGoopCircle(m_attachedPlayer.specRigidbody.UnitCenter, 2f, 0.01f, true); DeadlyDeadlyGoopManager.FreezeGoopsCircle(m_attachedPlayer.specRigidbody.UnitBottomCenter, 2); if (!m_attachedPlayer.ownerlessStatModifiers.Contains(keepItCoolSpeedBuff)) { m_attachedPlayer.ownerlessStatModifiers.Add(keepItCoolSpeedBuff); m_attachedPlayer.stats.RecalculateStats(m_attachedPlayer); } if (m_attachedPlayer.HasPickupID(256)) { m_attachedPlayer.RemovePassiveItem(256); IntVector2 bestRewardLocation2 = m_attachedPlayer.CurrentRoom.GetBestRewardLocation(IntVector2.One * 3, RoomHandler.RewardLocationStyle.PlayerCenter, true); Chest red_Chest = GameManager.Instance.RewardManager.A_Chest; red_Chest.IsLocked = false; red_Chest.ChestType = (UnityEngine.Random.value <= 0.5f ? Chest.GeneralChestType.ITEM : Chest.GeneralChestType.WEAPON); Chest spawnedRed = Chest.Spawn(red_Chest, bestRewardLocation2); spawnedRed.lootTable.lootTable = (UnityEngine.Random.value <= 0.5f ? GameManager.Instance.RewardManager.GunsLootTable : GameManager.Instance.RewardManager.ItemsLootTable); spawnedRed.RegisterChestOnMinimap(spawnedRed.GetAbsoluteParentRoom()); TextBubble.DoAmbientTalk(m_attachedPlayer.transform, new Vector3(1, 2, 0), "Nice Try", 4f); } } else if (m_attachedPlayer.ownerlessStatModifiers.Contains(keepItCoolSpeedBuff)) { m_attachedPlayer.ownerlessStatModifiers.Remove(keepItCoolSpeedBuff); m_attachedPlayer.stats.RecalculateStats(m_attachedPlayer); } } }
private static async void DoCommand(string command) { // Clean the input command = command.Trim(); // Don't do anything if we have empty input if (command == "") { return; } // Split and handle command var args = SplitCommandLine(command).ToList(); switch (args[0].ToLower()) { case "help": PrintHelp(); break; case "export-conversation": var bubbleGroupLocation = args[1]; var jsonExportLocation = args[2]; BubbleGroupFactory.OutputBubblesInJsonFormat(bubbleGroupLocation, jsonExportLocation); break; case "register": { var service = ServiceManager.GetByName(args[1]); ServiceManager.Register(service); ServiceManager.RegisteredServicesDatabase.SaveAllRegistered(); Console.WriteLine(service + " registered"); } break; case "startall": { foreach (var service in ServiceManager.Registered) { var unifiedService = service as UnifiedService; if (unifiedService != null) { ServiceManager.StartUnified(unifiedService, null); } else { await ServiceManager.Start(service, true); } Console.WriteLine(service + " started"); } } break; case "stop": { var service = ServiceManager.GetByName(args[1]); await ServiceManager.Abort(service); Console.WriteLine(service + " stopped"); } break; case "start": { var service = ServiceManager.GetByName(args[1]); await ServiceManager.Start(service, true); Console.WriteLine(service + " started"); } break; case "send": { var service = ServiceManager.GetByName(args[1]); var address = args[2]; var message = args[3]; var textBubble = new TextBubble(Time.GetNowUnixTimestamp(), Bubble.BubbleDirection.Outgoing, address, null, false, service, message); await BubbleManager.Send(textBubble); Console.WriteLine(textBubble + " sent"); } break; case "deploy-unregister": { var pluginName = args[1]; var deployment = Settings.PluginDeployments.FirstOrDefault(x => x.Name.ToLower() == pluginName.ToLower()); if (deployment != null) { Settings.PluginDeployments.Remove(deployment); } MutableSettingsManager.Save(Settings); Console.WriteLine("Removed."); } break; case "deploy-register": { var pluginName = args[1]; var path = args[2].ToLower(); if (Settings.PluginDeployments != null) { var hasDeployment = Settings.PluginDeployments.FirstOrDefault(x => x.Name.ToLower() == pluginName.ToLower()) != null; if (hasDeployment) { Console.WriteLine("Plugin has already been registered in deployment system."); break; } } if (Settings.PluginDeployments == null) { Settings.PluginDeployments = new List <TerminalSettings.PluginDeployment>(); } Settings.PluginDeployments.Add(new TerminalSettings.PluginDeployment { Name = pluginName, Path = path, }); MutableSettingsManager.Save(Settings); Console.WriteLine("Plugin registered!"); } break; case "deploy-clean": { var pluginName = args[1]; var deployment = Settings.PluginDeployments.FirstOrDefault(x => x.Name.ToLower() == pluginName.ToLower()); if (deployment != null) { deployment.Assemblies = null; MutableSettingsManager.Save(Settings); Console.WriteLine("Cleaned assemblies."); } else { Console.WriteLine("Could not find plugin deployment: " + pluginName); } } break; case "deploy": { var pluginName = args[1]; var deployment = Settings.PluginDeployments.FirstOrDefault(x => x.Name.ToLower() == pluginName.ToLower()); var oldAssemblies = deployment.Assemblies ?? new List <TerminalSettings.PluginDeployment.Assembly>(); var assembliesToDeploy = new List <TerminalSettings.PluginDeployment.Assembly>(); var newAssemblies = new List <TerminalSettings.PluginDeployment.Assembly>(); var pluginManifest = Path.Combine(deployment.Path, "PluginManifest.xml"); if (!File.Exists(pluginManifest)) { Console.WriteLine("A plugin manifest file is needed!"); break; } foreach (var assemblyFile in Directory.EnumerateFiles(deployment.Path, "*.dll") .Concat(new [] { pluginManifest })) { var assemblyFileName = Path.GetFileName(assemblyFile); if (PlatformManager.AndroidLinkedAssemblies.Contains(assemblyFileName)) { continue; } var lastModified = File.GetLastWriteTime(assemblyFile); var newAssembly = new TerminalSettings.PluginDeployment.Assembly { Name = assemblyFileName, Modified = lastModified }; newAssemblies.Add(newAssembly); var oldAssembly = oldAssemblies.FirstOrDefault(x => x.Name == assemblyFileName); if (oldAssembly == null) { assembliesToDeploy.Add(newAssembly); } else if (oldAssembly.Modified != lastModified) { assembliesToDeploy.Add(newAssembly); } } deployment.Assemblies = newAssemblies; MutableSettingsManager.Save(Settings); var devices = AdbHelper.Instance.GetDevices(AndroidDebugBridge.SocketAddress); Device selectedDevice; if (devices.Count > 1) { Console.WriteLine("Please pick a device:"); var counter = 0; foreach (var device in devices) { Console.WriteLine(counter++ + ") " + device.SerialNumber); } Console.Write("Selection: "); var selection = int.Parse(Console.ReadLine().Trim()); selectedDevice = devices[selection]; } else { selectedDevice = devices.First(); } var remotePath = "/sdcard/Disa/plugins/" + deployment.Name; if (!selectedDevice.FileSystem.Exists(remotePath)) { selectedDevice.FileSystem.MakeDirectory(remotePath); } foreach (var assemblyToDeploy in assembliesToDeploy) { Console.WriteLine("Transferring " + assemblyToDeploy.Name + "..."); var remoteAssembly = remotePath + "/" + assemblyToDeploy.Name; if (selectedDevice.FileSystem.Exists(remoteAssembly)) { selectedDevice.FileSystem.Delete(remoteAssembly); } selectedDevice.SyncService.PushFile(Path.Combine(deployment.Path, assemblyToDeploy.Name), remoteAssembly, new SyncServiceProgressMonitor()); } Console.WriteLine("Plugin deployed! Restarting Disa..."); selectedDevice.ExecuteShellCommand("am force-stop com.disa", new ShellOutputReceiver()); Task.Delay(250).Wait(); selectedDevice.ExecuteShellCommand("monkey -p com.disa -c android.intent.category.LAUNCHER 1", new ShellOutputReceiver()); Console.WriteLine("Disa restarted!"); } break; case "deploy-print-dependencies": { var pluginName = args[1]; var deployment = Settings.PluginDeployments.FirstOrDefault(x => x.Name.ToLower() == pluginName.ToLower()); foreach (var assemblyFile in Directory.EnumerateFiles(deployment.Path, "*.dll")) { var assemblyFileName = Path.GetFileName(assemblyFile); if (PlatformManager.AndroidLinkedAssemblies.Contains(assemblyFileName)) { continue; } var module = ModuleDefinition.ReadModule(assemblyFile); Console.WriteLine(assemblyFileName + ": "); foreach (var referenceAssembly in module.AssemblyReferences) { Console.WriteLine("> " + referenceAssembly.FullName); } } } break; default: { var service = ServiceManager.GetByName(args[0]); if (service != null) { var terminal = service as ITerminal; if (terminal != null) { try { terminal.DoCommand(args.GetRange(1, args.Count - 1).ToArray()); } catch (Exception ex) { Console.WriteLine("Error in processing a service terminal command: " + ex); } } } } break; } }
// Use this for initialization void Start () { bub = GetComponent<TextBubble> (); bub.SetString ("Find the thing!"); Invoke ("FlyAway", 5f); }