public static void Start(GUnit unit, int id, Vector3 param, bool sync = true) { var stateProcessData = unit.GetData <ObjectStateProcessData>(); var stateData = ObjectStateDataDict.Get(unit, id); if (!stateData.objectState.CanStart(unit, stateProcessData, stateData, param)) { return; } if (sync && unit.GetData <ObjectSyncData>() == null) { sync = false; } if (sync) { ObjectSyncServer.AddState(unit, id, param, ObjectStateType.Start); } else { stateData.param = param; Start(stateProcessData, stateData); } }
public static void Finish(GUnit unit, int id, bool sync = true) { var stateProcessData = unit.GetData <ObjectStateProcessData>(); var stateData = ObjectStateDataDict.Get(unit, id); if (!stateData.objectState.CanFinish(unit, stateProcessData, stateData)) { return; } if (sync && unit.GetData <ObjectSyncData>() == null) { sync = false; } if (sync) { ObjectSyncServer.AddState(unit, id, Vector3.zero, ObjectStateType.Finish); } else { Finish(unit, stateProcessData, stateData); } }