Ejemplo n.º 1
0
void CtfHatActionRenderer::FillRenderableSprites( const Actor& actor, IRenderableComponent const& renderableC, RenderableSprites_t& renderableSprites )
{
    SpriteCollection const& Sprites = mRenderableRepo( actor.GetId() );
    Sprite const& Spr = Sprites( mCtfHatId );
    if( Spr.IsValid() )
    {
        //         Opt<PlayerControllerComponent> playerCC=actor.Get<IControllerComponent>();
        //         if (playerCC.IsValid())
        //         {
        //             Opt< ::ctf::ClientData> ctfClientData(::ctf::ProgramState::Get().FindClientDataByClientId(playerCC->mControllerId));
        //             if (ctfClientData.IsValid())
        //             {
        Opt<ITeamComponent> teamC( actor.Get<ITeamComponent>() );
        if ( teamC.IsValid() )
        {
            SpritePhase const& Phase = Spr( ( int32_t )GetState() );
            glm::vec4 col = ColorRepo::Get()( teamC->GetTeam() );
            col.a = GetCloakColor( actor ).a;
            col = col * GetColor( actor );
            renderableSprites.push_back(
                RenderableSprite( &actor, &renderableC, mCtfHatId, &Spr, &Phase, col ) );
        }
        //             }
        //
        //         }
    }
}
Ejemplo n.º 2
0
void CtfHatActionRenderer::Init( Actor const& actor )
{
    SpriteCollection const& Sprites = mRenderableRepo( actor.GetId() );
    Sprite const& Spr = Sprites( mCtfHatId );
    if( Spr.IsValid() )
    {
        mSecsToEnd = Spr.GetSecsToEnd();
    }
}
Ejemplo n.º 3
0
void HatActionRenderer::FillRenderableSprites( const Actor& actor, IRenderableComponent const& renderableC, RenderableSprites_t& renderableSprites )
{
    SpriteCollection const& Sprites = mRenderableRepo( actor.GetId() );
    Sprite const& Spr = Sprites( mHatId );
    if( Spr.IsValid() )
    {
        SpritePhase const& Phase = Spr( ( int32_t )GetState() );
        Opt<PlayerControllerComponent> playerCC = actor.Get<PlayerControllerComponent>();
        glm::vec4 col = playerCC.IsValid() ? ColorRepo::Get()( playerCC->mControllerId ) : glm::vec4( 1, 1, 1, 1 );
        col.a = GetCloakColor( actor ).a;
        renderableSprites.push_back(
            RenderableSprite( &actor, &renderableC, mHatId, &Spr, &Phase, col ) );
    }
}
Ejemplo n.º 4
0
void HatActionRenderer::Init( const Actor& actor )
{
    Opt<Weapon> weapon = actor.Get<IInventoryComponent>()->GetSelectedWeapon();
    if ( !weapon.IsValid() )
    {
        return;
    }
    SpriteCollection const& Sprites = mRenderableRepo( actor.GetId() );
    Sprite const& Spr = Sprites( mHatId );
    if( Spr.IsValid() )
    {
        mSecsToEnd = Spr.GetSecsToEnd();
    }
}
Ejemplo n.º 5
0
void IdleActionRenderer::Init( const Actor& actor )
{
    int32_t actorId = actor.GetId();
    auto renderableC( actor.Get<IRenderableComponent>() );
    actorId = GetSpriteId( renderableC->GetSpriteIndex(), actorId );
    
    SpriteCollection const& Sprites = mRenderableRepo( actorId );
    static int32_t aid = AutoId( "body_idle" );
    Sprite const& Spr = Sprites( aid );
    if( Spr.IsValid() )
    {
        mSpr = &Spr;
        mSecsToEnd = Spr.GetSecsToEnd();
    }
}