void GenChildAction() { if (!PhotonNetwork.isMasterClient) { return; } for (int i = 0; i < listChildObj.Count; i++) { int actionNum = FBUtils.RandomEnumValue <GroupObject.ACTION>(); GroupObject.ACTION action = (GroupObject.ACTION)actionNum; SetAction(action, i); } }
void SetAction(GroupObject.ACTION action, int childIndex) { switch (action) { case GroupObject.ACTION.MOVE: { //SendMoveTo(GenNextPosition(),TimeReset/2f,childIndex); Vector3 p = GenNextPosition(); photonView.RPC("SendMoveTo", PhotonTargets.AllViaServer, p.x, p.y, p.z, TimeReset / 2f, childIndex); } break; case GroupObject.ACTION.IDLE: case GroupObject.ACTION.EAT: { //SendChangeAnim(action, childIndex); photonView.RPC("SendChangeAnim", PhotonTargets.AllViaServer, action, childIndex); } break; default: break; } }
public void SendChangeAnim(GroupObject.ACTION action, int childIndex) { GroupObject script = listChildObj[childIndex].GetComponent <GroupObject>(); script.ChangeAnim(action); }