//-------------------------------------------------------------------------
 // Auto Node API
 //-------------------------------------------------------------------------
 public override void Handle(GraphEngine graphEngine)
 {
     if (graphEngine.LockNode())
     {
         new UnityTask(PlayTimeline(graphEngine));
     }
 }
Example #2
0
 //-------------------------------------------------------------------------
 // Auto Node API
 //-------------------------------------------------------------------------
 public override void Handle(GraphEngine graphEngine)
 {
     if (VCam != null)
     {
         VCam.Activate();
     }
 }
Example #3
0
        //---------------------------------------------------
        // Dialog Node API
        //---------------------------------------------------

        /// <summary>
        /// Invoke the events in the list.
        /// </summary>
        public override void Handle(GraphEngine graphEngine)
        {
            if (Action.GetPersistentEventCount() > 0)
            {
                Action.Invoke();
            }
        }
Example #4
0
 //-------------------------------------------------------------------------
 // Auto Node API
 //-------------------------------------------------------------------------
 public override void Handle(GraphEngine graphEngine)
 {
     if (graphEngine.LockNode())
     {
         new UnityTask(Jump(graphEngine));
     }
 }
Example #5
0
        //-------------------------------------------------------------------------
        // 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) + ".");
            }
        }
Example #6
0
        //---------------------------------------------------
        // 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;
            }
        }
Example #7
0
 //-------------------------------------------------------------------------
 // Auto Node API
 //-------------------------------------------------------------------------
 public override void Handle(GraphEngine graphEngine)
 {
     if (GameManager.Player != null && GameManager.Player.Sprite != null)
     {
         GameManager.Player.Sprite.enabled = Show;
     }
 }
Example #8
0
 public override void Handle(GraphEngine graphEngine)
 {
     foreach (var trigger in Triggers)
     {
         trigger.Pull();
     }
 }
Example #9
0
        //-------------------------------------------------------------------------
        // Auto Node API
        //-------------------------------------------------------------------------

        public override void Handle(GraphEngine graphEngine)
        {
            if (boss != null)
            {
                boss.StopAttacking();
            }
        }
Example #10
0
        //---------------------------------------------------
        // 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;
            }
            }
        }
Example #11
0
        //-------------------------------------------------------------------------
        // 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));
            }
        }
Example #12
0
        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();
            }
        }
Example #13
0
 public override void Handle(GraphEngine graphEngine)
 {
     if (StartClosed)
     {
         DialogManager.CloseDialogBox();
     }
 }
Example #14
0
 //-------------------------------------------------------------------------
 // Auto Node API
 //-------------------------------------------------------------------------
 public override void Handle(GraphEngine graphEngine)
 {
     if (sprite != null)
     {
         sprite.enabled = Show;
     }
 }
Example #15
0
        //-------------------------------------------------------------------------
        // 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();
 }
Example #18
0
 public override void PostHandle(GraphEngine graphEngine)
 {
     base.PostHandle(graphEngine);
     if (CheckQuestProgress)
     {
         Journey.Step();
     }
 }
Example #19
0
        /// <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();
            }
        }
Example #20
0
        //-------------------------------------------------------------------------
        // Auto Node API
        //-------------------------------------------------------------------------
        public override void Handle(GraphEngine graphEngine)
        {
            if (!DialogManager.IsDialogBoxOpen())
            {
                DialogManager.OpenDialogBox();
            }

            DialogManager.Type(Text, "", AutoAdvance, Delay);
        }
Example #21
0
        //-------------------------------------------------------------------------
        // 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;
            }
        }
Example #23
0
        public override void PostHandle(GraphEngine graphEngine)
        {
            IAutoNode node = GetNextNode();

            if (node != null)
            {
                graphEngine.SetCurrentNode(node);
                graphEngine.Continue();
            }
        }
Example #24
0
        /// <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;
     }
 }
Example #28
0
        //---------------------------------------------------
        // 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);
        }
Example #29
0
 //-------------------------------------------------------------------------
 // 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);
     }
 }
Example #30
0
 //-------------------------------------------------------------------------
 // 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);
     }
 }