protected override void OnActivateTool()
    {
        active = true;
        base.OnActivateTool();
        GameObject prefab = Assets.GetPrefab(previewTag);

        Grid.SceneLayer sceneLayer = Grid.SceneLayer.Front;
        int             gameLayer  = LayerMask.NameToLayer("Place");

        visualizer = GameUtil.KInstantiate(prefab, sceneLayer, null, gameLayer);
        KBatchedAnimController component = visualizer.GetComponent <KBatchedAnimController>();

        if ((Object)component != (Object)null)
        {
            component.visibilityType = KAnimControllerBase.VisibilityType.Always;
            component.isMovable      = true;
        }
        visualizer.SetActive(true);
        ShowToolTip();
        BuildToolHoverTextCard component2 = GetComponent <BuildToolHoverTextCard>();

        component2.currentDef = null;
        ResourceRemainingDisplayScreen.instance.ActivateDisplay(visualizer);
        if ((Object)component == (Object)null)
        {
            visualizer.SetLayerRecursively(LayerMask.NameToLayer("Place"));
        }
        else
        {
            component.SetLayer(LayerMask.NameToLayer("Place"));
        }
        GridCompositor.Instance.ToggleMajor(true);
    }
예제 #2
0
 public void SpawnPrefabLate(int x, int y, string name, Grid.SceneLayer scene_layer = Grid.SceneLayer.Ore)
 {
     RunAfterNextUpdate(delegate
     {
         SpawnPrefab(RootCell, x, y, name, scene_layer);
     });
 }
예제 #3
0
        private void Initialize(KAnimControllerBase master, Grid.SceneLayer layer)
        {
            KBatchedAnimController effect = CreateEffect(master, layer);

            master.SetSymbolVisiblity("back", false);
            new KAnimLink(masterAnim, effect);
        }
예제 #4
0
    public GameObject CreatePrefab()
    {
        string    id          = "ResearchDatabank";
        string    name        = ITEMS.INDUSTRIAL_PRODUCTS.RESEARCH_DATABANK.NAME;
        string    desc        = ITEMS.INDUSTRIAL_PRODUCTS.RESEARCH_DATABANK.DESC;
        float     mass        = 1f;
        bool      unitMass    = true;
        KAnimFile anim        = Assets.GetAnim("floppy_disc_kanim");
        string    initialAnim = "object";

        Grid.SceneLayer sceneLayer = Grid.SceneLayer.Front;
        EntityTemplates.CollisionShape collisionShape = EntityTemplates.CollisionShape.CIRCLE;
        float      width        = 0.35f;
        float      height       = 0.35f;
        bool       isPickupable = true;
        List <Tag> list         = new List <Tag>();

        list.Add(GameTags.IndustrialIngredient);
        list.Add(GameTags.Experimental);
        list = list;
        GameObject     gameObject     = EntityTemplates.CreateLooseEntity(id, name, desc, mass, unitMass, anim, initialAnim, sceneLayer, collisionShape, width, height, isPickupable, 0, SimHashes.Creature, list);
        EntitySplitter entitySplitter = gameObject.AddOrGet <EntitySplitter>();

        entitySplitter.maxStackSize = (float)ROCKETRY.DESTINATION_RESEARCH.BASIC;
        return(gameObject);
    }
