//I need this way to reduce copy params public bool Send(FCCommand.CMD cmd, object param1, FC_PARAM_TYPE p1Type, object param2, FC_PARAM_TYPE p2Type, object param3, FC_PARAM_TYPE p3Type, 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, param2, p2Type, param3, p3Type, state, isHost); AddCmdToArray(ewd); } else { _fastCommand.Set(cmd, objectID, param1, p1Type, param2, p2Type, param3, p3Type, 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); }
void ReceiveCommand2v(int cmd, Vector3 vParam1, Vector3 vParam2, int networkID, int commandIndex, Vector3 commandPos, PhotonMessageInfo msgInfo) { Debug.Log("[RPC] [receive] command:" + (FCCommand.CMD)cmd + " obj:" + networkID + " from player:" + msgInfo.sender + " delayMS : " + ((int)((PhotonNetwork.time - msgInfo.timestamp) * 1000)).ToString()); //put the command into input command list OBJECT_ID object_ID = ObjectManager.Instance.GetObjectByNetworkID(networkID); if (object_ID == null) { Debug.Log("command target object is not exist: " + networkID); } else { FCCommand ewd = new FCCommand(); ewd.Set((FCCommand.CMD)cmd, object_ID, vParam1, FC_PARAM_TYPE.VECTOR3, vParam2, FC_PARAM_TYPE.VECTOR3, null, FC_PARAM_TYPE.NONE, FCCommand.STATE.RIGHTNOW, false); WriteCommandToCache(object_ID.NetworkId, commandPos, false, commandIndex, ewd); } }
public void Init(FCObject owner) { _owner = owner; _isInMoveS = false; _isInMoveD = false; _isInNavPathFinding = false; _currentSpeed = 0; _moveDirection = Vector3.zero; _fastCommand = new FCCommand(); _thisRigidBody = _owner.rigidbody; if (_thisRigidBody != null) { _thisRigidBody.drag = 100; _thisRigidBody.isKinematic = true; } _currentMoveLengthCount = 0; _currentMoveLength = 0; _characterController = _owner.GetComponent <CharacterController>(); _fastCommand.Set(FCCommand.CMD.STOP, owner.ObjectID, FCCommand.STATE.RIGHTNOW, true); if (_navAgent != null) { _navAgent.radius = 0; _navAgent.enabled = false; _defaultRaduis = _navAgent.radius; } _rotateDirection = _owner.ThisTransform.forward; if (_fallHeight <= 0) { _fallHeight = 1; } //_gReadAccel.y = FC_CONST.REAL_G; }
void Awake() { _fastCommand = new FCCommand(); _fastCommand.Set(FCCommand.CMD.STOP, null, FCCommand.STATE.RIGHTNOW, true); _threatTable = new ThreatTable(); _threatTable._length = 4; _threatTable._threatList = new int[_threatTable._length]; _threatTable._targetList = new ActionController[_threatTable._length]; _threatTable._count = 0; }
protected virtual void FirstInit() { _fastCommand = new FCCommand(); _fastCommand.Set(FCCommand.CMD.STOP, null, FCCommand.STATE.RIGHTNOW, true); _thisObject = gameObject; _selfCollider = _thisObject.collider; if (_selfCollider.GetType().ToString().Contains("Sphere")) { _colliderType = COLLIDER_TYPE.Sphere; } else if (_selfCollider.GetType().ToString().Contains("Capsule")) { _colliderType = COLLIDER_TYPE.Capsule; } if (_parent != null && _parent.ObjectID.ObjectType == FC_OBJECT_TYPE.OBJ_BULLET) { ((FCBullet)_parent)._damageReceiver = this; DeActiveLogic(); } }
void ReceiveCommand2q(int cmd, Quaternion qParam1, Quaternion qParam2, int networkID, int commandIndex, Vector3 commandPos, PhotonMessageInfo msgInfo) { //put the command into input command list OBJECT_ID object_ID = ObjectManager.Instance.GetObjectByNetworkID(networkID); if (object_ID == null) { Debug.Log("command target object is not exist: " + networkID); } else { FCCommand ewd = new FCCommand(); ewd.Set((FCCommand.CMD)cmd, object_ID, qParam1, FC_PARAM_TYPE.QUATERNION, qParam2, FC_PARAM_TYPE.QUATERNION, null, FC_PARAM_TYPE.NONE, FCCommand.STATE.RIGHTNOW, false); WriteCommandToCache(object_ID.NetworkId, commandPos, false, commandIndex, ewd); } }
//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); }
// Use this for initialization void Awake() { _fastCommand = new FCCommand(); _fastCommand.Set(FCCommand.CMD.STOP, null, FCCommand.STATE.RIGHTNOW, true); }
public void Init(FCObject owner) { _owner = owner as ActionController; _fastCommand = new FCCommand(); _fastCommand.Set(FCCommand.CMD.STOP, _owner.ObjectID, FCCommand.STATE.RIGHTNOW, true); }