public override void DoPostConfigureComplete(GameObject go)
        {
            var def = go.AddOrGetDef <RanchStation.Def>();

            def.isCreatureEligibleToBeRanchedCb = delegate(GameObject creature_go, RanchStation.Instance ranch_station_smi)
            {
                var butcherStation = ranch_station_smi.GetComponent <ButcherStation>();
                return(butcherStation?.IsCreatureEligibleToBeButched(creature_go) ?? false);
            };
            def.onRanchCompleteCb = delegate(GameObject creature_go)
            {
                ButcherStation.ButchCreature(creature_go, true);
            };
            def.getTargetRanchCell = delegate(RanchStation.Instance smi)
            {
                if (!smi.IsNullOrStopped())
                {
                    int cell = Grid.CellBelow(Grid.PosToCell(smi.transform.GetPosition()));
                    cell = Grid.OffsetCell(cell, 0, -FishingStationGuide.GetDepthAvailable(smi.gameObject, out _));
                    if (Grid.IsValidCell(cell))
                    {
                        return(cell);
                    }
                }
                return(Grid.InvalidCell);
            };
            def.interactLoopCount   = 1;
            def.rancherInteractAnim = "anim_interacts_fishingstation_kanim";
            def.ranchedPreAnim      = "bitehook";
            def.ranchedLoopAnim     = "caught_loop";
            def.ranchedPstAnim      = "trapped_pre";
            def.synchronizeBuilding = true;
            Prioritizable.AddRef(go);
            go.AddOrGet <FishingStationGuide>().type = FishingStationGuide.GuideType.Complete;
        }
示例#2
0
        public static void AddGuide(GameObject go, bool preview = true, bool occupy_tiles = false, bool foundament = false)
        {
            GameObject gameObject = new GameObject();

            gameObject.transform.parent = go.transform;
            gameObject.transform.SetLocalPosition(Vector3.zero);
            KBatchedAnimController kbatchedAnimController = gameObject.AddComponent <KBatchedAnimController>();

            kbatchedAnimController.Offset    = go.GetComponent <Building>().Def.GetVisualizerOffset();
            kbatchedAnimController.AnimFiles = new KAnimFile[]
            {
                Assets.GetAnim(new HashedString("fishing_line_kanim"))
            };
            kbatchedAnimController.initialAnim    = preview ? (foundament ? "foundament" : "place") : "hook";
            kbatchedAnimController.visibilityType = KAnimControllerBase.VisibilityType.OffscreenUpdate;
            kbatchedAnimController.sceneLayer     = Grid.SceneLayer.BuildingBack;
            kbatchedAnimController.isMovable      = true;
            kbatchedAnimController.PlayMode       = preview ? KAnim.PlayMode.Once : KAnim.PlayMode.Loop;
            if (!foundament)
            {
                FishingStationGuide fishingStationGuide = gameObject.AddComponent <FishingStationGuide>();
                fishingStationGuide.parent      = go;
                fishingStationGuide.occupyTiles = occupy_tiles;
                fishingStationGuide.isPreview   = preview;
            }
        }
示例#3
0
        public override void DoPostConfigureComplete(GameObject go)
        {
            RanchStation.Def def = go.AddOrGetDef <RanchStation.Def>();
            def.isCreatureEligibleToBeRanchedCb = delegate(GameObject creature_go, RanchStation.Instance ranch_station_smi)
            {
                ButcherStation butcherStation = ranch_station_smi.GetComponent <ButcherStation>();
                if (butcherStation != null)
                {
                    return(butcherStation.IsCreatureEligibleToBeButched(creature_go));
                }
                return(false);
            };
            def.onRanchCompleteCb = delegate(GameObject creature_go)
            {
                /*
                 * RanchStation.Instance smi = creature_go.GetSMI<RanchableMonitor.Instance>()?.targetRanchStation;
                 * if (smi != null)
                 * {
                 *  creature_go.transform.SetPosition(smi.transform.GetPosition());
                 * }
                 * creature_go.GetSMI<DeathMonitor.Instance>()?.Kill(Db.Get().Deaths.Generic);
                 */
                ButcherStation.ButchCreature(creature_go, true);
            };
            def.getTargetRanchCell = delegate(RanchStation.Instance smi)
            {
                int num = Grid.InvalidCell;
                if (!smi.IsNullOrStopped())
                {
                    bool water;
                    num = Grid.CellBelow(Grid.PosToCell(smi.transform.GetPosition()));
                    num = Grid.OffsetCell(num, 0, -FishingStationGuide.GetDepthAvailable(smi.gameObject, out water));
                }
                return(num);
            };
            def.interactLoopCount   = 1;
            def.rancherInteractAnim = "anim_interacts_fishingstation_kanim";
            def.ranchedPreAnim      = "bitehook";
            def.ranchedLoopAnim     = "caught_loop";
            def.ranchedPstAnim      = "trapped_pre";
            def.synchronizeBuilding = true;
            Prioritizable.AddRef(go);

            AddGuide(go: go.GetComponent <Building>().Def.BuildingPreview, preview: true, occupy_tiles: false);
            AddGuide(go: go.GetComponent <Building>().Def.BuildingPreview, foundament: true);

            AddGuide(go: go.GetComponent <Building>().Def.BuildingUnderConstruction, preview: true, occupy_tiles: true);
            AddGuide(go: go.GetComponent <Building>().Def.BuildingUnderConstruction, foundament: true);

            AddGuide(go: go.GetComponent <Building>().Def.BuildingComplete, preview: false, occupy_tiles: true);
        }