Ejemplo n.º 1
0
 void AttackPlayer(GameObject go)
 {
     if (!isDead)
     {
         PlayerStats ps;
         ps           = go.GetComponent <PlayerStats>();
         attackTimer += Time.deltaTime;
         if (attackTimer >= attackSpeed)
         {
             ps.Damaged(attackPower);
             attackTimer = 0;
             //there is no need for manipulate player opponentList. but do this for further use.
             if (!ps.opponentList.Contains(transform.gameObject))
             {
                 if (ps.opponentList.Contains(transform.gameObject))
                 {
                     ps.opponentList.Remove(transform.gameObject);
                 }
                 ps.opponentList.Add(transform.gameObject);
             }
             GameManager.gm.flashColor = new Color(1.0f, 0f, 0f, 0.5f);
         }
     }
     GameManager.gm.flashColor = Color.Lerp(GameManager.gm.flashColor, Color.clear, flashSpeed * Time.deltaTime);
     //GameManager.gm.img.color = flashColor;
 }