void Start() { dead = false; scoreText.text = "Alignments Left: 22"; GameObject alignment = GameObject.Find("Alignment"); appearScript = alignment.GetComponent <Appear> (); }
public ToolAttribute(Modal modal, Appear appear = Appear.Large) { this.modal = modal; this.element = (int)modal & 0xf000; this.mode = (int)modal & 0x00ff; this.pick = (int)modal & 0x0300; this.appear = appear; }
/// <summary> /// Visibility has changed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmPopup_VisibleChanged(object sender, EventArgs e) { if (frmPopup.Visible) { Appear?.Invoke(this, EventArgs.Empty); } else { Disappear?.Invoke(this, EventArgs.Empty); } }
//show the right bubble on the current character private void ShowBubble(DialogBubble dialogBubble) { //if vcurrentbubble is still there, just close it if (activeBubble != null) { if (activeBubble.clickToCloseBubble) { if (dialogBubble.currentBubble != null) //get the function to close bubble { Appear appear = dialogBubble.currentBubble.GetComponent <Appear> (); appear.closeBubble = true; //close bubble } } } foreach (PixelBubble pixelBubble in dialogBubble.bubblesList) { if (dialogBubble.currentBubble == null) //make sure the bubble isn't already opened { string trueMessage = ModifyTextFromComponentByAddindNewLineAfterWords(pixelBubble); GameObject bubblesListObject = InstantiateBubble(pixelBubble, dialogBubble); //show the mouse and wait for the user to left click OR NOT (if not, after X sec, it disappear) bubblesListObject.GetComponent <Appear> ().needToClick = pixelBubble.clickToCloseBubble; RenderBodyOfBubble(bubblesListObject, pixelBubble, trueMessage); dialogBubble.currentBubble = bubblesListObject; //attach it to the player bubblesListObject.transform.parent = dialogBubble.transform; //make him his parent } else if (activeBubble == pixelBubble && activeBubble.clickToCloseBubble) { //gotonextbubble = true; dialogBubble.currentBubble = null; } } }
//show the right bubble on the current character public void ShowBubble(DialogBubble vcharacter) { bool gotonextbubble = false; //if vcurrentbubble is still there, just close it if (vActiveBubble != null) { if (vActiveBubble.vClickToCloseBubble) { //get the function to close bubble Appear vAppear = vcharacter.vCurrentBubble.GetComponent <Appear> (); vAppear.valpha = 0f; vAppear.vTimer = 0f; //instantly vAppear.vchoice = false; //close bubble //check if last bubble if (vActiveBubble == vcharacter.vBubble.Last()) { vcharacter.IsTalking = false; } } } foreach (PixelBubble vBubble in vcharacter.vBubble) { //make sure the bubble isn't already opened if (vcharacter.vCurrentBubble == null) { //make the character in talking status vcharacter.IsTalking = true; //cut the message into 24 characters string vTrueMessage = ""; string cLine = ""; int vLimit = 35; if (vBubble.vMessageForm == BubbleType.Round) { vLimit = 30; } //cut each word in a text in 24 characters. foreach (string vWord in vBubble.vMessage.Split(' ')) { if (cLine.Length + vWord.Length > vLimit) { vTrueMessage += cLine + System.Environment.NewLine; //add a line break after cLine = ""; //then reset the current line } //add the current word with a space cLine += vWord + " "; } //add the last word vTrueMessage += cLine; GameObject vBubbleObject = null; Vector3 shift = new Vector3(0, 0, 0); //create a rectangle or round bubble if (vBubble.vMessageForm == BubbleType.Rectangle) { //create bubble vBubbleObject = Instantiate(Resources.Load <GameObject> ("Customs/BubbleRectangle")); shift = new Vector3(1f, 3.1f, 0f); } else { //create bubble vBubbleObject = Instantiate(Resources.Load <GameObject> ("Customs/BubbleRound")); shift = new Vector3(1f, 2.9f, 0f); } if (vCustomBubblePosition == true) { shift = vBubblePosition; } vBubbleObject.transform.position = vcharacter.transform.position + shift; //move a little bit the teleport particle effect vBubbleObject.transform.localScale = new Vector3(1f, 1f, 1f); //show the mouse and wait for the user to left click OR NOT (if not, after 10 sec, it disappear) vBubbleObject.GetComponent <Appear>().needtoclick = vBubble.vClickToCloseBubble; Color vNewBodyColor = new Color(vBubble.vBodyColor.r, vBubble.vBodyColor.g, vBubble.vBodyColor.b, 0f); Color vNewBorderColor = new Color(vBubble.vBorderColor.r, vBubble.vBorderColor.g, vBubble.vBorderColor.b, 0f); Color vNewFontColor = new Color(vBubble.vFontColor.r, vBubble.vFontColor.g, vBubble.vFontColor.b, 255f); //get all image below the main Object foreach (Transform child in vBubbleObject.transform) { SpriteRenderer vRenderer = child.GetComponent <SpriteRenderer> (); TextMesh vTextMesh = child.GetComponent <TextMesh> (); if (vRenderer != null && child.name.Contains("Body")) { //change the body color vRenderer.color = vNewBodyColor; if (vRenderer.sortingOrder < 10) { vRenderer.sortingOrder = 1500; } } else if (vRenderer != null && child.name.Contains("Border")) { //change the border color vRenderer.color = vNewBorderColor; if (vRenderer.sortingOrder < 10) { vRenderer.sortingOrder = 1501; } } else if (vTextMesh != null && child.name.Contains("Message")) { //change the message and show it in front of everything vTextMesh.color = vNewFontColor; vTextMesh.text = vTrueMessage; child.GetComponent <MeshRenderer>().sortingOrder = 1550; Transform vMouseIcon = child.FindChild("MouseIcon"); if (vMouseIcon != null && !vBubble.vClickToCloseBubble) { vMouseIcon.gameObject.SetActive(false); } } if (vBubbleOnRight == false && (child.name.Equals("BaseBody") || child.name.Equals("BaseBorder"))) { child.transform.Rotate(Vector3.up * 180); } //disable the mouse icon because it will close by itself if (child.name == "MouseIcon" && !vBubble.vClickToCloseBubble) { child.gameObject.SetActive(false); } else { vActiveBubble = vBubble; //keep the active bubble and wait for the Left Click } } vcharacter.vCurrentBubble = vBubbleObject; //attach it to the player vBubbleObject.transform.parent = vcharacter.transform; //make him his parent } else if (vActiveBubble == vBubble && vActiveBubble.vClickToCloseBubble) { gotonextbubble = true; vcharacter.vCurrentBubble = null; } } }
// Use this for initialization void Start() { GameObject alignment = GameObject.Find("Alignment"); appearScript = alignment.GetComponent <Appear> (); }
void Start() { appearScript = GetComponent <Appear>(); }
private void initSkills() { SoundEffect booSfx = LoadingUtils.load <SoundEffect>(content, "QuickShot"); SoundEffect shriekSfx = LoadingUtils.load <SoundEffect>(content, "Boo"); SoundEffect whooshSfx = LoadingUtils.load <SoundEffect>(content, "Whoosh"); SkillFinished appear = delegate() { int alpha = 255; resetFadeEffect(this.fadeEffect, alpha, FadeEffect.FadeState.PartialIn); resetFadeEffect(this.selectedFadeEffect, alpha, FadeEffect.FadeState.PartialIn); this.state = State.Visisble; }; SkillFinished disappear = delegate() { int alpha = 75; resetFadeEffect(this.fadeEffect, alpha, FadeEffect.FadeState.PartialOut); resetFadeEffect(this.selectedFadeEffect, alpha, FadeEffect.FadeState.PartialOut); this.state = State.Invisible; this.observerHandler.notifyGhostChange(this); }; SkillFinished shriek = delegate() { int alpha = 255; resetFadeEffect(this.fadeEffect, alpha, FadeEffect.FadeState.PartialIn); resetFadeEffect(this.selectedFadeEffect, alpha, FadeEffect.FadeState.PartialIn); this.state = State.Visisble; float effectLife; Base2DSpriteDrawable shockWave = ModelGenerationUtil.generateWaveEffect(content, base.Position, Color.Orange, out effectLife); VisualEffect effect = new VisualEffect(shockWave, effectLife); EffectsManager.getInstance().Visuals.Add(effect); }; SkillFinished boo = delegate() { int alpha = 255; resetFadeEffect(this.fadeEffect, alpha, FadeEffect.FadeState.PartialIn); resetFadeEffect(this.selectedFadeEffect, alpha, FadeEffect.FadeState.PartialIn); this.state = State.Visisble; float effectLife; Base2DSpriteDrawable shockWave = ModelGenerationUtil.generateWaveEffect(content, base.Position, Color.Green, out effectLife); VisualEffect effect = new VisualEffect(shockWave, effectLife); EffectsManager.getInstance().Visuals.Add(effect); }; Skill booSkill = new Boo(booSfx, boo); Skill shriekSkill = new Shriek(shriekSfx, shriek); Skill appearSkill = new Appear(whooshSfx, appear); Skill hideSkill = new Disappear(whooshSfx, disappear); this.aggressiveSkills = new Dictionary <Keys, Skill>(); this.aggressiveSkills.Add(Keys.D1, booSkill); this.aggressiveSkills.Add(Keys.D2, shriekSkill); this.passiveskills = new Dictionary <Keys, Skill>(); this.passiveskills.Add(Keys.D3, appearSkill); this.passiveskills.Add(Keys.D4, hideSkill); this.Skills = new List <Skill>(); this.Skills.Add(booSkill); this.Skills.Add(shriekSkill); this.Skills.Add(appearSkill); this.Skills.Add(hideSkill); }