public void MergeFrom(StoryboardAdviceOverlayStep other) { if (other == null) { return; } if (other.speechBubble_ != null) { if (speechBubble_ == null) { SpeechBubble = new global::WUProtos.Data.SpeechBubble(); } SpeechBubble.MergeFrom(other.SpeechBubble); } if (other.RequiresScrim != false) { RequiresScrim = other.RequiresScrim; } if (other.Alignment != 0) { Alignment = other.Alignment; } if (other.ShowContinueActionText != false) { ShowContinueActionText = other.ShowContinueActionText; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); }
public override int GetHashCode() { int hash = 1; if (speechBubble_ != null) { hash ^= SpeechBubble.GetHashCode(); } if (RequiresScrim != false) { hash ^= RequiresScrim.GetHashCode(); } if (Alignment != 0) { hash ^= Alignment.GetHashCode(); } if (ShowContinueActionText != false) { hash ^= ShowContinueActionText.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override Status start(EntityKnowledgeFacade entity, UInt32 request, DisplayBubbleParam parameters, StaticObject paramsOut) { SpeechBubble bubble = entity.entity.GetComponent <SpeechBubble>(); bubble.bubbleText = parameters.BubbleText != "none"?parameters.BubbleText:""; return(Status.succeeded); }
// Update is called once per frame void Start() { RandomizeRace(); continueTimer = false; type = this.gameObject.GetComponent <CharStats>(); if (type.LiarChance() == false) { itemLookingFor = GameObject.FindGameObjectWithTag("Weapons"); //create a type of person based on the weapon.) } drinkGiven = false; centerTrigger = GameObject.Find("CenterTrigger").gameObject; exitTrigger = GameObject.Find("ExitTrigger").gameObject; lostAndFoundAnswer = false; /* * If player wants lost and found item behind counter, show text bubble asking for it. * Wait for answer */ speech = GetComponent <SpeechBubble>(); poisioned = false; }
private void PbDisplay_MouseClick(object sender, MouseEventArgs e) { if (Level.Checked && ImageHandler.ResultImage != null) { if (e.Button == MouseButtons.Left) { ImageHandler.LowerBound = Convert.ToByte(ImageHandler.ResultImage.GetPixel((int)(e.X / ScalingFactor), (int)(e.Y / ScalingFactor)).GetBrightness() * 255); NumThreshholdLower.Value = ImageHandler.LowerBound; } if (e.Button == MouseButtons.Right) { ImageHandler.UpperBound = Convert.ToByte(ImageHandler.ResultImage.GetPixel((int)(e.X / ScalingFactor), (int)(e.Y / ScalingFactor)).GetBrightness() * 255); NumThreshholdUp.Value = ImageHandler.UpperBound; } } else if (ImageHandler.CurrentImage != null) { ImageHandler.ChangeBuffer = new LockBitmap(ImageHandler.ResultImage.source); SpeechBubble newBubble = new SpeechBubble((int)((double)e.X / ScalingFactor), (int)((double)e.Y / ScalingFactor)); newBubble.CleanBubble(); setImage(ImageHandler.ResultImage.source); } else { loadDataToolStripMenuItem_Click(sender, e); } }
public void OnSpeech(Transform destination, string message, float duration) { SpeechBubble newBubble = Instantiate(this._speechPrefab, destination.position, Quaternion.identity); newBubble.OnSay(message, duration); newBubble.target = destination; }
/// <summary> 말풍선 띄우기 </summary> /// <param name="t"> 따라다닐 대상. 지정 안하면 작동 안 함 </param> /// <returns> 말풍선 띄우기에 성공하면 true 반환 </returns> bool ShowSpeechBubble(BattleUnit target, Transform t) { if (t == null) { return(false); } if (currentActivatedSpeechBubbleCount >= maxHungerMessageCount) { return(false); } SpeechBubble sb = speechBubbleList.Find(x => !x.isActive); if (!sb) { return(false); } if (hungerMessageList == null || hungerMessageList.Count == 0) { return(false); } int r = Random.Range(0, hungerMessageList.Count); string message = hungerMessageList[r]; sb.gameObject.SetActive(true); sb.Show(target, t, message, 5f); return(true); }
void Update() { if (!hasDialogue && hasSpeechBubble && !completed) { speechBubble.SetText("Help me collect my hazelnuts!\n<color=#FFFF00>" + nutsProgress + "/15</color>"); if (!isLaunchingProjectile) { StartCoroutine(WhaleLaunchProjectiles()); } if (nutsProgress >= 15) { completed = true; speechBubble.StartPoolingAnimation(); speechBubble = SpeechBubble.GetFromPool(speechBubblePrefab); speechBubble.Initialize(transform, speechBubblePosition, speechBubbleSize, speechBubbleFlip); speechBubble.SetText("!"); pileCollider.enabled = true; pileTransform.localScale = pileScale; hasDialogue = true; dialogue = completedDialogue; dialogueProgress = 0; } } }
void Awake() { _animator = GetComponent <Animator>(); if (gameObject.tag == "OldLady") { _animator = transform.parent.GetComponentInChildren <Animator>(); } _sBubble = GetComponentInChildren <SpeechBubble>(); if (_sBubble == null) { GameObject speechPrefab = Resources.Load("Characters/SpeechBubble", typeof(GameObject)) as GameObject; GameObject speechGO = GameObject.Instantiate(speechPrefab) as GameObject; speechGO.transform.position = transform.position + bubblePosition; speechGO.transform.SetParent(transform); speechGO.transform.localScale = Vector3.one * bubbleScale; //TODO: Rotate the bubbles properly _sBubble = speechGO.GetComponent <SpeechBubble>(); _sBubble.Deactivate(); } mySource = new GameObject("voice", typeof(AudioSource)).audio; mySource.transform.parent = transform; mySource.loop = true; mySource.clip = voiceLoop; mySource.Play(); mySource.volume = 0f; }
public WorldSpeechItem(SpeechBubble b, ITalkable t, Vector2 o) { bubble = b; target = t; offset = o; Enabled = false; }
public override void Setup(float startTime) { hospitalRoom.separateHalves(SceneThree.MAX_SPLIT); speechBubble = new SpeechBubble(camera, hospitalRoom.guyCenterPoint); mouthMovement = new MouthAnimator(startTime, leftMouth, rightMouth); wiggler = new Wiggler(startTime, timeLength, new[] { speechBubble.centerPivot() }); }
protected void CreateSpeechBubble() { speechBubble = SpeechBubble.Create(); speechBubble.Reposition(gameObject.transform.position); //Must set parent to be WorldCanvas so we can see the UI rendered! speechBubble.gameObject.transform.SetParent(GameObject.Find("WorldCanvas").transform); }
private void MakeSpeakerBubble(bool addFX = true) { if (CurrentDialogueFragment.Speaker == DialogueManager.instance.ShopkeeperEntity) { SpeechBubbleSpeaker = Instantiate(ShopkeeperBubbleTemplates[Random.Range(0, ShopkeeperBubbleTemplates.Count)]); SpeechBubbleSpeaker.gameObject.transform.SetParent(SpeechBubbleSpeakerMarkerShopkeeper.gameObject.transform); SpeechBubbleSpeaker.gameObject.transform.localPosition = new Vector3(); SpeechBubbleSpeaker.gameObject.transform.localScale = new Vector3(1, 1, 1); if (addFX) { ShopMortimer.instance.SetMortimerTalking(true); } } else { SpeechBubbleSpeaker = Instantiate(GetSpeechBubbleForString(CurrentDialogueFragment.Text)); SpeechBubbleSpeaker.gameObject.transform.SetParent(SpeechBubbleSpeakerMarkerConscience.gameObject.transform); SpeechBubbleSpeaker.gameObject.transform.localPosition = new Vector3(); SpeechBubbleSpeaker.gameObject.transform.localScale = new Vector3(1, 1, 1); SpeechBubbleSpeaker.InitOrbit(); } if (addFX && CurrentDialogueFragment.StageDirections != "") { AudioClip playedClip = AudioManager.instance.PlayVoiceClip(CurrentDialogueFragment.StageDirections, CurrentDialogueFragment.Speaker as Entity); CurrentFadeTime = playedClip != null ? playedClip.length + 0.2f : FadeTime; } SpeechBubbleSpeaker.ShowBubble(CurrentDialogueFragment); }
/* * Create a new speech bubble and add to list */ public void SendMessage(string[] messages, Entity sendingEntity, int messageType) { // choose what message to use int randomMessageIndex = Random.Range(0, messages.Length); string message = messages[randomMessageIndex]; // create speech bubble, set parameters SpeechBubble speechBubble = new SpeechBubble(message, messageType, sendingEntity); speechBubbles.Add(sendingEntity.GetID(), speechBubble); // THIS IS TEMPORARY - this should be managed by looking at the list // for now, send to panel to create new speech bubble panel if (ShouldCreateSpeechBubble(messageType, sendingEntity.transform.position) && !speechBubbles[sendingEntity.GetID()].bubbleCreated) { //print("creating speech bubble! size = " + speechBubbles.Count + " entity ID = " + sendingEntity.GetID()); speechBubbles[sendingEntity.GetID()].panel = speechBubblePanel.CreateNewSpeechBubblePanel(sendingEntity.transform, message, sendingEntity, this); } else { RemoveMessageDelayed(sendingEntity); } }
private Animator _animator = null; //if present a reference to the animator so we can it we are walking private void Awake() { //this should always be present _speechBubble = GetComponentInChildren <SpeechBubble>(); //this needs to be retrieved on a per skin basis //_animator = ... }
//private void Start() //{ // CreateBubble(testData, Vector2.up * 1, TestPlayerCtrl.instance.transform); //} public void CreateBubble(SpeechData speechData, Vector3 localPosition, SpeechBubble.Calback _callback, Transform parent = null) { SpeechBubble newBubble = Instantiate(bubble, parent); newBubble.transform.localPosition = localPosition; newBubble.SetInformation(speechData, bubbleOpenSpeed, bubbleCloseSpeed, textFadeSpeed, _callback); }
//---------------------COMMON---------------------// protected void Awake() { speechBubble = transform.parent.GetComponentInChildren <SpeechBubble>(); m_movementModel = GetComponentInParent <CharacterMovementModel>(); m_speed = m_movementModel.GetSpeed(); SpawnManager spawnManager = transform.parent.GetComponentInChildren <SpawnManager>(); }
public void say(string text, float lifetime) { SpeechBubble sb = Instantiate(bubblePrefab, canvasPlacement).GetComponent <SpeechBubble>(); sb.setup(text, lifetime); log.addToLog(iface.companionName + ": " + text); }
/** * Use this door to load the next room. * A dungeon layout must be loaded for this to work, see also the `DungeonLayout` singleton. * * You can use an instance of the `DungeonLoader` behavior to ensure that the dungeon layout is loaded for a room. * * This method has no effect, if the door is still locked (with a key lock or due to some other mechanism) */ public void UseDoor(PlayerController user) { if (_open) { var playersInRevivalMinigame = ReviveMinigame.GetPlayersInMinigame(); // Did some players die and are currently part of the ReviveMinigame? // In this case, display a hint and dont switch scenes if (playersInRevivalMinigame.Any()) { // Get the name of all players in the minigame (and color their name in their player color) var playerNames = playersInRevivalMinigame .Select(player => $"<color=#{ColorUtility.ToHtmlStringRGB(player.Color.ToRGB())}>{player.Data.name}</color>") .ToArray(); var init = string.Join(", ", playerNames.Init()); var playerListString = init.Any() ? $"{init} and {playerNames.Last()}" : playerNames.Last(); // Display a speech bubble with a hint: All players must be alive to enter the next scene SpeechBubble.Display(this.transform.position, $"Revive {playerListString} before leaving!", 3.0f); } // Otherwise we can switch scenes else { PlayerDataKeeper.Instance.LastDoorDirection = this.direction; DungeonLayout.Instance.LoadRoomUsingDoor(this); } } }
/** * SpeakLine * Causes a speech bubble containing the specified line to appear above the specified actor. * Will also move other speech bubbles off the screen */ public void SpeakLine(GameObject actor, string line, int wordTime, Sequence sequence) { //float speakTime = wordTime * line.Split (new string[] { " " }, System.StringSplitOptions.RemoveEmptyEntries).Length; // Meat of this one is done within the bubble script. //Create a new speech bubble instance GameObject bubble = Instantiate(Resources.Load(Constants.Resources.Narrative.PREFAB_SPEECH_BUBBLE_PATH, typeof(GameObject)), sceneCanvas.gameObject.transform) as GameObject; // Parent the speech bubble to the scene canvas SpeechBubble bubbleScript = bubble.GetComponentInChildren <SpeechBubble> (true); if (bubbleScript == null) { Debug.LogError("Created a speech bubble without a script. What?! Terminating direction and moving to next."); DestroyImmediate(bubble); sequence.Next(); return; } // Initialize the cancel action cancelActionHandler = () => { bubbleScript.DismissBubble(); // Bail out sooner than usual. }; // Initialize the speech bubble bubbleScript.sceneCamera = sceneCamera; bubbleScript.Initialize(actor, line, wordTime, () => { sequence.Next(); }); }
public override void Setup(float startTime) { hospitalRoom.separateHalves(SceneThree.MAX_SPLIT); speechBubble = new SpeechBubble(camera, hospitalRoom.guyCenterPoint); mouthMovement = new MouthAnimator(startTime, leftMouth, rightMouth); wiggler = new Wiggler(startTime, timeLength, new[] {speechBubble.centerPivot()}); }
private GameObject CreateDialogueTextGameObject(Dialogue dialogue) { if (dialogue == null) { CompleteConversation(); return(null); } SpeechBubble bubble = currentConversation.SpeechBubbles[dialogue.SpeechBubbleIndex]; if (bubble != null) { GameObject gm = bubble.gameObject; if (gm != null) { gm = Instantiate(gm, transform.position, Quaternion.identity); gm.transform.SetParent(CanvasUIHandler.Instance.DialogueContainer.transform); } Text dialogueText = gm.GetComponentInChildren <Text>(); dialogueText.text = dialogue.Sentence; return(gm); } return(null); }
public void OnTriggerDialogue() { if (!hasDialogue) { return; } if (hasSpeechBubble) { hasSpeechBubble = false; speechBubble.StartPoolingAnimation(); } if (dialogueProgress < dialogue.Length) { speechBubble = SpeechBubble.GetFromPool(speechBubblePrefab); speechBubble.Initialize(transform, speechBubblePosition, speechBubbleSize, speechBubbleFlip); speechBubble.SetText(dialogue[dialogueProgress]); dialogueProgress++; hasSpeechBubble = true; } else { hasDialogue = false; } }
void DrawPage1() { string title = "I simboli del riciclo"; ConstVar.sb.DrawString(titlefont, title, new Vector2(background.getPos().X - titlefont.MeasureString(title).X / 2, background.getPos().Y - background.getRect().Height * 0.43f), Color.Black); foreach (var button in arrows) { button.Draw(); } foreach (var simbol in simbols) { int i = simbols.IndexOf(simbol); int offsetx = offset * (i % 6); int offsety = offset * (i / 6); simbol.symbol.setPos((int)(background.getPos().X + offsetx - background.getRect().Width * 0.40f), (int)(background.getPos().Y + offsety - background.getRect().Height * 0.28f)); simbol.symbol.Draw(true); } foreach (var simbol in simbols) { MouseState _currentMouse = Mouse.GetState(); var mouseRectangle = new Rectangle(_currentMouse.X, _currentMouse.Y, 1, 1); if (Intersects(mouseRectangle, simbol.symbol.getRect())) { SpeechBubble speechBubble = new SpeechBubble(_game, _graphics, _content, "bubble/bubble-narrator", "Fonts/speechFont"); speechBubble.setPos(mouseRectangle.X + (int)(speechBubble.getRect().Width * 0.25f), mouseRectangle.Y - speechBubble.getRect().Height / 2); speechBubble.StaticDraw(simbol.description); } } }
/// <summary> /// Initializes a new instance of the <see cref="Creature" /> class. /// </summary> /// <param name="creatureType">Type of the creature.</param> /// <param name="speechBubble">The speech bubble.</param> protected Creature(CreatureType creatureType, SpeechBubble speechBubble) { CreatureType = creatureType; SpeechBubble = speechBubble; BaseSpeed = new SpeedInfo(); Settings = new CreatureSettings(); }
// Use this for initialization void Awake() { Main = this; Debug.Assert(Text != null); Debug.Assert(RootCanvas != null); Rect = GetComponent <RectTransform>(); }
public void StopAndSpeak(Vector2 playerPos) { if (stopped) { return; } float dir = transform.position.x - playerPos.x; spriteRenderer.flipX = dir < 0 ? false : true; if (sequence != null) { sequence.Kill(); sequence = null; } stopped = true; Vector2 off = speechOffset; if (ID == NPCTracker.ID.Cat) { off = catSpeechOffset; } speechBubble = FindObjectOfType <SpeechSpawner>().SpawnBubble((Vector2)transform.position + off, transform); UpdateSpeech(); speechBubble.Say(speechIcon1, speechIcon2, speechEmotion); }
public void Begin(PlayerStateMachine owner) { bubble = SpeechBubbleManager.instance.CreateBubble(0, Localization.GetString("hurt")); bubble.Attach(owner.transform); bubble.SetEffect(SpeechBubble.Effect.None); owner.animator.Change(PlayerAnimator.Type.Hungry); }
private void CreateThoughtBubbleWithMessage(string message) { thoughtBubble = GameObject.Instantiate(thoughtBubblePrefab, thoughtBubbleTransform); SpeechBubble sbScript = thoughtBubble.GetComponent <SpeechBubble>(); sbScript.Speech = message; }
/// <summary> /// test for close bubble on click /// </summary> void BubbleClose(SpeechBubble obj) { Log.Info("Close clicked on:" + obj.Id); //keep reference bubble = obj; obj.gameObject.SetActive(false); }
public SpeechItem(string s, ITalkable src, Vector2 offs, int w = 400, int d = 300) { Vector2 loc = src.GetScreenPosition(); bubble = new SpeechBubble(s, (int)loc.X, (int)loc.Y, w, d); offset = offs; source = src; }
public PlayerMind(Player p) : base() { this.player = p; this.speechBuddle = new SpeechBubble(); this.player.PlayerDied += OnPlayerDie; this.player.PlayerRespawn += OnPlayerRespawn; }
public void Flip(){ //Flip player character flipped = !flipped; Player = GameManager.PlayerCharacter.GetComponent<NavMeshAgent>(); speechBubble = Player.GetComponentInChildren<SpeechBubble>(); Player.transform.localScale = new Vector3 (Player.transform.localScale.x * -1, Player.transform.localScale.y, Player.transform.localScale.z); speechBubble.transform.localScale = new Vector3(speechBubble.transform.localScale.x * -1, speechBubble.transform.localScale.y, speechBubble.transform.localScale.z); }
public void Flip(){ //Flip player character if(gameObject.GetComponent<NavMeshAgent>()!=null && gameObject.tag!="DontFlip" ) { agent = gameObject.GetComponent<NavMeshAgent>(); flipped = !flipped; speechBubble = agent.GetComponentInChildren<SpeechBubble> (); agent.transform.localScale = new Vector3 (agent.transform.localScale.x * -1, agent.transform.localScale.y, agent.transform.localScale.z); speechBubble.transform.localScale = new Vector3 (speechBubble.transform.localScale.x * -1, speechBubble.transform.localScale.y, speechBubble.transform.localScale.z); } }
// Use this for initialization void Start () { mainBubble = this; canvas = transform.parent.GetComponent<Canvas> (); text = transform.Find ("Text").GetComponent<Text>(); text.text = ""; bubble = GetComponent<RectTransform>(); GameObject speech = GameObject.Find ("Speech"); transform.parent = speech.transform; arrow = transform.Find ("Arrow").gameObject; inFreezeState = freezesGameOnDisplay; cursors = new ArrayList(); textToDisplay = new string[] { }; Hide (); }
public void StartConversation() { onStart.Invoke (); opened = true; bubble = Instantiate (bubblePrefab).GetComponent<SpeechBubble>(); bubble.transform.SetParent(gameObject.transform, false); PlayerInput.instance.enabled = false; currentPhrase = 0; bubble.phrase.text = phrases[currentPhrase].text; bubble.portrait.sprite = phrases[currentPhrase].portrait; if (!autoStart) { UsageHint.Hide (); } }
public override void Setup() { status = PuzzleStatus.INPROGRESS; timeRemaining = timeLimit; turn = Random.Range(0, 2); sequence = new List<char>(); for (int i = 0; i < totalSequenceLength; i++) { sequence.Add(LEGAL_LETTERS[Random.Range(0, 6)]); } inputCorrect = false; sequence[0] = 'A'; // Bubbles p1bubble = this.transform.FindChild("P1 Bubble").GetComponent<SpeechBubble>(); p2bubble = this.transform.FindChild("P2 Bubble").GetComponent<SpeechBubble>(); p1bubble.Init(); p2bubble.Init(); ShowBubble(turn, sequence[0]); HideBubble((turn + 1) % 2); // Pointer pointer = this.transform.FindChild("Pointer").GetComponent<Pointer>(); pointer.SetFirst(turn); // Adjust camera. // Save camera positions then move both to our camera point. camPosition = this.transform.FindChild("Camera Point").position; cam1 = GameObject.Find("P1 Camera").GetComponent<Camera>(); oldCam1Pos = cam1.transform.position; cam1.transform.position = camPosition; cam2 = GameObject.Find("P2 Camera").GetComponent<Camera>(); oldCam2Pos = cam2.transform.position; cam2.transform.position = camPosition; }
/* * Create a new speech bubble and add to list */ public void SendMessage(string[] messages, Entity sendingEntity, int messageType) { // choose what message to use int randomMessageIndex = Random.Range(0, messages.Length); string message = messages[randomMessageIndex]; // create speech bubble, set parameters SpeechBubble speechBubble = new SpeechBubble(message, messageType, sendingEntity); speechBubbles.Add(sendingEntity.GetID(), speechBubble); // THIS IS TEMPORARY - this should be managed by looking at the list // for now, send to panel to create new speech bubble panel if (ShouldCreateSpeechBubble(messageType, sendingEntity.transform.position) && !speechBubbles[sendingEntity.GetID()].bubbleCreated) { //print("creating speech bubble! size = " + speechBubbles.Count + " entity ID = " + sendingEntity.GetID()); speechBubbles[sendingEntity.GetID()].panel = speechBubblePanel.CreateNewSpeechBubblePanel(sendingEntity.transform, message, sendingEntity, this); } else RemoveMessageDelayed(sendingEntity); }
public void Start() { //ses bubble = playerObj.GetComponent<SpeechBubble>(); }
// Use this for initialization void Start() { if(isMainBubble) { mainBubble = this; } text = transform.Find ("Text").GetComponent<Text>(); text.text = ""; bubble = GetComponent<RectTransform>(); GameObject speech = GameObject.Find ("Speech"); transform.parent = speech.transform; arrow = transform.Find ("Arrow").gameObject; inFreezeState = freezesGameOnDisplay; cursors = new ArrayList(); if(isMainBubble) gameObject.SetActive (false); }
void DisplayText (string text, SpeechBubble bubble) { bubble.DisplayText(text); }
/// <summary> /// test function to handle click on arrow /// </summary> void BubbleArrow(SpeechBubble obj) { Log.Info("Arrow clicked in:"+obj.Id); //nothing to do here }
// Use this for initialization void Start() { speechBubble = GetComponent<SpeechBubble> (); speechBubble.enabled = false; nextMsgTime = startTime; }
// Use this for initialization void Start () { Player = GameManager.PlayerCharacter.GetComponent<NavMeshAgent>(); playerMove = Player.GetComponent<NoahMove> (); speechBubble = Player.GetComponentInChildren<SpeechBubble>(); }