Exemplo n.º 1
0
    /// <summary>
    /// Checks plant state and updates to correct sprite
    /// </summary>
    private void UpdateSprite()
    {
        if (plantData == null)
        {
            plantSprite.PushClear();
            return;
        }
        switch (plantCurrentStage)
        {
        case PlantSpriteStage.None:
            plantSprite.PushClear();
            break;

        case PlantSpriteStage.FullyGrown:
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.FullyGrownSprite);
            plantSprite.PushTexture();
            break;

        case PlantSpriteStage.Dead:
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.DeadSprite);
            plantSprite.PushTexture();
            break;

        case PlantSpriteStage.Growing:
            if (growingPlantStage >= plantData.GrowthSprites.Count)
            {
                Logger.Log($"Plant data does not contain growthsprites for index: {growingPlantStage} in plantData.GrowthSprites. Plant: {plantData.Plantname}");
                return;
            }
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.GrowthSprites[growingPlantStage]);
            plantSprite.PushTexture();
            break;
        }
    }
Exemplo n.º 2
0
 public override void OnSpawnServer(SpawnInfo info)
 {
     if (IsOn)
     {
         spriteHandlerOverlay.PushTexture();
     }
     else
     {
         spriteHandlerOverlay.PushClear();
     }
     base.OnSpawnServer(info);
 }
Exemplo n.º 3
0
        public override void Start()
        {
            pipeData.PipeAction = new MonoActions();
            base.Start();

            if (IsOn)
            {
                spriteHandlerOverlay.PushTexture();
            }
            else
            {
                spriteHandlerOverlay.PushClear();
            }
        }
Exemplo n.º 4
0
        public override void OnSpawnServer(SpawnInfo info)
        {
            GasIndex = CapableFiltering[initalFilterValue.ToString()];

            if (IsOn)
            {
                spriteHandlerOverlay.PushTexture();
            }
            else
            {
                spriteHandlerOverlay.PushClear();
            }
            base.OnSpawnServer(info);
        }
Exemplo n.º 5
0
        public override void Start()
        {
            GasIndex            = CapableFiltering[initalFilterValue.ToString()];
            pipeData.PipeAction = new MonoActions();
            base.Start();

            if (IsOn)
            {
                spriteHandlerOverlay.PushTexture();
            }
            else
            {
                spriteHandlerOverlay.PushClear();
            }
        }
Exemplo n.º 6
0
 public void PushTexture()
 {
     if (spriteHandler != null)
     {
         spriteHandler.PushTexture();
     }
 }
Exemplo n.º 7
0
 public override void UpdateSpritesForImplant(BodyPart implant, ClothingHideFlags INClothingHide, SpriteDataSO Sprite, SpriteOrder _SpriteOrder = null)
 {
     ClothingHide = INClothingHide;
     SpriteOrder  = _SpriteOrder;
     baseSpriteHandler.PushTexture();
     OverlySpriteHandler.PushTexture();
 }
Exemplo n.º 8
0
 private void ServerToggleOutputModeOn()
 {
     outputEnabledIndicator.ChangeSprite((int)OutputEnabledOverlayState.OutputEnabled);
     outputEnabledIndicator.PushTexture();
     electricalNodeControl.TurnOnSupply();
     outputEnabled = true;
 }
Exemplo n.º 9
0
    public void ToggleTypingIcon(bool toggle)
    {
        if (toggle)
        {
            spriteHandler.gameObject.SetActive(true);
            spriteHandler.ChangeSprite(TypingSprite);
            spriteHandler.PushTexture();

            // start coroutine to wait for TypingTimeout
            // if we didn't recived any change for so long - other player must be disconected
            if (coWaitToTurnOff != null)
            {
                StopCoroutine(coWaitToTurnOff);
            }
            coWaitToTurnOff = StartCoroutine(WaitToTurnOff(TypingTimeout));
        }
        else
        {
            spriteHandler.gameObject.SetActive(false);
            if (coWaitToTurnOff != null)
            {
                StopCoroutine(coWaitToTurnOff);
            }
        }
    }
Exemplo n.º 10
0
 private void SetCanisterTier()
 {
     if (canisterTier > 0)
     {
         canisterTierOverlay.PushTexture();
         canisterTierOverlay.ChangeSprite(canisterTier);
     }
 }
