bool MPix::IKilling::tryKillThat( const Context& context, int target ) { assert(killing); auto me = dynamic_pointer_cast<IKilling> ( context.GetByID(this->GetID())); assert(me); // will be strange having null here... return killing->tryKillThat(me, context, target); }
bool MPix::IAssembled::growThis( const Context& context ) { assert(grower); auto me = dynamic_pointer_cast<IAssembled> ( context.GetByID(this->GetID())); assert(me); // will be strange having null here... return grower->growThis(me, context); }
bool MPix::IAlive::canLive( const Context& context ) { assert(alive); // AliveBehavior not set auto me = dynamic_pointer_cast<IAlive> ( context.GetByID(this->GetID())); assert(me); // will be strange having null here... return alive->canLive(me, context); }
shared_ptr<IAssembled> MPix::AssembledMagneticBase::tryMagnetizeToMe( const Context& context, shared_ptr<Pixel> pix ) { // Allow to magnetize, return myself return dynamic_pointer_cast<IAssembled>(context.GetByID(GetID())); }