예제 #5
0
    public void RegisterEquipment(IEquipmentConfig config)
    {
        EquipmentDef equipmentDef      = config.CreateEquipmentDef();
        string       id                = equipmentDef.Id;
        string       name              = equipmentDef.Name;
        string       recipeDescription = equipmentDef.RecipeDescription;
        float        mass              = equipmentDef.Mass;
        bool         unitMass          = true;
        KAnimFile    anim              = equipmentDef.Anim;
        string       initialAnim       = "object";

        Grid.SceneLayer sceneLayer = Grid.SceneLayer.Ore;
        EntityTemplates.CollisionShape collisionShape = equipmentDef.CollisionShape;
        float      width         = equipmentDef.width;
        float      height        = equipmentDef.height;
        bool       isPickupable  = true;
        SimHashes  outputElement = equipmentDef.OutputElement;
        GameObject gameObject    = EntityTemplates.CreateLooseEntity(id, name, recipeDescription, mass, unitMass, anim, initialAnim, sceneLayer, collisionShape, width, height, isPickupable, 0, outputElement, null);
        Equippable equippable    = gameObject.AddComponent <Equippable>();

        equippable.def = equipmentDef;
        Debug.Assert((Object)equippable.def != (Object)null);
        equippable.slotID = equipmentDef.Slot;
        Debug.Assert(equippable.slot != null);
        config.DoPostConfigure(gameObject);
        Assets.AddPrefab(gameObject.GetComponent <KPrefabID>());
    }
 protected KAnimControllerBase()
 {
     KAnim.Anim.Frame invalidFrame = KAnim.Anim.Frame.InvalidFrame;
     curAnimFrameIdx = invalidFrame.idx;
     KAnim.Anim.Frame invalidFrame2 = KAnim.Anim.Frame.InvalidFrame;
     prevAnimFrame      = invalidFrame2.idx;
     eventManagerHandle = HandleVector <int> .InvalidHandle;
     overrideAnimFiles  = new List <OverrideAnimFileData>();
     DeepProfiler       = new DeepProfiler(false);
     playSpeed          = 1f;
     mode          = KAnim.PlayMode.Once;
     stopped       = true;
     animHeight    = 1f;
     animWidth     = 1f;
     _enabled      = true;
     hiddenSymbols = new List <KAnimHashedString>();
     anims         = new Dictionary <HashedString, AnimLookupData>();
     overrideAnims = new Dictionary <HashedString, AnimLookupData>();
     animQueue     = new Queue <AnimData>();
     fgLayer       = Grid.SceneLayer.NoLayer;
     base._002Ector();
     previousFrame       = -1;
     currentFrame        = -1;
     PlaySpeedMultiplier = 1f;
     synchronizer        = new KAnimSynchronizer(this);
     layering            = new KAnimLayering(this, fgLayer);
     isVisible           = true;
 }
