コード例 #1
0
        public override object OnInfect(GameObject go, SicknessInstance diseaseInstance)
        {
            KBatchedAnimController kBatchedAnimController = FXHelpers.CreateEffect("contaminated_crew_fx_kanim", go.transform.GetPosition() + new Vector3(0f, 0f, -0.1f), go.transform, true, Grid.SceneLayer.Front, false);

            kBatchedAnimController.Play("fx_loop", KAnim.PlayMode.Loop, 1f, 0f);
            return(kBatchedAnimController);
        }
コード例 #2
0
        public Instance(IStateMachineTarget master, Vector3 offset)
            : base(master)
        {
            KBatchedAnimController kBatchedAnimController = FXHelpers.CreateEffect("fly_swarm_kanim", base.smi.master.transform.GetPosition() + offset, base.smi.master.transform, false, Grid.SceneLayer.Front, false);

            base.sm.fx.Set(kBatchedAnimController.gameObject, base.smi);
        }
コード例 #3
0
            // спавн продуктов разложения
            public void SpawnDecompositionProductsSelfDestroy()
            {
                // визуалочка
                Vector3 position = master.transform.GetPosition();
                KBatchedAnimController kbacFX = FXHelpers.CreateEffect("decomposition_corpse_fx_kanim", position, null, false, Grid.SceneLayer.FXFront, false);

                kbacFX.Play("idle", KAnim.PlayMode.Once);
                kbacFX.destroyOnAnimComplete = true;


                // морбы
                if (!IsSubmerged())
                {
                    Vector3 position_morb = Grid.CellToPos(Grid.PosToCell(position));
                    for (int i = 0; i < countRotMonsters; i++)
                    {
                        GameObject morb = GameUtil.KInstantiate(Assets.GetPrefab("Glom".ToTag()), position_morb, Grid.SceneLayer.Creatures);
                        morb.SetActive(true);
                        //PopFXManager.Instance.SpawnFX(PopFXManager.Instance.sprite_Resource, morb.name, morb.transform);
                    }
                }

                // скелетон
                position.y += 0.5f;
                GameObject skeleton = GameUtil.KInstantiate(Assets.GetPrefab(SkeletonConfig.TAG), position, Grid.SceneLayer.Ore);

                skeleton.SetActive(true);
                skeleton.GetComponent <PrimaryElement>().Temperature = temperature;

                // эффект на всех живых дуплов
                EffectsExtensions.AddEffectToAllLiveMinions(DeathPatches.DESTROYED_CORPSE, true, true);

                // удаляем труп
                Util.KDestroyGameObject(master.gameObject);
            }
コード例 #4
0
        public override void SetStage(string stage_id, bool skip_effect)
        {
            base.SetStage(stage_id, skip_effect);

            Stage stage = stages[0];

            foreach (Stage s in stages)
            {
                if (s.id == stage_id)
                {
                    stage = s;
                    break;
                }
            }

            if (skip_effect || !(CurrentStage != "Default"))
            {
                return;
            }

            // Smoke effect
            KBatchedAnimController effect = FXHelpers.CreateEffect("sculpture_fx_kanim", transform.GetPosition(), transform, false, Grid.SceneLayer.Front, false);

            effect.destroyOnAnimComplete = true;
            effect.transform.SetLocalPosition(new Vector3(0.5f, -0.5f));
            effect.Play("poof", KAnim.PlayMode.Once, 1f, 0.0f);

            // Create reactable
            fossilStand.CreateInspiredReactable(stage.statusItem);
        }
    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);
    }
コード例 #6
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;
 }
コード例 #7
0
 public Instance(IStateMachineTarget master, string kanim_file, HashedString[] anims, KAnim.PlayMode mode, Vector3 offset, Color32 tint_colour)
     : base(master)
 {
     animController = FXHelpers.CreateEffect(kanim_file, smi.master.transform.GetPosition() + offset, smi.master.transform);
     //animController.gameObject.Subscribe(-1061186183, OnAnimQueueComplete);
     animController.TintColour = tint_colour;
     sm.fx.Set(animController.gameObject, smi);
     this.anims = anims;
     this.mode  = mode;
 }
コード例 #8
0
 public Instance(IStateMachineTarget master, string kanim_file, string anim, KAnim.PlayMode mode, Vector3 offset, Color32 tint_colour)
     : base(master)
 {
     animController = FXHelpers.CreateEffect(kanim_file, base.smi.master.transform.GetPosition() + offset, base.smi.master.transform, false, Grid.SceneLayer.Front, false);
     animController.gameObject.Subscribe(-1061186183, OnAnimQueueComplete);
     animController.TintColour = tint_colour;
     base.sm.fx.Set(animController.gameObject, base.smi);
     this.anim = anim;
     this.mode = mode;
 }
コード例 #9
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);
        }
コード例 #10
0
 public override void SetStage(string stage_id, bool skip_effect)
 {
     base.SetStage(stage_id, skip_effect);
     if (!skip_effect && base.CurrentStage != "Default")
     {
         KBatchedAnimController kBatchedAnimController = FXHelpers.CreateEffect("sculpture_fx_kanim", base.transform.GetPosition(), base.transform, false, Grid.SceneLayer.Front, false);
         kBatchedAnimController.destroyOnAnimComplete = true;
         kBatchedAnimController.transform.SetLocalPosition(Vector3.zero);
         kBatchedAnimController.Play("poof", KAnim.PlayMode.Once, 1f, 0f);
     }
 }
