Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Bolt;
  5. using Ludiq;
  6. using UnityEngine.AI;
  7. using System;
  8.  
  9. public class AgentWalkToUnit : Unit
  10. {
  11.     // Flow
  12.    
  13.     [DoNotSerialize]
  14.     public ControlInput input;
  15.     [DoNotSerialize]
  16.     public ControlOutput output;
  17.     [DoNotSerialize]
  18.     public ControlOutput finished;
  19.  
  20.     protected override void Definition()
  21.     {
  22.         input = ControlInput("in", setDestination);
  23.         output = ControlOutput("output");
  24.         finished = ControlOutput("finished");
  25.     }
  26.  
  27.     protected IEnumerator Await(Flow flow)
  28.     {
  29.         int ticks = 0;
  30.         yield return new WaitUntil(() => {
  31.             ticks += 1;
  32.             return ticks >= 60;
  33.         });
  34.        
  35.         flow.Invoke(finished);
  36.     }
  37.  
  38.     protected ControlOutput setDestination(Flow flow)
  39.     {
  40.         flow.coroutineRunner.StartCoroutine(Await(flow));
  41.  
  42.         return output;
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement