Esempio n. 1
0
 void OnScheduleTimer(ScheduleTimerEvent @event)
 {
     if (@event._object == gameObject)
     {
         Activate();
     }
 }
    void OnScheduleTimer(ScheduleTimerEvent @event)
    {
        if (icons.ContainsKey(@event))
        {
            var icon = icons[@event];
            Destroy(icon.inGame);
            Destroy(icon.onBar);

            icons.Remove(@event);
        }
    }
Esempio n. 3
0
    IEnumerator ScheduleExecuteCoroutine(ScheduleTimerEvent @event)
    {
        var timer = @event.timer - ScheduleManager.instance.timer;

        if (timer < 0)
        {
            yield break;
        }
        yield return(new WaitForSeconds(timer));

        EventBus.Publish(@event);
    }
    void AddIcon(ScheduleTimerEvent @event)
    {
        var icon = @event.prefab.GetComponent <TrapIcon>();

        if (icon)
        {
            var amount   = @event.timer / ScheduleManager.instance.maxTime;
            var position = progress.GetMiddlePoint(amount);
            Debug.Log($"{Screen.width}, {Screen.height}, {progress.start}, {progress.end}, {position.x}");

            var onBar  = Instantiate(icon.prefab, position, Quaternion.identity, transform);
            var inGame = Instantiate(icon.prefab, transform);
            icons.Add(@event, new Icon(onBar, inGame, material));
        }
    }
    public void AddSchedule(float timer, GameObject prefab, Vector3 position, bool planning)
    {
        var @event = new ScheduleTimerEvent(timer, prefab, position);

        schedules.Add(@event);
        if (planning)
        {
            EventBus.Publish(new ScheduleAddEvent()
            {
                @event = @event
            });
        }

        Debug.Log($"[Schedule Manager] schedule {@event} added");
    }