Exemplo n.º 11
0
 private void SetUpFromClothingData(EquippedData equippedData)
 {
     spriteDataHandler.Infos = new SpriteData();
     spriteDataHandler.Infos.List.Add(StaticSpriteHandler.CompleteSpriteSetup(equippedData.InHandsLeft));
     spriteDataHandler.Infos.List.Add(StaticSpriteHandler.CompleteSpriteSetup(equippedData.InHandsRight));
     inventoryIcon.Infos = new SpriteData();
     inventoryIcon.Infos.List.Add(StaticSpriteHandler.CompleteSpriteSetup(equippedData.ItemIcon));
     inventoryIcon.PushTexture();
 }
Exemplo n.º 12
0
        private void Start()
        {
            SetCanisterTier();

            // We push pressureIndicatorOverlay ourselves; if not,
            // SpriteHandler will do so but overwrite the current SO when it loads after this component.
            pressureIndicatorOverlay.PushTexture();
            RefreshOverlays();
        }
Exemplo n.º 13
0
 public void SetUpDecal(float timeToLive)
 {
     lifeTime = timeToLive;
     spriteHandler.PushTexture(false);
     if (lightSprite != null)
     {
         lightSprite.LightOrigin = transform.position;
     }
 }
Exemplo n.º 14
0
 public void SetUpFromClothingData(EquippedData equippedData, ItemAttributesData itemAttributes)
 {
     spriteDataHandler.Infos = new SpriteData();
     spriteDataHandler.Infos.List.Add(StaticSpriteHandler.CompleteSpriteSetup(equippedData.InHandsLeft));
     spriteDataHandler.Infos.List.Add(StaticSpriteHandler.CompleteSpriteSetup(equippedData.InHandsRight));
     InventoryIcon.Infos = new SpriteData();
     InventoryIcon.Infos.List.Add(StaticSpriteHandler.CompleteSpriteSetup(equippedData.ItemIcon));
     InventoryIcon.PushTexture();
     AttributesFromCD(itemAttributes);
 }
Exemplo n.º 15
0
        /// <summary>
        /// start displaying the burning animation
        /// </summary>
        public void Burn()
        {
            if (spriteHandler == null)
            {
                spriteHandler = GetComponent <SpriteHandler>();
            }

            spriteHandler.ChangeSprite(0);             // Load SO into SpriteRenderer
            spriteHandler.PushTexture();
        }
Exemplo n.º 16
0
 public void TogglePower()
 {
     IsOn = !IsOn;
     if (IsOn)
     {
         spriteHandlerOverlay.PushTexture();
     }
     else
     {
         spriteHandlerOverlay.PushClear();
     }
 }
Exemplo n.º 17
0
 public override void Interaction(HandApply interaction)
 {
     IsOn = !IsOn;
     if (IsOn)
     {
         spriteHandlerOverlay.PushTexture();
     }
     else
     {
         spriteHandlerOverlay.PushClear();
     }
 }
Exemplo n.º 18
0
    private void SyncStage(PlantSpriteStage newStage)
    {
        if (newStage == plantSyncStage)
        {
            return;
        }

        plantSyncStage = newStage;
        switch (plantSyncStage)
        {
        case PlantSpriteStage.None:
            plantSprite.PushClear();
            break;

        case PlantSpriteStage.FullyGrown:
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.FullyGrownSprite);
            plantSprite.PushTexture();
            break;

        case PlantSpriteStage.Dead:
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.DeadSprite);
            plantSprite.PushTexture();
            break;

        case PlantSpriteStage.Growing:
            plantSprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.GrowthSprites[growingPlantStage]);
            plantSprite.PushTexture();
            break;
        }
    }
Exemplo n.º 19
0
 public void SyncPlant(string _PlantSyncString)
 {
     PlantSyncString = _PlantSyncString;
     if (!isServer)
     {
         if (DefaultPlantData.PlantDictionary.ContainsKey(PlantSyncString))
         {
             plantData = DefaultPlantData.PlantDictionary[PlantSyncString].plantData;
         }
     }
     Sprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.PacketsSprite);
     Sprite.PushTexture();
 }