コード例 #11
0
        private void StartSmallSnoreInternal(object data)
        {
            snoreHandle.ClearScheduler();
            KBatchedAnimController component = base.smi.master.GetComponent <KBatchedAnimController>();
            bool      symbolVisible;
            Matrix4x4 symbolTransform = component.GetSymbolTransform(HeadHash, out symbolVisible);

            if (symbolVisible)
            {
                Vector4 column   = symbolTransform.GetColumn(3);
                Vector3 position = column;
                position.z  = Grid.GetLayerZ(Grid.SceneLayer.FXFront);
                snoreEffect = FXHelpers.CreateEffect("snore_fx_kanim", position, null, false, Grid.SceneLayer.Front, false);
                snoreEffect.destroyOnAnimComplete = true;
                snoreEffect.Play("snore", KAnim.PlayMode.Loop, 1f, 0f);
            }
        }
コード例 #12
0
        public void Activate()
        {
            //this.link = new KAnimLink(building_controller, meter_controller);
            effect = FXHelpers.CreateEffect("fab_fx_kanim", kBatchedAnimController.transform.GetPosition(), kBatchedAnimController.transform);
            effect.destroyOnAnimComplete = false;
            effect.randomiseLoopedOffset = true;
            effect.FlipX = kBatchedAnimController.FlipX;

            var pos = new Vector3(effect.FlipX ? -0.5f : 0.5f, 0, -1f);

            effect.transform.SetLocalPosition(pos);
            ForceToFront();
            effect.Play("effect", KAnim.PlayMode.Paused, 1f);


            StartCoroutine(ShiftColors());

            sparkleFx = Util.KInstantiate(EffectPrefabs.Instance.SparkleStreakFX, kBatchedAnimController.transform.GetPosition() + new Vector3(1f, 0.5f, 0.4f));
            sparkleFx.transform.SetParent(kBatchedAnimController.transform);
            sparkleFx.SetActive(true);
        }
コード例 #13
0
    private void Emit(object data)
    {
        GameObject gameObject = (GameObject)data;
        float      value      = Db.Get().Amounts.Temperature.Lookup(this).value;
        Equippable equippable = GetComponent <SuitEquipper>().IsWearingAirtightSuit();

        if ((Object)equippable != (Object)null)
        {
            equippable.GetComponent <Storage>().AddGasChunk(SimHashes.Methane, 0.1f, value, byte.MaxValue, 0, false, true);
        }
        else
        {
            Components.Cmps <MinionIdentity> liveMinionIdentities = Components.LiveMinionIdentities;
            Vector2 a = gameObject.transform.GetPosition();
            for (int i = 0; i < liveMinionIdentities.Count; i++)
            {
                MinionIdentity minionIdentity = liveMinionIdentities[i];
                if ((Object)minionIdentity.gameObject != (Object)gameObject.gameObject)
                {
                    Vector2 b   = minionIdentity.transform.GetPosition();
                    float   num = Vector2.SqrMagnitude(a - b);
                    if (num <= 2.25f)
                    {
                        minionIdentity.Trigger(508119890, Strings.Get("STRINGS.DUPLICANTS.DISEASES.PUTRIDODOUR.CRINGE_EFFECT").String);
                        minionIdentity.gameObject.GetSMI <ThoughtGraph.Instance>().AddThought(Db.Get().Thoughts.PutridOdour);
                    }
                }
            }
            int gameCell = Grid.PosToCell(gameObject.transform.GetPosition());
            SimMessages.AddRemoveSubstance(gameCell, SimHashes.Methane, CellEventLogger.Instance.ElementConsumerSimUpdate, 0.1f, value, byte.MaxValue, 0, true, -1);
            KBatchedAnimController kBatchedAnimController = FXHelpers.CreateEffect("odor_fx_kanim", gameObject.transform.GetPosition(), gameObject.transform, true, Grid.SceneLayer.Front, false);
            kBatchedAnimController.Play(WorkLoopAnims, KAnim.PlayMode.Once);
            kBatchedAnimController.destroyOnAnimComplete = true;
        }
        KFMOD.PlayOneShot(GlobalAssets.GetSound("Dupe_Flatulence", false), base.transform.GetPosition());
    }
