private IEnumerator VisUpdater()
    {
        conduitMgr.StashVisualGrids();
        if (path.Count == 1)
        {
            PathNode node = path[0];
            path[0] = CreateVisualizer(node);
        }
        ApplyPathToConduitSystem();
        for (int i = 0; i < path.Count; i++)
        {
            PathNode pathNode = path[i];
            pathNode = CreateVisualizer(pathNode);
            path[i]  = pathNode;
            string text = conduitMgr.GetVisualizerString(pathNode.cell) + "_place";
            KBatchedAnimController component = pathNode.visualizer.GetComponent <KBatchedAnimController>();
            if (component.HasAnimation(text))
            {
                pathNode.Play(text);
            }
            else
            {
                pathNode.Play(conduitMgr.GetVisualizerString(pathNode.cell));
            }
            component.TintColour = ((!def.IsValidBuildLocation(null, pathNode.cell, Orientation.Neutral, out string _)) ? Color.red : Color.white);
            TileVisualizer.RefreshCell(pathNode.cell, def.TileLayer, def.ReplacementLayer);
        }
        conduitMgr.UnstashVisualGrids();
        yield return((object)null);

        /*Error: Unable to find new state assignment for yield return*/;
    }
Ejemplo n.º 2
0
 public override void BeginTransition(Navigator navigator, Navigator.ActiveTransition transition)
 {
     base.BeginTransition(navigator, transition);
     CreatureCalorieMonitor.Instance sMI = navigator.GetSMI <CreatureCalorieMonitor.Instance>();
     if (sMI != null && sMI.stomach.IsReadyToPoop())
     {
         KBatchedAnimController component = navigator.GetComponent <KBatchedAnimController>();
         string s = HashCache.Get().Get(transition.anim.HashValue) + "_full";
         if (component.HasAnimation(s))
         {
             transition.anim = s;
         }
     }
 }
Ejemplo n.º 3
0
        public UtilityVisual(BuildingConfig buildingConfig, int cell)
        {
            Offset = buildingConfig.Offset;
            this.buildingConfig = buildingConfig;
            this.cell           = cell;

            Vector3 positionCBC = Grid.CellToPosCBC(cell, buildingConfig.BuildingDef.SceneLayer);

            Visualizer = GameUtil.KInstantiate(buildingConfig.BuildingDef.BuildingPreview, positionCBC, Grid.SceneLayer.Ore, "BlueprintModUtilityVisualizer", LayerMask.NameToLayer("Place"));
            Visualizer.transform.SetPosition(positionCBC);
            Visualizer.SetActive(true);

            if (Visualizer.GetComponent <Rotatable>() != null)
            {
                Visualizer.GetComponent <Rotatable>().SetOrientation(buildingConfig.Orientation);
            }

            KBatchedAnimController batchedAnimController = Visualizer.GetComponent <KBatchedAnimController>();

            if (batchedAnimController != null)
            {
                IUtilityNetworkMgr utilityNetworkManager = buildingConfig.BuildingDef.BuildingComplete.GetComponent <IHaveUtilityNetworkMgr>().GetNetworkManager();

                if (utilityNetworkManager != null)
                {
                    string animation = utilityNetworkManager.GetVisualizerString((UtilityConnections)buildingConfig.Flags) + "_place";

                    if (batchedAnimController.HasAnimation(animation))
                    {
                        batchedAnimController.Play(animation);
                    }
                }

                batchedAnimController.visibilityType = KAnimControllerBase.VisibilityType.Always;
                batchedAnimController.isMovable      = true;
                batchedAnimController.Offset         = buildingConfig.BuildingDef.GetVisualizerOffset() + buildingConfig.BuildingDef.placementPivot;
                batchedAnimController.TintColour     = GetVisualizerColor(cell);

                batchedAnimController.SetLayer(LayerMask.NameToLayer("Place"));
            }

            else
            {
                Visualizer.SetLayerRecursively(LayerMask.NameToLayer("Place"));
            }

            VisualsUtilities.SetVisualizerColor(cell, GetVisualizerColor(cell), Visualizer, buildingConfig);
        }
 public void Refresh()
 {
     if (connectionManager != null && !skipRefresh)
     {
         int cell = Grid.PosToCell(base.transform.GetPosition());
         Connections = connectionManager.GetConnections(cell, isPhysicalBuilding);
         KBatchedAnimController component = GetComponent <KBatchedAnimController>();
         if ((UnityEngine.Object)component != (UnityEngine.Object)null)
         {
             string text = connectionManager.GetVisualizerString(cell);
             BuildingUnderConstruction component2 = GetComponent <BuildingUnderConstruction>();
             if ((UnityEngine.Object)component2 != (UnityEngine.Object)null && component.HasAnimation(text + "_place"))
             {
                 text += "_place";
             }
             if (text != null && text != string.Empty)
             {
                 component.Play(text, KAnim.PlayMode.Once, 1f, 0f);
             }
         }
     }
 }