예제 #7
0
        public GameObject CreatePrefab()
        {
            string    name        = "Bark Skin";
            string    desc        = "Are produced by wooden hatch";
            float     mass        = 1f;//too litle, add more later
            bool      unitMass    = false;
            KAnimFile anim        = Assets.GetAnim("bark_skin_kanim");
            string    initialAnim = "object";

            Grid.SceneLayer sceneLayer = Grid.SceneLayer.Front;
            EntityTemplates.CollisionShape collisionShape = EntityTemplates.CollisionShape.CIRCLE;
            float      width          = 0.35f;
            float      height         = 0.35f;
            bool       isPickupable   = true;
            List <Tag> additionalTags = new List <Tag>
            {
                GameTags.IndustrialIngredient,
                GameTags.Organics
            };
            GameObject gameObject = EntityTemplates.CreateLooseEntity(ID, name, desc, mass, unitMass, anim, initialAnim, sceneLayer, collisionShape, width, height, isPickupable, 0, SimHashes.Creature, additionalTags);

            gameObject.AddOrGet <EntitySplitter>();
            gameObject.AddOrGet <SimpleMassStatusItem>();
            return(gameObject);
        }
    public GameObject CreatePrefab()
    {
        string    id          = "BabyCrabShell";
        string    name        = ITEMS.INDUSTRIAL_PRODUCTS.CRAB_SHELL.NAME;
        string    desc        = ITEMS.INDUSTRIAL_PRODUCTS.CRAB_SHELL.DESC;
        float     mass        = 5f;
        bool      unitMass    = true;
        KAnimFile anim        = Assets.GetAnim("crabshells_small_kanim");
        string    initialAnim = "object";

        Grid.SceneLayer sceneLayer = Grid.SceneLayer.Front;
        EntityTemplates.CollisionShape collisionShape = EntityTemplates.CollisionShape.RECTANGLE;
        float      width        = 0.9f;
        float      height       = 0.6f;
        bool       isPickupable = true;
        List <Tag> list         = new List <Tag>();

        list.Add(GameTags.IndustrialIngredient);
        list.Add(GameTags.Organics);
        list = list;
        GameObject gameObject = EntityTemplates.CreateLooseEntity(id, name, desc, mass, unitMass, anim, initialAnim, sceneLayer, collisionShape, width, height, isPickupable, 0, SimHashes.Creature, list);

        gameObject.AddOrGet <EntitySplitter>();
        gameObject.AddOrGet <SimpleMassStatusItem>();
        EntityTemplates.CreateAndRegisterCompostableFromPrefab(gameObject);
        return(gameObject);
    }
    protected override void OnActivateTool()
    {
        base.OnActivateTool();
        Vector3    cursorPos       = PlayerController.GetCursorPos(KInputManager.GetMousePos());
        GameObject buildingPreview = def.BuildingPreview;
        Vector3    position        = cursorPos;

        Grid.SceneLayer sceneLayer = Grid.SceneLayer.Ore;
        int             gameLayer  = LayerMask.NameToLayer("Place");

        visualizer = GameUtil.KInstantiate(buildingPreview, position, sceneLayer, null, gameLayer);
        KBatchedAnimController component = visualizer.GetComponent <KBatchedAnimController>();

        if ((Object)component != (Object)null)
        {
            component.visibilityType = KAnimControllerBase.VisibilityType.Always;
            component.isMovable      = true;
            component.SetDirty();
        }
        visualizer.SetActive(true);
        Play(visualizer, "None_Place");
        BuildToolHoverTextCard component2 = GetComponent <BuildToolHoverTextCard>();

        component2.currentDef = def;
        ResourceRemainingDisplayScreen.instance.ActivateDisplay(visualizer);
        IHaveUtilityNetworkMgr component3 = def.BuildingComplete.GetComponent <IHaveUtilityNetworkMgr>();

        conduitMgr = component3.GetNetworkManager();
    }
    public GameObject CreatePrefab()
    {
        string    iD          = ID;
        string    name        = ITEMS.INDUSTRIAL_PRODUCTS.BASIC_FABRIC.NAME;
        string    desc        = ITEMS.INDUSTRIAL_PRODUCTS.BASIC_FABRIC.DESC;
        float     mass        = 1f;
        bool      unitMass    = true;
        KAnimFile anim        = Assets.GetAnim("swampreedwool_kanim");
        string    initialAnim = "object";

        Grid.SceneLayer sceneLayer = Grid.SceneLayer.BuildingBack;
        EntityTemplates.CollisionShape collisionShape = EntityTemplates.CollisionShape.RECTANGLE;
        float      width        = 0.8f;
        float      height       = 0.45f;
        bool       isPickupable = true;
        int        sortOrder    = SORTORDER.BUILDINGELEMENTS + BasicFabricTuning.SORTORDER;
        List <Tag> list         = new List <Tag>();

        list.Add(GameTags.IndustrialIngredient);
        list.Add(GameTags.BuildingFiber);
        list = list;
        GameObject gameObject = EntityTemplates.CreateLooseEntity(iD, name, desc, mass, unitMass, anim, initialAnim, sceneLayer, collisionShape, width, height, isPickupable, sortOrder, SimHashes.Creature, list);

        gameObject.AddOrGet <EntitySplitter>();
        PrefabAttributeModifiers prefabAttributeModifiers = gameObject.AddOrGet <PrefabAttributeModifiers>();

        prefabAttributeModifiers.AddAttributeDescriptor(decorModifier);
        return(gameObject);
    }
 public void SetFGLayer(Grid.SceneLayer layer)
 {
     fgLayer = layer;
     GetLayering();
     if (layering != null)
     {
         layering.SetLayer(fgLayer);
     }
 }
    public MeterController(KMonoBehaviour target, Meter.Offset front_back, Grid.SceneLayer user_specified_render_layer, params string[] symbols_to_hide)
    {
        string[] array = new string[symbols_to_hide.Length + 1];
        Array.Copy(symbols_to_hide, array, symbols_to_hide.Length);
        array[array.Length - 1] = "meter_target";
        KBatchedAnimController component = target.GetComponent <KBatchedAnimController>();

        Initialize(component, "meter_target", "meter", front_back, user_specified_render_layer, Vector3.zero, array);
    }
    private static void SpawnEffect(object data)
    {
        Grid.SceneLayer        layer = Grid.SceneLayer.InteriorWall;
        int                    cell  = (int)data;
        KBatchedAnimController kBatchedAnimController = FXHelpers.CreateEffect("radialgrid_kanim", Grid.CellToPosCCC(cell, layer), null, false, layer, false);

        kBatchedAnimController.destroyOnAnimComplete = false;
        kBatchedAnimController.Play(PreAnims, KAnim.PlayMode.Loop);
        GameScheduler.Instance.Schedule("radialgrid_loop", duration, DestroyEffect, kBatchedAnimController, null);
    }
