Exemplo n.º 1
0
 public void PlayImpactEffects(Health health, GameObject proj, ScoreboardMgr scoreboard, int playerOwner)
 {
     Destroy(proj);
     if (!isBeingTagged){
         health.AnimatePreDeath();
         StartCoroutine(SlowTime(health, proj));
         StartCoroutine(PlusOnePointEffect(health.gameObject, scoreboard, playerOwner));
     }
 }
Exemplo n.º 2
0
 //initialize here
 public void OnFire(Vector3 dir, int owner)
 {
     rb = GetComponent<Rigidbody2D>();
     scoreboard = GameObject.FindWithTag("Scoreboard").GetComponent<ScoreboardMgr>();
     rb.AddForce((new Vector2(dir.x, dir.y)).normalized * force, ForceMode2D.Impulse);
     //speed = rb.velocity.magnitude;
     playerOwner = owner;
     UIEffects = GameObject.FindWithTag("UIEffectsMgr").GetComponent<UIEffectsMgr>();
     Destroy(gameObject, lifetime);
 }
Exemplo n.º 3
0
 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);
 }