Пример #1
0
            protected override bool processSignal(MindSignal signal)
            {
                if (signal is BillSignal bill)
                {
                    paid += bill.price;
                    return(true);
                }

                return(false);
            }
Пример #2
0
        protected override bool processSignal(MindSignal result)
        {
            switch (result)
            {
            case ItemSignals.CapsuleAcquiredSignal sig: {
                var from = sig.cap.interactor;
                if (from != null && from != mind.state.me)
                {
                    // run a feeding interaction
                    var interaction = new FeedInteraction(sig);
                    interaction.run(mind, from.mind);
                }

                return(true);
            }

            case PhysicalSignals.ShotSignal sig: {
                var from = sig.gun.Entity.GetComponent <Wing>();
                if (from != null && from != mind.state.me)
                {
                    // run a being shot interaction
                    var interaction = new ShotInteraction(from, sig);
                    interaction.run(mind, from.mind);
                }

                return(true);
            }

            case PhysicalSignals.BumpSignal sig: {
                var from = sig.wing;
                if (from != null && from != mind.state.me)
                {
                    // run an interaction for being bumped
                    var interaction = new BumpInteraction(sig);
                    interaction.run(mind, from.mind);
                }

                return(true);
            }

            default:
                return(false);
            }
        }
Пример #3
0
 /// <summary>
 /// handle mind signals
 /// </summary>
 /// <param name="signal"></param>
 /// <returns>whether the signal was handled</returns>
 protected abstract bool processSignal(MindSignal signal);
Пример #4
0
 public void signal(MindSignal signal)
 {
     state.signalQueue.Enqueue(signal);
 }