Example #1
0
    void Start()
    {
        ui     = GetComponent <MainUILink>();
        assets = GetComponent <MainAssetLink>();

        GameEvents.Instance.ActorAdded += (g, a) =>
        {
            EnqueueEvent(new ActorAddedRenderer(this, a));
            EnqueueEvent(new ActorPositionRenderer(this, a));
        };
        GameEvents.Instance.ActorDirectionChange += (a, old) =>
        {
            if (actorIdToCharacterSlot.ContainsKey(a.id))
            {
                EnqueueEvent(new ActorPositionRenderer(this, a));
            }
        };
        GameEvents.Instance.ActorPositionChange += (a, old) =>
        {
            if (actorIdToCharacterSlot.ContainsKey(a.id))
            {
                EnqueueEvent(new ActorPositionRenderer(this, a));
            }
        };
        GameEvents.Instance.ActorRemoved += (g, a) =>
        {
            EnqueueEvent(new ActorRemovedRenderer(a));
        };
        GameEvents.Instance.RoundStart += g =>
        {
            Debug.Log("start of turn");
            EnqueueEvent(new RoundStartRenderer(g.NumRounds));
        };
        GameEvents.Instance.ActorActionsStart += (g, a) =>
        {
            Debug.Log($"{a.uniqueName} starts");
            EnqueueEvent(new ActorActionsStartRenderer(this, a));
        };
        GameEvents.Instance.ActorActionsEnd += (g, a) =>
        {
            Debug.Log($"{a.uniqueName} ends");
            EnqueueEvent(new ActorActionsEndRenderer(this, a));
        };
        GameEvents.Instance.ActorTargetedChange += a =>
        {
            Debug.Log($"{a.uniqueName} targeted {a.Targeted}");
            EnqueueEvent(new TargetedChangeRenderer(this, a));
        };
        GameEvents.Instance.AttackStart += (a, b) =>
        {
            Debug.Log($"{a.uniqueName} attacks {b.uniqueName}");
            EnqueueEvent(new AttackRenderer(this, a, b));
        };
        GameEvents.Instance.ActorHealthChange += (a, oldHealth, newHealth) =>
        {
            Debug.Log($"{a.uniqueName} health {oldHealth} => {newHealth}");
            EnqueueEvent(new HealthChangeRenderer(this, a, oldHealth, newHealth));
        };
        GameEvents.Instance.Death += a =>
        {
            Debug.Log($"RIP {a.uniqueName}");
            EnqueueEvent(new DeathRenderer(this, a));
        };
    }
Example #2
0
    void Start()
    {
        ui = GetComponent <MainUILink>();

        SetRunState(RunState.Idle);
    }