示例#1
0
        OBCTurret(Entity& mE, OBCPhys& mCPhys, OBCDraw& mCDraw,
            OBCKillable& mCKillable, Dir8 mDir, const OBWpnType& mWpn,
            float mShootDelay, float mPJDelay, int mShootCount) noexcept
            : OBCActor{mE, mCPhys, mCDraw},
              cKillable(mCKillable),
              direction{mDir},
              wpn{game, OBGroup::GFriendlyKillable, mWpn},
              shootDelay{mShootDelay},
              pjDelay{mPJDelay},
              shootCount{mShootCount}
        {
            cDraw.setRotation(getDegFromDir8(direction));

            getEntity().addGroups(OBGroup::GEnemy, OBGroup::GEnemyKillable);
            body.setResolve(false);
            body.addGroups(OBGroup::GSolidGround, OBGroup::GSolidAir,
                OBGroup::GEnemy, OBGroup::GKillable, OBGroup::GEnemyKillable);

            tckShoot.restart(shootDelay);
            repeat(tlShoot,
                [this]
                {
                    shoot();
                },
                shootCount, pjDelay);

            cKillable.onDeath += [this]
            {
                game.createEShard(5, cPhys.getPosI());
            };
        }
示例#2
0
 inline void setCooldown(FT mValue) noexcept
 {
     tckCooldown.restart(mValue);
 }