예제 #14
0
 /// <summary>
 /// Creates the anim controller for this cell.
 /// </summary>
 /// <param name="sceneLayer">The layer on which to display the animation.</param>
 public void CreateController(Grid.SceneLayer sceneLayer)
 {
     Controller = FXHelpers.CreateEffect(ANIM_NAME, Grid.CellToPosCCC(Cell,
                                                                      sceneLayer), null, false, sceneLayer, true);
     Controller.destroyOnAnimComplete = false;
     Controller.visibilityType        = KAnimControllerBase.VisibilityType.Always;
     Controller.gameObject.SetActive(true);
     Controller.Play(PRE_ANIMS, KAnim.PlayMode.Loop);
     Controller.TintColour = Tint;
 }
예제 #15
0
 public void SetLayer(Grid.SceneLayer layer)
 {
     this.layer = layer;
     if ((Object)foregroundController != (Object)null)
     {
         float   layerZ    = Grid.GetLayerZ(layer);
         Vector3 position  = controller.gameObject.transform.GetPosition();
         Vector3 position2 = new Vector3(0f, 0f, layerZ - position.z - 0.1f);
         foregroundController.transform.SetLocalPosition(position2);
     }
 }
예제 #16
0
        private KBatchedAnimController CreateEffect(KAnimControllerBase master, Grid.SceneLayer layer)
        {
            var effect = FXHelpers.CreateEffect(master.AnimFiles[0].name, transform.position, transform);

            effect.destroyOnAnimComplete = false;
            effect.SetSceneLayer(layer);
            effect.SetFGLayer(layer);
            effect.Play("backwall", KAnim.PlayMode.Paused);

            return(effect);
        }
예제 #17
0
    public void SetSceneLayer(Grid.SceneLayer layer)
    {
        float layerZ = Grid.GetLayerZ(layer);

        sceneLayer = layer;
        Vector3 position = base.transform.GetPosition();

        position.z = layerZ;
        base.transform.SetPosition(position);
        DeRegister();
        Register();
    }
예제 #18
0
    public static GameObject SpawnPrefab(int RootCell, int x, int y, string name, Grid.SceneLayer scene_layer = Grid.SceneLayer.Ore)
    {
        int        cell   = Grid.OffsetCell(RootCell, x, y);
        Tag        tag    = TagManager.Create(name);
        GameObject prefab = Assets.GetPrefab(tag);

        if ((UnityEngine.Object)prefab == (UnityEngine.Object)null)
        {
            return(null);
        }
        return(GameUtil.KInstantiate(prefab, Grid.CellToPosCBC(cell, scene_layer), scene_layer, null, 0));
    }
