public bool Send(FCCommand.CMD cmd, object param1, FC_PARAM_TYPE p1Type, OBJECT_ID objectID, FCCommand.STATE state, bool isHost) { bool ret = false; if (state != FCCommand.STATE.RIGHTNOW) { FCCommand ewd = null; if (_deActiveCommandList.Count != 0) { ewd = _deActiveCommandList[0]; _deActiveCommandList.Remove(ewd); } else { ewd = new FCCommand(); } ewd.Set(cmd, objectID, param1, p1Type, state, isHost); AddCmdToArray(ewd); } else { _fastCommand.Set(cmd, objectID, param1, p1Type, state, isHost); if (objectID.HandleCommand(ref _fastCommand)) { _fastCommand._objID = null; ret = true; } else { //AddCmdToArray(ewd); // may need to add it to command list } } return(ret); }
public void Set(CMD cmd, OBJECT_ID objID, object param1, FC_PARAM_TYPE p1Type, STATE state, bool isHost) { _cmd = cmd; _param1 = param1; _param2 = null; _param3 = null; _param1Type = p1Type; _param2Type = FC_PARAM_TYPE.NONE; _param3Type = FC_PARAM_TYPE.NONE; _objID = objID; _state = state; _isHost = isHost; }
public FCCommand(FCCommand ewc) { _cmdIndex = ewc._cmdIndex; _cmd = ewc._cmd; _param1 = ewc._param1; _param2 = ewc._param2; _param3 = ewc._param3; _param1Type = ewc._param1Type; _param2Type = ewc._param2Type; _param3Type = ewc._param3Type; _objID = ewc._objID; _state = ewc._state; _isHost = ewc._isHost; }
//send msg to all clients except me public void SendCommandToOthers(FCCommand.CMD cmd, OBJECT_ID objID, Vector3 commandPosition, object param1, FC_PARAM_TYPE p1Type, object param2, FC_PARAM_TYPE p2Type, object param3, FC_PARAM_TYPE p3Type ) { //single player will not send comment to others if (PhotonNetwork.room == null) { return; } Debug.Log("[send] command:" + cmd + " , obj_network_id:" + objID.NetworkId); //build command instance and add into output list FCCommand ewd = new FCCommand(GetNextCommandStreamID(objID.NetworkId)); ewd.Set((FCCommand.CMD)cmd, objID, param1, p1Type, param2, p2Type, param3, p3Type, FCCommand.STATE.RIGHTNOW, false); ewd._commandPosition = commandPosition; if (CheatManager.netDelay > 0) { StartCoroutine(AddCommand(ewd)); } else { _outputCommandList.Add(ewd); } // //_outputCommandList.Add(ewd); }