void OnTriggerEnter(Collider obj) { if (timerToBeActive >= 0) { return; } if (beingEat) { return; } if (obj.gameObject == null) { return; } if (obj.transform.tag == "Snake") { if (obj.GetComponent <PhotonView>().IsMine) { OSnakePlayer snakeParam = obj.transform.root.GetComponent <OSnakePlayer>(); object[] eatFood = new object[] { foodIndex, snakeParam.GetPlayerId() }; RaiseEventOptions raiseEventOptions = new RaiseEventOptions { Receivers = ReceiverGroup.All }; PhotonNetwork.RaiseEvent(RaiseEventData.PLAYER_EAT_FOOD, eatFood, raiseEventOptions, SendOptions.SendUnreliable); } StartCoroutine(moveAndDisappear(obj.transform)); } }
public void InitializePiece(int index, OSnakePlayer parameters) { PieceIndex = index; snakeParameters = parameters; transform.parent = parameters.transform; reference = snakeParameters.snakePieces[index - 1]; transform.position = reference.transform.position - reference.transform.forward * (pieceDistanceOffset * snakeParameters.transform.localScale.x) - Vector3.up * pieceYDistanceOffset; }