void Update() { if (Active) { Energy += Vector3.Magnitude(_transform.position - _oldPos); Energy *= Decay; _oldPos = _transform.position; } if (Charged != 0) { Debug.Log(Charged + ":" + ChargeToPop); if (ChargeToPop <= 0) { Charged = 0; QwutscherBubbleBehaviour bubbles = GameObject.FindObjectOfType <QwutscherBubbleBehaviour>(); if (Charged == -1) { _qMeter.ChangeQwutschPoints(50); _qMeter.ChangeQwutschEnergy(10); bubbles.PlayerDislikes(UIQwutscherLikesDislikes.Nothing, Owner == PlayerEnum.Player1); } else { bubbles.PlayerLikes(UIQwutscherLikesDislikes.Nothing, Owner == PlayerEnum.Player1); } } if (Charged == -1) { ChargeToPop -= Time.deltaTime; } } }
// Update is called once per frame void Update() { if (_qwutscher != null) { AnimateFace(); } _nextGood -= Time.deltaTime; _nextBad -= Time.deltaTime; if (_nextGood <= 0) { UIQwutscherLikesDislikes like = (UIQwutscherLikesDislikes)UnityEngine.Random.Range(0, Enum.GetValues(typeof(UIQwutscherLikesDislikes)).Length); QwutscherBubbleBehaviour bubbles = GameObject.FindObjectOfType <QwutscherBubbleBehaviour>(); bubbles.PlayerLikes(like, _qwutscher.Player == PlayerEnum.Player1); switch (like) { case UIQwutscherLikesDislikes.Nose: Nose.MakeGoodPoint(); break; case UIQwutscherLikesDislikes.Eye: Eye.MakeGoodPoint(); break; case UIQwutscherLikesDislikes.Ear: Ear.MakeGoodPoint(); break; default: break; } _nextGood = UnityEngine.Random.Range(5, 15); } if (_nextBad <= 0) { UIQwutscherLikesDislikes dislike = (UIQwutscherLikesDislikes)UnityEngine.Random.Range(0, Enum.GetValues(typeof(UIQwutscherLikesDislikes)).Length); QwutscherBubbleBehaviour bubbles = GameObject.FindObjectOfType <QwutscherBubbleBehaviour>(); bubbles.PlayerDislikes(dislike, _qwutscher.Player == PlayerEnum.Player1); switch (dislike) { case UIQwutscherLikesDislikes.Nose: Nose.MakeBadPoint(); break; case UIQwutscherLikesDislikes.Eye: Eye.MakeBadPoint(); break; case UIQwutscherLikesDislikes.Ear: Ear.MakeBadPoint(); break; default: break; } _nextBad = UnityEngine.Random.Range(10, 15); } }