예제 #19
0
        // TODO allow Meter.Offset

        public VariantController(
            KMonoBehaviour target,
            string variantTarget,
            string variantAnimation,
            int totalVariants,
            Grid.SceneLayer renderLayer
            ) : this(
                target.GetComponent <KBatchedAnimController>(),
                variantTarget,
                variantAnimation,
                totalVariants,
                renderLayer
                )
        {
        }
    protected override void OnActivateTool()
    {
        lastDragCell = -1;
        if ((Object)visualizer != (Object)null)
        {
            ClearTilePreview();
            Object.Destroy(visualizer);
        }
        active = true;
        base.OnActivateTool();
        buildingOrientation = Orientation.Neutral;
        placementPivot      = def.placementPivot;
        Vector3    cursorPos       = PlayerController.GetCursorPos(KInputManager.GetMousePos());
        GameObject buildingPreview = def.BuildingPreview;
        Vector3    position        = cursorPos;

        Grid.SceneLayer sceneLayer = Grid.SceneLayer.Ore;
        int             gameLayer  = LayerMask.NameToLayer("Place");

        visualizer = GameUtil.KInstantiate(buildingPreview, position, sceneLayer, null, gameLayer);
        KBatchedAnimController component = visualizer.GetComponent <KBatchedAnimController>();

        if ((Object)component != (Object)null)
        {
            component.visibilityType = KAnimControllerBase.VisibilityType.Always;
            component.isMovable      = true;
            component.Offset         = def.GetVisualizerOffset();
            component.Offset        += def.placementPivot;
            component.name           = component.GetComponent <KPrefabID>().GetDebugName() + "_visualizer";
        }
        visualizer.SetActive(true);
        UpdateVis(cursorPos);
        BuildToolHoverTextCard component2 = GetComponent <BuildToolHoverTextCard>();

        component2.currentDef = def;
        ResourceRemainingDisplayScreen.instance.ActivateDisplay(visualizer);
        if ((Object)component == (Object)null)
        {
            visualizer.SetLayerRecursively(LayerMask.NameToLayer("Place"));
        }
        else
        {
            component.SetLayer(LayerMask.NameToLayer("Place"));
        }
        GridCompositor.Instance.ToggleMajor(true);
    }
예제 #21
0
        public VariantController(
            KAnimControllerBase controllerBase,
            string variantTarget,
            string variantAnimation,
            int totalVariants,
            Grid.SceneLayer renderLayer
            )
        {
            this.totalVariants = totalVariants;

            string name = $"{controllerBase.name}.{variantAnimation}";

            gameObject      = UnityEngine.Object.Instantiate <GameObject>(Assets.GetPrefab(MeterConfig.ID));
            gameObject.name = name;
            gameObject.SetActive(false);
            gameObject.transform.parent = controllerBase.transform;
            gameObject.GetComponent <KPrefabID>().PrefabTag = new Tag(name);

            var position = controllerBase.transform.GetPosition();

            position.z = Grid.GetLayerZ(renderLayer);
            gameObject.transform.SetPosition(position);

            variantController           = gameObject.GetComponent <KBatchedAnimController>();
            variantController.AnimFiles = new KAnimFile[] {
                controllerBase.AnimFiles[0]
            };
            variantController.initialAnim = variantAnimation;
            variantController.fgLayer     = Grid.SceneLayer.NoLayer;
            variantController.initialMode = KAnim.PlayMode.Paused;
            variantController.isMovable   = true;
            variantController.FlipX       = controllerBase.FlipX;
            variantController.FlipY       = controllerBase.FlipY;
            variantController.sceneLayer  = renderLayer;

            variantTracker = gameObject.GetComponent <KBatchedAnimTracker>();
            // variantTracker.offset = offset;
            variantTracker.symbol = variantTarget;

            gameObject.SetActive(true);

            controllerBase.SetSymbolVisiblity(variantTarget, false);

            variantLink = new KAnimLink(controllerBase, variantController);
        }
예제 #22
0
        public GameObject CreatePrefab()
        {
            string    id          = ID;
            string    name        = "Tooth Fossil";//"Primitive Hatch Fossil";
            string    desc        = "Primitive Hatch Fossil";
            float     mass        = 1f;
            bool      unitMass    = false;
            KAnimFile anim        = Assets.GetAnim("bark_skin_kanim");
            string    initialAnim = "object";

            Grid.SceneLayer sceneLayer = Grid.SceneLayer.Front;
            EntityTemplates.CollisionShape collisionShape = EntityTemplates.CollisionShape.CIRCLE;
            float      width          = 0.35f;
            float      height         = 0.35f;
            bool       isPickupable   = true;
            List <Tag> additionalTags = new List <Tag>
            {
                GameTags.IndustrialIngredient,
                GameTags.Organics,
                TagManager.Create("FossilStone")
            };
            GameObject gameObject = EntityTemplates.CreateLooseEntity(id, name, desc, mass, unitMass, anim, initialAnim, sceneLayer, collisionShape, width, height, isPickupable, 0, SimHashes.Creature, additionalTags);

            gameObject.AddOrGet <EntitySplitter>();
            gameObject.AddOrGet <SimpleMassStatusItem>();

            var input        = new[] { new ComplexRecipe.RecipeElement(HatchConfig.EGG_ID, 1f), new ComplexRecipe.RecipeElement(RawEggConfig.ID, 1f) };
            var output       = new[] { new ComplexRecipe.RecipeElement(SturdyHatchConfig.EGG_ID, 1f) };
            var fabricatorId = Buildings.GeneticSamplerConfig.ID;
            var recipeId     = ComplexRecipeManager.MakeRecipeID(fabricatorId, input, output);
            var Recipe       = new ComplexRecipe(recipeId, input, output)
            {
                time        = 100f,
                description = RecipeDescription,
                nameDisplay = ComplexRecipe.RecipeNameDisplay.Result,
                fabricators = new List <Tag>
                {
                    fabricatorId
                },
                sortOrder = 120
            };

            return(gameObject);
        }
