private void Awake () { SettingsManager settingsManager = AdvGame.GetReferences ().settingsManager; LayerHotspot = LayerMask.NameToLayer (settingsManager.hotspotLayer); LayerOff = LayerMask.NameToLayer (settingsManager.deactivatedLayer); if (GameObject.FindWithTag (Tags.gameEngine) && GameObject.FindWithTag (Tags.gameEngine).GetComponent <ActionListManager>()) { actionListManager = GameObject.FindWithTag (Tags.gameEngine).GetComponent <ActionListManager>(); } // If asset-based, download actions if (source == ActionListSource.AssetFile) { actions.Clear (); if (assetFile != null && assetFile.actions.Count > 0) { foreach (AC.Action action in assetFile.actions) { actions.Add (action); } useParameters = assetFile.useParameters; parameters = assetFile.parameters; } } if (useParameters) { // Reset all parameters foreach (ActionParameter _parameter in parameters) { _parameter.Reset (); } } }
public static void SetGameEngine(GameObject _gameEngine = null) { if (_gameEngine != null) { gameEnginePrefab = _gameEngine; menuSystemComponent = null; playerCursorComponent = null; playerInputComponent = null; playerInteractionComponent = null; playerMovementComponent = null; playerMenusComponent = null; playerQTEComponent = null; kickStarterComponent = null; sceneSettingsComponent = null; dialogComponent = null; menuPreviewComponent = null; navigationManagerComponent = null; actionListManagerComponent = null; localVariablesComponent = null; eventManagerComponent = null; return; } if (gameEnginePrefab == null) { SceneSettings sceneSettings = UnityVersionHandler.GetKickStarterComponent <SceneSettings>(); if (sceneSettings != null) { gameEnginePrefab = sceneSettings.gameObject; } } }
protected override void Awake () { base.Awake (); actionListManager = GameObject.FindWithTag (Tags.gameEngine).GetComponent <ActionListManager>(); if (_rigidbody) { SetGravity (true); } if (GetComponent <SphereCollider>()) { colliderRadius = GetComponent <SphereCollider>().radius * transform.localScale.x; } }
/** * <summary>Unsets the values of all script variables, so that they can be re-assigned to the correct scene if multiple scenes are open.</summary> */ public void ClearVariables() { playerPrefab = null; mainCameraPrefab = null; persistentEnginePrefab = null; gameEnginePrefab = null; // Managers sceneManagerPrefab = null; settingsManagerPrefab = null; actionsManagerPrefab = null; variablesManagerPrefab = null; inventoryManagerPrefab = null; speechManagerPrefab = null; cursorManagerPrefab = null; menuManagerPrefab = null; // PersistentEngine components optionsComponent = null; runtimeInventoryComponent = null; runtimeVariablesComponent = null; playerMenusComponent = null; stateHandlerComponent = null; sceneChangerComponent = null; saveSystemComponent = null; levelStorageComponent = null; runtimeLanguagesComponent = null; actionListAssetManagerComponent = null; // GameEngine components menuSystemComponent = null; dialogComponent = null; playerInputComponent = null; playerInteractionComponent = null; playerMovementComponent = null; playerCursorComponent = null; playerQTEComponent = null; sceneSettingsComponent = null; navigationManagerComponent = null; actionListManagerComponent = null; localVariablesComponent = null; menuPreviewComponent = null; eventManagerComponent = null; SetGameEngine(); }
/** * <summary>Unsets the values of all script variables, so that they can be re-assigned to the correct scene if multiple scenes are open.</summary> */ public void ClearVariables() { playerPrefab = null; mainCameraPrefab = null; persistentEnginePrefab = null; gameEnginePrefab = null; // Managers sceneManagerPrefab = null; settingsManagerPrefab = null; actionsManagerPrefab = null; variablesManagerPrefab = null; inventoryManagerPrefab = null; speechManagerPrefab = null; cursorManagerPrefab = null; menuManagerPrefab = null; // PersistentEngine components optionsComponent = null; runtimeInventoryComponent = null; runtimeVariablesComponent = null; playerMenusComponent = null; stateHandlerComponent = null; sceneChangerComponent = null; saveSystemComponent = null; levelStorageComponent = null; runtimeLanguagesComponent = null; // GameEngine components menuSystemComponent = null; dialogComponent = null; playerInputComponent = null; playerInteractionComponent = null; playerMovementComponent = null; playerCursorComponent = null; playerQTEComponent = null; sceneSettingsComponent = null; navigationManagerComponent = null; actionListManagerComponent = null; localVariablesComponent = null; menuPreviewComponent = null; SetGameEngine (); }
private void OnDestroy () { actionListManager = null; stateHandler = null; }
private void BeginActionList (int i) { if (actionListManager == null) { actionListManager = GameObject.FindWithTag (Tags.gameEngine).GetComponent <ActionListManager>(); } actionListManager.AddToList (this); nextActionNumber = i; ProcessAction (i); }
void Start() { _AC = new ActionListManager(); }
public void Start() { bridge = DialogueManager.Instance.GetComponent<AdventureCreatorBridge>(); actionListManager = KickStarter.actionListManager; string actionListSpecifier = GetParameter(0); bool wait = !string.Equals(GetParameter(1), "nowait"); int startAt = GetParameterAsInt(2); bool addToSkipQueue = true; // Look for a GameObject in the scene matching the specified name: GameObject actionListObject = GameObject.Find(actionListSpecifier); if (actionListObject != null) { actionList = actionListObject.GetComponent<ActionList>(); if (actionList != null) { if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: AC({1},{2},startAt={3}) starting action list", DialogueDebug.Prefix, actionListSpecifier, (wait ? "wait" : "nowait"), startAt), actionListObject); if (bridge != null && DialogueManager.IsConversationActive) bridge.SyncLuaToAdventureCreator(); if (startAt == 0) { actionList.Interact(); } else { actionList.Interact(startAt, addToSkipQueue); } } } // Failing that, look for other GameObjects in the scene matching the name: if (actionList == null) { foreach (GameObject go in GameObject.FindObjectsOfType<GameObject>()) { if (string.Equals(go.name, actionListSpecifier)) { actionList = go.GetComponent<ActionList>(); if (actionList != null) { if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: AC({1},{2},startAt={3}) starting action list", DialogueDebug.Prefix, actionListSpecifier, (wait ? "wait" : "nowait"), startAt), go); if (bridge != null && DialogueManager.IsConversationActive) bridge.SyncLuaToAdventureCreator(); if (startAt == 0) { actionList.Interact(); } else { actionList.Interact(startAt, addToSkipQueue); } break; } } } } // Failing that, try Resources.Load: if (actionList == null) { var actionListAsset = Resources.Load(actionListSpecifier) as ActionListAsset; if (actionListAsset) { if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: AC({1},{2},startAt={3}) starting action list asset", DialogueDebug.Prefix, actionListSpecifier, (wait ? "wait" : "nowait"), startAt)); if (bridge != null && DialogueManager.IsConversationActive) bridge.SyncLuaToAdventureCreator(); if (startAt == 0) { actionList = AdvGame.RunActionListAsset(actionListAsset); } else { actionList = AdvGame.RunActionListAsset(actionListAsset, startAt, addToSkipQueue); } } } // Failing that, look for an ActionListAsset in all resources of the project: if (actionList == null) { foreach (ActionListAsset actionListAsset in Resources.FindObjectsOfTypeAll(typeof(ActionListAsset)) as ActionListAsset[]) { if (string.Equals(actionListSpecifier, actionListAsset.name, System.StringComparison.OrdinalIgnoreCase)) { if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sequencer: AC({1},{2},startAt={3}) starting action list asset", DialogueDebug.Prefix, actionListSpecifier, (wait ? "wait" : "nowait"), startAt)); if (bridge != null && DialogueManager.IsConversationActive) bridge.SyncLuaToAdventureCreator(); if (startAt == 0) { actionList = AdvGame.RunActionListAsset(actionListAsset); } else { actionList = AdvGame.RunActionListAsset(actionListAsset, startAt, addToSkipQueue); } break; } } } if (actionList == null) { if (DialogueDebug.LogWarnings) Debug.LogWarning(string.Format("{0}: Sequencer: AC(): Can't find action list '{1}'", DialogueDebug.Prefix, actionListSpecifier)); Stop(); } if (!wait) Stop(); }
private void OnDestroy () { actionListManager = null; dialog = null; playerInput = null; playerInteraction = null; menuSystem = null; stateHandler = null; options = null; menus = null; runtimeInventory = null; settingsManager = null; cursorManager = null; speechManager = null; menuManager = null; sceneSettings = null; }
private void GetReferences () { settingsManager = AdvGame.GetReferences ().settingsManager; if (settingsManager.IsInLoadingScene ()) { return; } speechManager = AdvGame.GetReferences ().speechManager; cursorManager = AdvGame.GetReferences ().cursorManager; menuManager = AdvGame.GetReferences ().menuManager; playerCursor = GameObject.FindWithTag (Tags.gameEngine).GetComponent <PlayerCursor>(); actionListManager = playerCursor.GetComponent <ActionListManager>(); playerInput = playerCursor.GetComponent <PlayerInput>(); playerInteraction = playerCursor.GetComponent <PlayerInteraction>(); menuSystem = playerCursor.GetComponent <MenuSystem>(); dialog = playerCursor.GetComponent <Dialog>(); sceneSettings = playerCursor.GetComponent <SceneSettings>(); stateHandler = this.GetComponent <StateHandler>(); options = this.GetComponent <Options>(); runtimeInventory = this.GetComponent <RuntimeInventory>(); }
private void Awake () { if (AdvGame.GetReferences () && AdvGame.GetReferences ().settingsManager) { settingsManager = AdvGame.GetReferences ().settingsManager; cursorIsLocked = settingsManager.lockCursorOnStart; } actionListManager = this.GetComponent <ActionListManager>(); playerInteraction = this.GetComponent <PlayerInteraction>(); ResetClick (); xboxCursor.x = Screen.width / 2; xboxCursor.y = Screen.height / 2; }
private void OnDestroy () { stateHandler = null; runtimeInventory = null; settingsManager = null; actionListManager = null; playerInteraction = null; }
private void GetReferences () { settingsManager = AdvGame.GetReferences ().settingsManager; if (settingsManager != null && settingsManager.IsInLoadingScene ()) { return; } playerCursor = GameObject.FindWithTag (Tags.gameEngine).GetComponent <PlayerCursor>(); playerInput = playerCursor.GetComponent <PlayerInput>(); playerInteraction = playerCursor.GetComponent <PlayerInteraction>(); playerMovement = playerCursor.GetComponent <PlayerMovement>(); dialog = playerCursor.GetComponent <Dialog>(); playerMenus = GetComponent <PlayerMenus>(); actionListManager = playerCursor.GetComponent <ActionListManager>(); dragBases = FindObjectsOfType (typeof (DragBase)) as DragBase[]; hotspots = FindObjectsOfType (typeof (Hotspot)) as Hotspot[]; arrowPrompts = FindObjectsOfType (typeof (ArrowPrompt)) as ArrowPrompt[]; parallax2Ds = FindObjectsOfType (typeof (Parallax2D)) as Parallax2D[]; }
private void OnDestroy () { playerInput = null; playerCursor = null; playerMenus = null; playerInteraction = null; playerMovement = null; settingsManager = null; arrowPrompts = null; hotspots = null; actionListManager = null; dialog = null; }
protected void PathUpdate () { if (activePath && activePath.nodes.Count > 0) { if (pausePath) { if (nodeActionList != null) { if (actionListManager == null) { actionListManager = GameObject.FindWithTag (Tags.gameEngine).GetComponent <ActionListManager>(); } if (!actionListManager.IsListRunning (nodeActionList)) { SetNextNodes (); } } else if (Time.time > pausePathTime) { SetNextNodes (); } return; } else { Vector3 direction = activePath.nodes[targetNode] - transform.position; Vector3 lookDir = new Vector3 (direction.x, 0f, direction.z); if (settingsManager && settingsManager.IsUnity2D ()) { direction.z = 0f; SetMoveDirection (direction); lookDir = new Vector3 (direction.x, 0f, direction.y); SetLookDirection (lookDir, false); } else if (activePath.affectY) { SetMoveDirection (direction); SetLookDirection (lookDir, false); } else { SetLookDirection (lookDir, false); SetMoveDirectionAsForward (); } float nodeThreshold = 0.1f; if (settingsManager) { nodeThreshold = 1.05f - settingsManager.destinationAccuracy; } if (isRunning) { nodeThreshold *= runSpeedScale / walkSpeedScale; } if ((settingsManager.IsUnity2D () && direction.magnitude < nodeThreshold) || (activePath.affectY && direction.magnitude < nodeThreshold) || (!activePath.affectY && lookDir.magnitude < nodeThreshold)) { if (targetNode == 0 && prevNode == 0) { SetNextNodes (); } else if (activePath.nodePause > 0f) { PausePath (activePath.nodePause); } else if (activePath.nodeCommands.Count > targetNode) { if (activePath.commandSource == ActionListSource.InScene && activePath.nodeCommands [targetNode].cutscene != null) { PausePath (activePath.nodeCommands [targetNode].cutscene, activePath.nodeCommands [targetNode].parameterID); } else if (activePath.commandSource == ActionListSource.AssetFile && activePath.nodeCommands [targetNode].actionListAsset != null) { PausePath (activePath.nodeCommands [targetNode].actionListAsset, activePath.nodeCommands [targetNode].parameterID); } else { SetNextNodes (); } } else { SetNextNodes (); } } } } }