//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- public override void Handle(GraphEngine graphEngine) { if (graphEngine.LockNode()) { new UnityTask(PlayTimeline(graphEngine)); } }
//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- public override void Handle(GraphEngine graphEngine) { if (VCam != null) { VCam.Activate(); } }
//--------------------------------------------------- // Dialog Node API //--------------------------------------------------- /// <summary> /// Invoke the events in the list. /// </summary> public override void Handle(GraphEngine graphEngine) { if (Action.GetPersistentEventCount() > 0) { Action.Invoke(); } }
//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- public override void Handle(GraphEngine graphEngine) { if (graphEngine.LockNode()) { new UnityTask(Jump(graphEngine)); } }
//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- public override void Handle(GraphEngine graphEngine) { if (Spawner != null) { if (Dynamic) { NodePort inPort = GetInputPort(nameof(DynamicAmount)); NodePort outPort = inPort.Connection; if (outPort.node is AutoValueNode n) { Debug.Log(n.Value.GetType()); Spawner.SetSpawnAmount((float)n.Value); } else { Debug.LogWarning("Please connect a int or float Value Node to the Amount port."); } } else { Spawner.SetSpawnAmount(Amount); } Spawner.SpawnCurrency(); } else { Debug.LogWarning("Please add a spawner to your " + nameof(SpawnCurrencyNode) + "."); } }
//--------------------------------------------------- // Auto Node API //--------------------------------------------------- public override void Handle(GraphEngine graphEngine) { if (Animator == null) { if (player == null) { player = GameManager.Player; } Animator = player.GetComponent <Animator>(); } switch (parameterType) { case AnimatorControllerParameterType.Bool: Animator.SetBool(Parameter, BoolValue); break; case AnimatorControllerParameterType.Float: Animator.SetFloat(Parameter, FloatValue); break; case AnimatorControllerParameterType.Int: Animator.SetInteger(Parameter, IntValue); break; case AnimatorControllerParameterType.Trigger: Animator.SetTrigger(Parameter); break; default: Debug.LogWarning("No Parameter Selected!"); break; } }
//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- public override void Handle(GraphEngine graphEngine) { if (GameManager.Player != null && GameManager.Player.Sprite != null) { GameManager.Player.Sprite.enabled = Show; } }
public override void Handle(GraphEngine graphEngine) { foreach (var trigger in Triggers) { trigger.Pull(); } }
//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- public override void Handle(GraphEngine graphEngine) { if (boss != null) { boss.StopAttacking(); } }
//--------------------------------------------------- // Dialog Node API //--------------------------------------------------- /// <summary> /// Plays a sound. /// </summary> public override void Handle(GraphEngine graphEngine) { switch (mode) { case SoundMode.Play: { sound.pitch = GetPitch(); sound.volume = GetVolume(); sound.Play(); break; } case SoundMode.PlayOneShot: { Debug.Log("PLAYING!"); sound.pitch = GetPitch(); sound.PlayOneShot(sound.clip, GetVolume()); break; } case SoundMode.PlayClipAtPoint: { AudioSource.PlayClipAtPoint(soundClip, point.position, GetVolume()); break; } case SoundMode.PlayDelayed: { sound.PlayDelayed(GetDelay()); break; } case SoundMode.PlayScheduled: { sound.PlayScheduled(playAtTime); break; } } }
//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- public override void Handle(GraphEngine graphEngine) { if (Target == null) { Debug.Log("Tween Node in graph \"" + graphEngine.GetCurrentGraph().GraphName + "\" is missing a target to move."); return; } if (Destination == null) { Debug.Log("Tween Node in graph \"" + graphEngine.GetCurrentGraph().GraphName + "\" is missing a destination."); return; } if (PauseGraph) { if (graphEngine.LockNode()) { new UnityTask(Tween(graphEngine)); } } else { new UnityTask(Tween(graphEngine)); } }
private IEnumerator Tween(GraphEngine graphEngine) { Vector3 start = Target.position; Vector3 end = Destination.position; float elapsedTime = 0; while (elapsedTime < Duration) { elapsedTime = Mathf.Clamp(elapsedTime + Time.deltaTime, 0, Duration); float normalized = Mathf.Clamp(elapsedTime / Duration, 0, 1); Vector3 interpPosition = start * (1 - normalized) + end * (normalized); if (Target != null) { Target.position = interpPosition; } else { elapsedTime = Duration; } yield return(null); } if (PauseGraph) { graphEngine.UnlockNode(); } }
public override void Handle(GraphEngine graphEngine) { if (StartClosed) { DialogManager.CloseDialogBox(); } }
//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- public override void Handle(GraphEngine graphEngine) { if (sprite != null) { sprite.enabled = Show; } }
//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- /// <summary> /// Switches a dialog on a <see cref="Talkative" /> object. /// </summary> /// <param name="graphEngine"> /// The graph traversal engine that called into this node. ///</param> public override void Handle(GraphEngine graphEngine) { if (Target != null) { if (Dialog == null) { Debug.LogWarning("DialogSwitch object has no graphs attached to switch."); return; } // If the game object exists, it means the Target is in the current scene. if (Target.gameObject != null) { Talkative talkative = Target.gameObject.GetComponent <Talkative>(); AutoGraph dialog = Dialog.gameObject.GetComponent <AutoGraph>(); talkative.Dialog = dialog; } // Tell the save system that we're switching out dialogs. Store(); } else { Debug.LogWarning("DialogSwitch object has no target!"); } }
//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- public override void Handle(GraphEngine graphEngine) { if (sprite != null) { sprite.flipX = X; sprite.flipY = Y; } }
//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- public override void Handle(GraphEngine graphEngine) { if (OnSceneReload != null) { TransitionManager.AddTransitionEvents(OnSceneReload); } TransitionManager.ReloadScene(); }
public override void PostHandle(GraphEngine graphEngine) { base.PostHandle(graphEngine); if (CheckQuestProgress) { Journey.Step(); } }
/// <summary> /// Waits the predetermined number of seconds before playing the next node. /// </summary> private IEnumerator Wait(GraphEngine graphEngine) { if (graphEngine.LockNode()) { yield return(new WaitForSeconds(Seconds)); graphEngine.UnlockNode(); } }
//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- public override void Handle(GraphEngine graphEngine) { if (!DialogManager.IsDialogBoxOpen()) { DialogManager.OpenDialogBox(); } DialogManager.Type(Text, "", AutoAdvance, Delay); }
//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- public override void Handle(GraphEngine graphEngine) { if (OnSceneLoad != null) { TransitionManager.AddTransitionEvents(OnSceneLoad); } TransitionManager.MakeTransition(scene.SceneName, spawnPoint); }
public override void Handle(GraphEngine graphEngine) { NodePort inPort = GetInputPort(nameof(Value)); NodePort outPort = inPort.Connection; if (outPort.node is AutoValueNode n) { Variable.Value = n.Value; } }
public override void PostHandle(GraphEngine graphEngine) { IAutoNode node = GetNextNode(); if (node != null) { graphEngine.SetCurrentNode(node); graphEngine.Continue(); } }
/// <summary> /// Perform the transition from one node to the next. /// </summary> /// <param name="graphEngine">The graph traversal engine making the transition</param> /// <param name="node">The node to transition from.</param> public virtual void Transition(GraphEngine graphEngine, IAutoNode node) { Node xnode = (Node)node; NodePort port = xnode.GetOutputPort(OutputPort); NodePort nextPort = port.Connection; IAutoNode nextNode = (IAutoNode)nextPort.node; graphEngine.SetCurrentNode(nextNode); graphEngine.Continue(); }
//------------------------------------------------------------------------- // Dialog Node API //------------------------------------------------------------------------- public override void Handle(GraphEngine graphEngine) { if (IsCurrencySelected() && player.GetCurrencyTotal(Currency) >= Amount) { succeeded = true; } else { succeeded = false; } }
//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- public override void Handle(GraphEngine graphEngine) { if (target != null) { GameManager.Player.Physics.Position = target.position; } else { Debug.LogWarning("SetPlayerPosition Node in graph \"" + graphEngine.GetCurrentGraph().GraphName + "\" is missing a target position. Go into the AutoGraph editor for this graph and find the node with the missing target."); } }
//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- public override void Handle(GraphEngine graphEngine) { // If the target is null, default is to assume it's for the player. if (Target == null) { GameManager.Player.Sprite.color = Color; } else { Target.color = Color; } }
//--------------------------------------------------- // Auto Node API //--------------------------------------------------- public override void Handle(GraphEngine graphEngine) { if (Animator == null) { if (player == null) { player = GameManager.Player; } Animator = player.GetComponent <Animator>(); } Animator.SetBool(Parameter, Value); }
//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- public override void Handle(GraphEngine graphEngine) { // If the target is null, default is to assume it's for the player. if (Target == null) { Vector3 angles = GameManager.Player.transform.eulerAngles; GameManager.Player.transform.localEulerAngles = new Vector3(angles.x, angles.y, Rotation); } else { Vector3 angles = Target.eulerAngles; Target.eulerAngles = new Vector3(angles.x, angles.y, Rotation); } }
//------------------------------------------------------------------------- // Auto Node API //------------------------------------------------------------------------- public override void Handle(GraphEngine graphEngine) { if (PauseGraph) { if (graphEngine.LockNode()) { new UnityTask(Shake(graphEngine)); } } else { GameManager.CurrentTargettingCamera.CameraShake(Duration, DelayBefore, Intensity); } }