예제 #23
0
    public GameObject CreatePrefab()
    {
        string    id          = "FarmStationTools";
        string    name        = ITEMS.INDUSTRIAL_PRODUCTS.FARM_STATION_TOOLS.NAME;
        string    desc        = ITEMS.INDUSTRIAL_PRODUCTS.FARM_STATION_TOOLS.DESC;
        float     mass        = 5f;
        bool      unitMass    = true;
        KAnimFile anim        = Assets.GetAnim("kit_planttender_kanim");
        string    initialAnim = "object";

        Grid.SceneLayer sceneLayer = Grid.SceneLayer.Front;
        EntityTemplates.CollisionShape collisionShape = EntityTemplates.CollisionShape.RECTANGLE;
        float      width        = 0.8f;
        float      height       = 0.6f;
        bool       isPickupable = true;
        List <Tag> list         = new List <Tag>();

        list.Add(GameTags.MiscPickupable);
        list = list;
        return(EntityTemplates.CreateLooseEntity(id, name, desc, mass, unitMass, anim, initialAnim, sceneLayer, collisionShape, width, height, isPickupable, 0, SimHashes.Creature, list));
    }
예제 #24
0
    public GameObject CreatePrefab()
    {
        string    id          = "GeneShufflerRecharge";
        string    name        = ITEMS.INDUSTRIAL_PRODUCTS.GENE_SHUFFLER_RECHARGE.NAME;
        string    desc        = ITEMS.INDUSTRIAL_PRODUCTS.GENE_SHUFFLER_RECHARGE.DESC;
        float     mass        = 5f;
        bool      unitMass    = true;
        KAnimFile anim        = Assets.GetAnim("vacillator_charge_kanim");
        string    initialAnim = "object";

        Grid.SceneLayer sceneLayer = Grid.SceneLayer.Front;
        EntityTemplates.CollisionShape collisionShape = EntityTemplates.CollisionShape.RECTANGLE;
        float      width        = 0.8f;
        float      height       = 0.6f;
        bool       isPickupable = true;
        List <Tag> list         = new List <Tag>();

        list.Add(GameTags.IndustrialIngredient);
        list = list;
        return(EntityTemplates.CreateLooseEntity(id, name, desc, mass, unitMass, anim, initialAnim, sceneLayer, collisionShape, width, height, isPickupable, 0, SimHashes.Creature, list));
    }
    public GameObject CreatePrefab()
    {
        string    id          = "GasGrassHarvested";
        string    name        = CREATURES.SPECIES.GASGRASS.NAME;
        string    desc        = CREATURES.SPECIES.GASGRASS.DESC;
        float     mass        = 1f;
        bool      unitMass    = false;
        KAnimFile anim        = Assets.GetAnim("harvested_gassygrass_kanim");
        string    initialAnim = "object";

        Grid.SceneLayer sceneLayer = Grid.SceneLayer.Front;
        EntityTemplates.CollisionShape collisionShape = EntityTemplates.CollisionShape.CIRCLE;
        float      width        = 0.25f;
        float      height       = 0.25f;
        bool       isPickupable = true;
        List <Tag> list         = new List <Tag>();

        list.Add(GameTags.Other);
        list = list;
        GameObject gameObject = EntityTemplates.CreateLooseEntity(id, name, desc, mass, unitMass, anim, initialAnim, sceneLayer, collisionShape, width, height, isPickupable, 0, SimHashes.Creature, list);

        gameObject.AddOrGet <EntitySplitter>();
        return(gameObject);
    }
    private GameObject AddTrackedAnim(string name, KAnimFile tracked_anim_file, string anim_clip, Grid.SceneLayer layer, string symbol_name)
    {
        KBatchedAnimController assigneeController = GetAssigneeController();

        if ((Object)assigneeController == (Object)null)
        {
            return(null);
        }
        string     name2      = assigneeController.name + "." + name;
        GameObject gameObject = new GameObject(name2);

        gameObject.SetActive(false);
        gameObject.transform.parent = assigneeController.transform;
        KPrefabID kPrefabID = gameObject.AddComponent <KPrefabID>();

        kPrefabID.PrefabTag = new Tag(name2);
        KBatchedAnimController kBatchedAnimController = gameObject.AddComponent <KBatchedAnimController>();

        kBatchedAnimController.AnimFiles = new KAnimFile[1]
        {
            tracked_anim_file
        };
        kBatchedAnimController.initialAnim = anim_clip;
        kBatchedAnimController.isMovable   = true;
        kBatchedAnimController.sceneLayer  = layer;
        KBatchedAnimTracker kBatchedAnimTracker = gameObject.AddComponent <KBatchedAnimTracker>();

        kBatchedAnimTracker.symbol = symbol_name;
        bool    symbolVisible;
        Vector4 column   = assigneeController.GetSymbolTransform(symbol_name, out symbolVisible).GetColumn(3);
        Vector3 position = column;

        position.z = Grid.GetLayerZ(layer);
        gameObject.transform.SetPosition(position);
        gameObject.SetActive(true);
        kBatchedAnimController.Play(anim_clip, KAnim.PlayMode.Loop, 1f, 0f);
        return(gameObject);
    }
    public static KBatchedAnimController CreateEffect(string anim_file_name, Vector3 position, Transform parent = null, bool update_looping_sounds_position = false, Grid.SceneLayer layer = Grid.SceneLayer.Front, bool set_inactive = false)
    {
        KBatchedAnimController component = GameUtil.KInstantiate(Assets.GetPrefab(EffectConfigs.EffectTemplateId), position, layer, null, 0).GetComponent <KBatchedAnimController>();
        KPrefabID component2             = component.GetComponent <KPrefabID>();

        component2.PrefabTag = TagManager.Create(anim_file_name);
        component.name       = anim_file_name;
        if ((Object)parent != (Object)null)
        {
            component.transform.SetParent(parent, false);
        }
        component.transform.SetPosition(position);
        if (update_looping_sounds_position)
        {
            LoopingSounds loopingSounds = component.FindOrAddComponent <LoopingSounds>();
            loopingSounds.updatePosition = true;
        }
        KAnimFile anim = Assets.GetAnim(anim_file_name);

        if ((Object)anim == (Object)null)
        {
            Debug.LogWarning("Missing effect anim: " + anim_file_name);
        }
        else
        {
            component.AnimFiles = new KAnimFile[1]
            {
                anim
            };
        }
        if (!set_inactive)
        {
            component.gameObject.SetActive(true);
        }
        return(component);
    }
예제 #28
0
 protected ColoredRangeVisualizer()
 {
     cells = new HashSet <VisCellData>();
     Layer = Grid.SceneLayer.FXFront;
 }
예제 #29
0
 public GameObject SpawnPrefab(int x, int y, string name, Grid.SceneLayer scene_layer = Grid.SceneLayer.Ore)
 {
     return(SpawnPrefab(RootCell, x, y, name, scene_layer));
 }
예제 #30
0
 public static void Postfix(Grid.SceneLayer layer, ref float __result)
 {
     __result = (IsLayerOn && layer == Grid.SceneLayer.SolidConduitContents) ?
                Grid.GetLayerZ(Grid.SceneLayer.Front)
                 : __result;
 }