Exemplo n.º 1
0
    public GameObject CreatePrefab()
    {
        GameObject gameObject = CreatePrefab(ID, MISC.PLACERS.MOPPLACER.NAME, Assets.instance.mopPlacerAssets.material);

        gameObject.AddTag(GameTags.NotConversationTopic);
        Moppable moppable = gameObject.AddOrGet <Moppable>();

        moppable.synchronizeAnims    = false;
        moppable.amountMoppedPerTick = 20f;
        gameObject.AddOrGet <Cancellable>();
        return(gameObject);
    }
 protected override void OnDragTool(int cell, int distFromOrigin)
 {
     if (Grid.IsValidCell(cell))
     {
         if (DebugHandler.InstantBuildMode)
         {
             if (Grid.IsValidCell(cell))
             {
                 Moppable.MopCell(cell, 1000000f, null);
             }
         }
         else
         {
             GameObject gameObject = Grid.Objects[cell, 8];
             if (!Grid.Solid[cell] && (Object)gameObject == (Object)null && Grid.Element[cell].IsLiquid)
             {
                 bool flag  = Grid.Solid[Grid.CellBelow(cell)];
                 bool flag2 = Grid.Mass[cell] <= maxMopAmt;
                 if (flag && flag2)
                 {
                     gameObject = (Grid.Objects[cell, 8] = Util.KInstantiate(Placer, null, null));
                     Vector3 position = Grid.CellToPosCBC(cell, visualizerLayer);
                     float   num      = -0.15f;
                     position.z += num;
                     gameObject.transform.SetPosition(position);
                     gameObject.SetActive(true);
                 }
                 else
                 {
                     string text = UI.TOOLS.MOP.TOO_MUCH_LIQUID;
                     if (!flag)
                     {
                         text = UI.TOOLS.MOP.NOT_ON_FLOOR;
                     }
                     PopFXManager.Instance.SpawnFX(PopFXManager.Instance.sprite_Negative, text, null, Grid.CellToPosCBC(cell, visualizerLayer), 1.5f, false, false);
                 }
             }
             if ((Object)gameObject != (Object)null)
             {
                 Prioritizable component = gameObject.GetComponent <Prioritizable>();
                 if ((Object)component != (Object)null)
                 {
                     component.SetMasterPriority(ToolMenu.Instance.PriorityScreen.GetLastSelectedPriority());
                 }
             }
         }
     }
 }