private IEnumerator PlayChewThenShrinkAndBurpAnim(float chewTime, float burpTime, FeedingPrize.PrizeType prizeType) { KingPig kp = this.m_kingPig.GetComponent <KingPig>(); this.PlayKingPigExpressionAudioEffect(Pig.Expressions.Chew); yield return(base.StartCoroutine(kp.PlayAnimation(Pig.Expressions.Chew, chewTime))); this.DelayAction(delegate { this.scaleAnimTime = 0f; if (prizeType == FeedingPrize.PrizeType.Junk || prizeType == FeedingPrize.PrizeType.None) { GameObject gameObject = GameObject.FindGameObjectWithTag("KingPigMouth"); int num = UnityEngine.Random.Range(0, this.m_JunkPrizes.Length); Vector3 position = gameObject.transform.position; position.z = -2f; UnityEngine.Object.Instantiate <GameObject>(this.m_JunkPrizes[num], position, Quaternion.identity); } }, 0.2f); this.PlayKingPigExpressionAudioEffect(Pig.Expressions.Burp); yield return(base.StartCoroutine(kp.PlayAnimation(Pig.Expressions.Burp, burpTime))); kp.SetExpression(this.m_defaultExpression); yield break; }
private IEnumerator PlayMissAnim(float time) { KingPig kp = this.m_kingPig.GetComponent <KingPig>(); this.PlayKingPigExpressionAudioEffect(Pig.Expressions.Fear); yield return(base.StartCoroutine(kp.PlayAnimation(Pig.Expressions.Fear, time))); kp.SetExpression(this.m_defaultExpression); yield break; }
private IEnumerator PlayIdleAnim() { KingPig kp = this.m_kingPig.GetComponent <KingPig>(); Pig.Expressions idleExp = this.m_IdleExpressions[UnityEngine.Random.Range(0, this.m_IdleExpressions.Length)]; this.PlayKingPigExpressionAudioEffect(idleExp); yield return(base.StartCoroutine(kp.PlayAnimation(idleExp))); kp.SetExpression(this.m_defaultExpression); yield break; }
public void StartDrag(Widget widget, object targetObject) { this.SetIdle(false); KingPig component = this.m_kingPig.GetComponent <KingPig>(); component.followMouse = true; if (!this.IsEating()) { component.SetExpression(Pig.Expressions.WaitForFood); } this.m_defaultExpression = Pig.Expressions.WaitForFood; EventManager.Send(new DragStartedEvent(BasePart.PartType.Balloon)); this.m_draggingDessert = true; this.m_waitForFoodTimer = 1.5f; }
private void Update() { if (this.m_BuyButton != null) { if (Singleton <BuildCustomizationLoader> .Instance.IsChina && this.availableDessertsCount == 0) { this.m_BuyButton.SetActive(true); } else { this.m_BuyButton.SetActive(false); } } if (this.scaleAnimTime >= 0f) { this.scaleAnimTime += Time.deltaTime / this.m_GrowDuration; if (this.scaleAnimTime > 1f) { this.isEating = false; this.scaleAnimTime = -1f; } else { this.m_kingPig.transform.parent.localScale = Vector3.Lerp(this.scaleStart, Vector3.one * this.m_CurGrowScale, this.scaleAnimTime); } } if (this.m_IsIdleEnabled) { this.m_IdleTime += Time.deltaTime; if (this.m_IdleTime >= this.m_IdleTimeout) { this.m_IdleTime = this.m_IdleTimeout; this.m_IdleAnimTime += Time.deltaTime; if (this.m_IdleAnimTime > this.m_CurIdleAnimTimeOut) { this.m_IdleAnimTime = 0f; this.m_CurIdleAnimTimeOut = UnityEngine.Random.Range(this.m_IdleAnimTimeoutMin, this.m_IdleAnimTimeoutMax); base.StartCoroutine(this.PlayIdleAnim()); } } } if (this.m_draggingDessert) { GuiManager.Pointer pointer = GuiManager.GetPointer(); Vector3 position = this.m_mainCam.ScreenToWorldPoint(pointer.position); EventManager.Send(new DraggingPartEvent(BasePart.PartType.Balloon, position)); KingPig component = this.m_kingPig.GetComponent <KingPig>(); if (component.m_currentExpression == Pig.Expressions.Normal) { component.SetExpression(Pig.Expressions.WaitForFood); } if (component.m_currentExpression == Pig.Expressions.WaitForFood) { this.m_waitForFoodTimer -= Time.deltaTime; if (this.m_waitForFoodTimer <= 0f) { this.PlayKingPigExpressionAudioEffect(Pig.Expressions.WaitForFood); this.m_waitForFoodTimer = 7f; } } } else if (this.m_dessertInScene) { Vector3 position2 = this.m_dessertInScene.transform.position; EventManager.Send(new DraggingPartEvent(BasePart.PartType.Balloon, position2)); } }