コード例 #14
0
    public override void FixedUpdate(float dt)
    {
        Tuning tuning = TuningData <Tuning> .Get();

        float num = tuning.maxVelocity * tuning.maxVelocity;

        for (int i = 0; i < data.Count; i++)
        {
            GravityComponent value = data[i];
            if (!(value.elapsedTime < 0f) && !((UnityEngine.Object)value.transform == (UnityEngine.Object)null))
            {
                Vector3 position     = value.transform.GetPosition();
                Vector2 vector       = position;
                Vector2 vector2      = new Vector2(value.velocity.x, value.velocity.y + -9.8f * dt);
                float   sqrMagnitude = vector2.sqrMagnitude;
                if (sqrMagnitude > num)
                {
                    vector2 *= tuning.maxVelocity / Mathf.Sqrt(sqrMagnitude);
                }
                int  num2 = Grid.PosToCell(vector);
                bool flag = Grid.IsVisiblyInLiquid(vector + new Vector2(0f, value.radius));
                if (flag)
                {
                    flag = true;
                    float num3 = (float)(value.transform.GetInstanceID() % 1000) / 1000f * 0.25f;
                    float num4 = tuning.maxVelocityInLiquid + num3 * tuning.maxVelocityInLiquid;
                    if (sqrMagnitude > num4 * num4)
                    {
                        float num5 = Mathf.Sqrt(sqrMagnitude);
                        vector2 = vector2 / num5 * Mathf.Lerp(num5, num3, dt * (5f + 5f * num3));
                    }
                }
                value.velocity     = vector2;
                value.elapsedTime += dt;
                Vector2 vector3 = vector + vector2 * dt;
                Vector2 pos     = vector3;
                pos.y -= value.radius;
                bool flag2 = Grid.IsVisiblyInLiquid(vector3 + new Vector2(0f, value.radius));
                if (!flag && flag2)
                {
                    KBatchedAnimController kBatchedAnimController = FXHelpers.CreateEffect("splash_step_kanim", new Vector3(vector3.x, vector3.y, 0f) + new Vector3(-0.38f, 0.75f, -0.1f), null, false, Grid.SceneLayer.FXFront, false);
                    kBatchedAnimController.Play("fx1", KAnim.PlayMode.Once, 1f, 0f);
                    kBatchedAnimController.destroyOnAnimComplete = true;
                }
                int num6 = Grid.PosToCell(pos);
                if (Grid.IsValidCell(num6))
                {
                    if (vector2.sqrMagnitude > 0.2f && Grid.IsValidCell(num2) && !Grid.Element[num2].IsLiquid && Grid.Element[num6].IsLiquid)
                    {
                        AmbienceType ambience = Grid.Element[num6].substance.GetAmbience();
                        if (ambience != AmbienceType.None)
                        {
                            string text = Sounds.Instance.OreSplashSoundsMigrated[(int)ambience];
                            if ((UnityEngine.Object)CameraController.Instance != (UnityEngine.Object)null && CameraController.Instance.IsAudibleSound(vector3, text))
                            {
                                SoundEvent.PlayOneShot(text, vector3);
                            }
                        }
                    }
                    bool flag3 = Grid.Solid[num6];
                    if (!flag3 && value.landOnFakeFloors && Grid.FakeFloor[num6])
                    {
                        Navigator component = value.transform.GetComponent <Navigator>();
                        if ((bool)component)
                        {
                            flag3 = component.NavGrid.NavTable.IsValid(num6, NavType.Floor);
                            if (!flag3)
                            {
                                int cell = Grid.CellAbove(num6);
                                flag3 = component.NavGrid.NavTable.IsValid(cell, NavType.Hover);
                            }
                        }
                    }
                    if (flag3)
                    {
                        Vector3 vector4 = Grid.CellToPosCBC(Grid.CellAbove(num6), Grid.SceneLayer.Move);
                        vector3.y         = vector4.y + value.radius;
                        value.velocity.x  = 0f;
                        value.elapsedTime = -1f;
                        value.transform.SetPosition(new Vector3(vector3.x, vector3.y, position.z));
                        data[i] = value;
                        value.transform.gameObject.Trigger(1188683690, vector2);
                        if (value.onLanded != null)
                        {
                            value.onLanded();
                        }
                    }
                    else
                    {
                        Vector2 pos2 = vector3;
                        pos2.x -= value.radius;
                        int num7 = Grid.PosToCell(pos2);
                        if (Grid.IsValidCell(num7) && Grid.Solid[num7])
                        {
                            vector3.x        = Mathf.Floor(vector3.x - value.radius) + (1f + value.radius);
                            value.velocity.x = -0.1f * value.velocity.x;
                            data[i]          = value;
                        }
                        else
                        {
                            Vector3 pos3 = vector3;
                            pos3.x += value.radius;
                            int num8 = Grid.PosToCell(pos3);
                            if (Grid.IsValidCell(num8) && Grid.Solid[num8])
                            {
                                vector3.x        = Mathf.Floor(vector3.x + value.radius) - value.radius;
                                value.velocity.x = -0.1f * value.velocity.x;
                                data[i]          = value;
                            }
                        }
                        value.transform.SetPosition(new Vector3(vector3.x, vector3.y, position.z));
                        data[i] = value;
                    }
                }
                else
                {
                    value.transform.SetPosition(new Vector3(vector3.x, vector3.y, position.z));
                    data[i] = value;
                }
            }
        }
    }
コード例 #15
0
ファイル: Stinky.cs プロジェクト: Draconomial/ONI_Mods
 protected override void OnSpawn()
 {
     stinkyController = FXHelpers.CreateEffect("odor_fx_kanim", gameObject.transform.GetPosition(), smi.master.gameObject.transform, true);
     base.smi.StartSM();
 }