Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.22 KB | None | 0 0
  1. // Update is called once per frame
  2.     void Update () {
  3.         CheckAbilityOne();
  4.     }
  5.  
  6.     [Command]
  7.     public void CmdUpdateHealth(float health)
  8.     {
  9.         UpdateHealth(health);
  10.     }
  11.  
  12.     void UpdateHealth(float hp)
  13.     {
  14.         Debug.Log("hersky fersky new hp " + hp);
  15.     }
  16.  
  17.     private void CheckAbilityOne()
  18.     {
  19.         if (timeBtwAttack <= 0)
  20.         {
  21.             if (Input.GetKeyDown(KeyCode.Alpha1))
  22.             {
  23.                 timeBtwAttack = startTimeBtwAttack;
  24.                 anim.SetTrigger("Cleave");
  25.                 dmgAmount = cleaveDamage;
  26.  
  27.                 Collider[] hits = Physics.OverlapSphere(transform.position, sphereRadius);
  28.                
  29.  
  30.                 foreach (Collider hit in hits)
  31.                 {
  32.  
  33.                    
  34.                     if (!isLocalPlayer)
  35.                     {
  36.                         Debug.Log(hit.name);
  37.                         if (hit.tag == "Player")
  38.                         {
  39.                             print("hit " + hit.gameObject);   // <-----------------
  40.                             Damage(hit.transform);
  41.                         }
  42.                     }
  43.                    
  44.                 }
  45.             }
  46.         }    
  47.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement