コード例 #1
0
ファイル: UIEffectsMgr.cs プロジェクト: ddperera/TheThirdLaw
 private IEnumerator PlusOnePointEffect(GameObject hitPlayer, ScoreboardMgr scoreboard, int playerOwner)
 {
     yield return new WaitForSeconds(.75f);
     GameObject textObj = (GameObject) Instantiate(plusOneText, hitPlayer.transform.position+Vector3.up*1f, Quaternion.LookRotation(Vector3.forward, Vector3.up));
     textObj.GetComponent<SpriteRenderer>().color = PersistantData.colors[playerOwner];
     Vector3 initialLoc = textObj.transform.position + Vector3.back*5f;
     Vector3 targetLoc = initialLoc + Vector3.up*2f + Vector3.back*5f;
     for (float t=0; t<=1f; t+=Time.unscaledDeltaTime){
         textObj.transform.position = Vector3.Lerp(initialLoc, targetLoc, t);
         yield return null;
     }
     Destroy(textObj);
     scoreboard.AddPoint(playerOwner);
 }