public void Handle(ConnectFlowClientPackage package) { if (FlowServer.clients.TryGetValue(package.clientId, out FlowClientServer client)) { Debug.Log($"Client ({client.id}) was acknowledged"); SpawnFlowServerAction spawnAction = FlowActions.GetActionByName("Spawn") as SpawnFlowServerAction; // Todo: replace the vector and rotation with the values of an actual spawnpoint spawnAction.SendFrom(client.id, new Vector3(0, 4f, 0), Quaternion.identity); } }
/// <summary> /// Returns an action by its name /// </summary> /// <param name="actionName"></param> /// <returns></returns> static public FlowAction GetActionByName(string actionName) { actionName = FlowActions.CleanName(actionName, true); if (actions.TryGetValue(actionName, out FlowAction realAction)) { return(realAction); } return(null); }
private void Awake() { if (instance == null) { OnStartedEvent = new UnityEvent(); instance = this; } else if (instance != this) { Logger.Debug("Instance already exists, destroying object!"); Destroy(this); } }
/// <summary> /// Registers a single action component /// </summary> /// <param name="action"></param> private void RegisterAction(FlowAction action) { string actionName = FlowActions.CleanName(action.GetType().Name, true); if (actions.TryGetValue(actionName, out FlowAction flowAction)) { return; } ActionCount++; actions.Add(actionName, action); actionsByID.Add(ActionCount, action); action.id = ActionCount; action.settings = settings; action.writer = writer; action.processor = processor; action.isClient = isClient; action.SubscribePackage(); }