Example #1
0
    void SetupInvokable()
    {
        Invokable equipedInvokable = equipedItem.GetComponent <Invokable> () as Invokable;

        RegisterInvokableWithFiringController(equipedInvokable);
        equipedInvokable.RegisterCharacterComponentsWithInvokable(componentData);
    }
 public DataProcessor(IInvokable invoke, INotifiable notify, ILobby lobby) {
     if(invoke != null)
         _invokable = new Invokable(invoke);
     if(notify != null)
         _notifiable = new Notifiable(notify);
     if (lobby != null)
         _lobby = new Lobby(lobby);
 }
Example #3
0
 public Timer(Scheduler scheduler, int interval, Invokable fn, int repeat)
 {
     _id        = ++_idgen;
     _scheduler = scheduler;
     _interval  = interval;
     _fn        = fn;
     _repeat    = repeat;
     _enabled   = false;
 }
Example #4
0
    public void LoadLaunchParameters(CharacterComponentData charData, Vector3 worldLaunch, int facingDirection)
    {
        this.componentData = charData;
        firingInvokable    = componentData.GetFiringController().GetEquipedInvokable();
        characterTransform = charData.GetCharacterTransform();
        worldLaunchVector  = worldLaunch;
        direction          = facingDirection;

        firingTeam = charData.GetCharacterCorpus().GetTeam();
    }
        private static Invokable GetInvokable(string line)
        {
            //Range.SplitToColumns->"A2:A4"p#","
            Invokable inv = new Invokable();
            inv.method = GetMethod(line);
            inv.type = GetMyType(line);
            inv.parameters = GetParams(line);

            return inv;
        }
Example #6
0
        public Timer CreateTimer(int interval, Invokable fn, int repeat)
        {
            if (_threadId != Thread.CurrentThread.ManagedThreadId)
            {
                throw new Exception("scheduler is only available in main thread");
            }
            var timer = new Timer(this, interval, fn, repeat);

            timer.enabled = true;
            return(timer);
        }
Example #7
0
        public InvokableItem(Invokable func, float delaySeconds)
        {
            this.Func = func;

            // realtimeSinceStartup is never 0, and Time.time is affected by timescale (though it is 0 on startup).  Use a combination
            // http://forum.unity3d.com/threads/205773-realtimeSinceStartup-is-not-0-in-first-Awake()-call
            if (Time.time == 0)
            {
                this.ExecuteAtTime = delaySeconds;
            }
            else
            {
                this.ExecuteAtTime = Time.realtimeSinceStartup + delaySeconds;
            }
        }
Example #8
0
        public void Invoke()
        {
            if (Invokable == null)
            {
                Cache();
            }

            if (m_Dynamic)
            {
                InvokableEvent call = Invokable as InvokableEvent;
                call.Invoke();
            }
            else
            {
                Invokable.Invoke(Arguments);
            }
        }
Example #9
0
        public FObject Invoke(FunctionInvoker fi, FObject[] args)
        {
            var  gotTypes = args.Select(x => x.Type).ToArray();
            bool j        = CallObjectTypes.Contains(gotTypes[0]);

            for (int i = 1; j && i < ArgumentTypes.Count; i++)
            {
                var item = ArgumentTypes[i];
                if (item != FObjectType.Any && item != gotTypes[i])
                {
                    j = false;
                    break;
                }
            }

            if (!j)
            {
                throw new RuntimeException($"Call did not match function signature of function '{Name}'. " +
                                           $"Expected {ArgumentTypes.PrettyArray()}, got {gotTypes.PrettyArray()}.");
            }
            return(Invokable.Invoke(fi, args));
        }
Example #10
0
 void RegisterInvokableWithFiringController(Invokable equipedInvocable)
 {
     firingController.RegisterInvokable(equipedInvocable);
 }
Example #11
0
 /// <summary>
 /// Invokes the function with a time delay.  This is NOT
 /// affected by timeScale like the Invoke function in Unity.
 /// </summary>
 /// <param name='func'>
 /// Function to invoke
 /// </param>
 /// <param name='delaySeconds'>
 /// Delay in seconds.
 /// </param>
 public static void InvokeDelayed(Invokable func, float delaySeconds)
 {
     Instance.invokeListPendingAddition.Add(new InvokableItem(func, delaySeconds));
 }
Example #12
0
 public BodyDefinition(Invokable instructions)
 {
     //TODO implement
     Instructions = instructions;
 }
 public void RegisterInvokable(Invokable invocable)
 {
     equipedInvokable = invocable;
     Invoke("CastEquipEffects", 0.05f);
     cooldownPeriod = invocable.cooldownPeriod;
 }