Example #1
0
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);
}
Example #2
0
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);
}
Example #3
0
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()));
}