Exemplo n.º 20
0
        private IEnumerator RunLandingSequence()
        {
            GameObject targetReticule = landingSpriteHandler.gameObject;
            GameObject dropPod        = baseSpriteHandler.gameObject;

            // Initialise target reticule for animating.
            targetReticule.LeanAlpha(0.25f, 0);
            targetReticule.transform.localScale = Vector3.one * 1.5f;

            // Initialise drop pod sprite to the start of falling animation.
            baseSpriteHandler.ChangeSprite((int)BaseSprite.Falling, false);
            dropPod.transform.localScale = Vector3.zero;
            Vector3 localPos = dropPod.transform.localPosition;

            localPos.y = DROP_HEIGHT;
            dropPod.transform.localPosition = localPos;
            registerObject.Passable         = true;

            // ClosetControl initialises, redisplaying the door, so wait a frame...
            yield return(WaitFor.EndOfFrame);

            doorSpriteHandler.PushClear(false);

            // Begin the drop animation.
            dropPod.LeanScale(Vector3.one, TRAVEL_TIME);
            dropPod.LeanMoveLocalY(0, TRAVEL_TIME);

            // Animate the target reticule.
            targetReticule.LeanScale(Vector3Int.one, TRAVEL_TIME / 2);
            targetReticule.LeanRotateZ(-270, TRAVEL_TIME);
            targetReticule.LeanAlpha(0.75f, TRAVEL_TIME / 2);

            yield return(WaitFor.Seconds(TRAVEL_TIME));

            // Swap to stationary drop pod.
            if (IsServer)
            {
                closetControl.ServerToggleLocked(false);
            }
            baseSpriteHandler.ChangeSprite((int)BaseSprite.Stationary, false);
            doorSpriteHandler.PushTexture(false);
            landingSpriteHandler.PushClear(false);
            registerObject.Passable = false;

            // Create a small explosion to apply damage to objects underneath.
            var matrixInfo = MatrixManager.AtPoint(WorldPosition, IsServer);

            Explosion.StartExplosion(registerObject.LocalPosition, EXPLOSION_STRENGTH, matrixInfo.Matrix);

            isLanding = false;
        }
Exemplo n.º 21
0
 public void SyncPlant(string _OldPlantSyncString, string _PlantSyncString)
 {
     PlantSyncString = _PlantSyncString;
     if (!isServer)
     {
         if (DefaultPlantData.PlantDictionary.ContainsKey(PlantSyncString))
         {
             plantData = DefaultPlantData.PlantDictionary[PlantSyncString].plantData;
         }
     }
     SpriteHandler.spriteData = SpriteFunctions.SetupSingleSprite(plantData.ProduceSprite);
     SpriteHandler.PushTexture();
     if (ItemAttributesV2 == null)
     {
         ItemAttributesV2 = this.GetComponent <ItemAttributesV2>();
     }
     if (isServer && ItemAttributesV2 != null)
     {
         ItemAttributesV2.ServerSetArticleDescription(plantData.Description);
         ItemAttributesV2.ServerSetArticleName(plantData.Plantname);
     }
     this.name = plantData.Plantname;
 }
Exemplo n.º 22
0
        public void OnSpawnServer(SpawnInfo info)
        {
            // Update gas mix manually, in case Canister component loads before GasContainer.
            // This ensures pressure indicator and canister tier are set correctly.
            GasContainer.UpdateGasMix();

            SetCanisterTier();

            // We push pressureIndicatorOverlay ourselves; if not,
            // SpriteHandler will do so but overwrite the current SO when it loads after this component.
            pressureIndicatorOverlay.PushTexture();
            RefreshOverlays();
            SetValve(valveIsInitiallyOpen);
            GasContainer.ServerContainerExplode += OnContainerExploded;
        }
