private void ChangeLightState(LightMountState newState)
    {
        if (!EnsureInit())
        {
            return;
        }

        if (newState == LightMountState.On)
        {
            lightSource.ServerChangeLightState(LightState.On);
            spriteRenderer.sprite        = GetSprite(spriteListFull);
            spriteRendererLightOn.sprite = GetSprite(spriteListLightOn);
            integrity.soundOnHit         = "GlassHit";
            return;
        }

        if (newState == LightMountState.MissingBulb)
        {
            spriteRenderer.sprite = GetSprite(spriteListMissingBulb);
            integrity.soundOnHit  = "";
        }
        else if (newState == LightMountState.Broken)
        {
            spriteRenderer.sprite = GetSprite(spriteListBroken);
            integrity.soundOnHit  = "GlassStep";
        }
        else if (newState == LightMountState.Off)
        {
            spriteRenderer.sprite = GetSprite(spriteListFull);
            integrity.soundOnHit  = "GlassHit";
        }
        lightSource.ServerChangeLightState(LightState.Off);
        spriteRendererLightOn.sprite = null;
    }
        internal void ServerSetState(State state)
        {
            constructionState = state;

            switch (constructionState)
            {
            case State.initial:
                spriteHandler.SetSpriteSO(initialStateSprites);
                break;

            case State.wiresAdded:
                lightSource.ServerChangeLightState(LightMountState.None);
                spriteHandler.SetSpriteSO(wiresAddedStateSprites);
                break;

            case State.ready:
            default:
                lightSource.ServerChangeLightState(LightMountState.MissingBulb);
                break;
            }
        }
Exemplo n.º 3
0
        internal void ServerSetState(State state)
        {
            constructionState = state;

            switch (constructionState)
            {
            case State.initial:
                spriteHandler.SetSpriteSO(initialStateSprites, newVariantIndex: SpritesDirectional.OrientationIndex(directional.CurrentDirection.AsEnum()));
                break;

            case State.wiresAdded:
                lightSource.ServerChangeLightState(LightMountState.None);
                spriteHandler.SetSpriteSO(wiresAddedStateSprites, newVariantIndex: SpritesDirectional.OrientationIndex(directional.CurrentDirection.AsEnum()));
                break;

            case State.ready:
            default:
                lightSource.ServerChangeLightState(LightMountState.MissingBulb);
                break;
            }
        }