protected override bool processSignal(MindSignal signal) { if (signal is BillSignal bill) { paid += bill.price; return(true); } return(false); }
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); } }
/// <summary> /// handle mind signals /// </summary> /// <param name="signal"></param> /// <returns>whether the signal was handled</returns> protected abstract bool processSignal(MindSignal signal);
public void signal(MindSignal signal) { state.signalQueue.Enqueue(signal); }