Exemplo n.º 23
0
    /*public static SeedPacket CreateSeedPacketInstance(SeedPacket seedPacket)
     * {
     *      return new SeedPacket
     *      {
     *              name = seedPacket.name,
     *              Sprite = seedPacket.Sprite,
     *              plantData = PlantData.CreateNewPlant(seedPacket.plantData),
     *              defaultPlantData = seedPacket.defaultPlantData,
     *              PlantSyncString = seedPacket.plantData.Name
     *      };
     * }*/

    public void SyncPlant(string _OldPlantSyncString, string _PlantSyncString)
    {
        //EnsureInit();
        PlantSyncString = _PlantSyncString;

        /*if (!isServer)
         * {
         *      if (DefaultPlantData.PlantDictionary.ContainsKey(PlantSyncString))
         *      {
         *              plantData = DefaultPlantData.PlantDictionary[PlantSyncString].plantData;
         *      }
         * }*/
        Sprite.spriteData = SpriteFunctions.SetupSingleSprite(plantData.PacketsSprite);
        Sprite.PushTexture();
    }
Exemplo n.º 24
0
 private void OnSyncState(bool oldState, bool newState)
 {
     isOn = newState;
     if (isOn)
     {
         baseSpriteHandler.PushTexture();
         generatorRunSfx.Play();
         smokeParticles.Play();
     }
     else
     {
         generatorRunSfx.Stop();
         smokeParticles.Stop();
         generatorEndSfx.Play();
     }
 }
Exemplo n.º 25
0
 /// <summary>
 /// Shows harvest ready sprite on tray if flag is set and tray is not a soil pile
 /// </summary>
 /// <param name="oldNotifier"></param>
 /// <param name="newNotifier"></param>
 private void UpdateHarvestFlag(bool oldNotifier, bool newNotifier)
 {
     if (isSoilPile)
     {
         return;
     }
     showHarvestFlag = newNotifier;
     if (showHarvestFlag)
     {
         harvestNotifier.PushTexture();
     }
     else
     {
         harvestNotifier.PushClear();
     }
 }
Exemplo n.º 26
0
 /// <summary>
 /// Shows low water sprite on tray if flag is set and tray is not a soil pile
 /// </summary>
 /// <param name="oldNotifier"></param>
 /// <param name="newNotifier"></param>
 private void UpdateWaterFlag(bool oldNotifier, bool newNotifier)
 {
     if (isSoilPile)
     {
         return;
     }
     showWaterFlag = newNotifier;
     if (showWaterFlag)
     {
         waterNotifier.PushTexture();
     }
     else
     {
         waterNotifier.PushClear();
     }
 }
Exemplo n.º 27
0
 private void OnSyncState(bool oldState, bool newState)
 {
     isOn = newState;
     if (isOn)
     {
         baseSpriteHandler.PushTexture();
         smokeParticles.Play();
         runLoopGUID = Guid.NewGuid().ToString();
         SoundManager.PlayAtPositionAttached(generatorRunSfx, registerTile.WorldPosition, gameObject, runLoopGUID);
     }
     else
     {
         SoundManager.Stop(runLoopGUID);
         smokeParticles.Stop();
         _ = SoundManager.PlayAtPosition(generatorEndSfx, registerTile.WorldPosition, gameObject);
     }
 }
Exemplo n.º 28
0
    /// <summary>
    /// Shows low nutriment sprite on tray if flag is set and tray is not a soil pile
    /// </summary>
    /// <param name="oldNotifier"></param>
    /// <param name="newNotifier"></param>
    private void UpdateNutrimentFlag(bool oldNotifier, bool newNotifier)
    {
        if (isSoilPile)
        {
            return;
        }

        showNutrimenetFlag = newNotifier;
        if (showNutrimenetFlag)
        {
            nutrimentNotifier.PushTexture();
        }
        else
        {
            nutrimentNotifier.PushClear();
        }
    }
Exemplo n.º 29
0
    private void SyncWater(bool newNotifier)
    {
        if (isSoilPile ||
            newNotifier == syncWaterNotifier)
        {
            return;
        }

        syncWaterNotifier = newNotifier;
        if (syncWaterNotifier)
        {
            waterNotifier.PushTexture();
        }
        else
        {
            waterNotifier.PushClear();
        }
    }
Exemplo n.º 30
0
    private void SyncNutriment(bool newNotifier)
    {
        if (isSoilPile ||
            newNotifier == syncNutrimentNotifier)
        {
            return;
        }

        syncNutrimentNotifier = newNotifier;
        if (syncNutrimentNotifier)
        {
            nutrimentNotifier.PushTexture();
        }
        else
        {
            nutrimentNotifier.PushClear();
        }
    }