public void IHitSomeone(GameObject person) { src.PlayOneShot(Hit); MMove hitmove = person.GetComponent(typeof(MMove)) as MMove; UnAuthSyncHealth(hitmove.myHealth -= 1f, person); }
// Start is called before the first frame update void Start() { //isMobile = true; if (isMobile) { _fire = GameObject.FindGameObjectWithTag("fireButton").GetComponent <Button>(); _fire.onClick.AddListener(fire); } goodMove = goodPlayer.GetComponent(typeof(MMove)) as MMove; ptf = goodPlayer.transform; tf = transform; collider = GetComponent(typeof(BoxCollider2D)) as BoxCollider2D; audio = GameObject.FindGameObjectWithTag("Audio").GetComponent(typeof(AudioSource)) as AudioSource; }
void RpcSyncHealth(float h, GameObject person) { MMove hitmove = person.GetComponent(typeof(MMove)) as MMove; hitmove.myHealth = h; StartCoroutine(hitmove.Flash()); print(hitmove.myHealth); if (hasAuthority) { otherGuys.text = hitmove.myHealth.ToString(); } else { hitmove.mine.text = hitmove.myHealth.ToString(); src.PlayOneShot(Damaged); } }
/// <summary> /// Called when a move is received. /// </summary> /// <param name="ws">The websocket.</param> /// <param name="message">The message.</param> private void OnMove(WebSocketBase ws, MMove message) { ProcessGameMessage(message); curClock = message.Data.Clock; OnGameMove?.Invoke(this, new LilaGameMoveEvent(Client, this, message.Data)); }