Esempio n. 1
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);
            }
        }
Esempio n. 2
0
        protected override void OnSpawn()
        {
            KBatchedAnimController component = this.GetComponent <KBatchedAnimController>();

            component.TintColour = new Color(0.5f, 0.5f, 1.0f, 1.0f);
            string name = component.name + ".gun";

            this.arm_go = new GameObject(name);
            this.arm_go.SetActive(value: false);
            this.arm_go.transform.parent = component.transform;
            this.looping_sounds          = this.arm_go.AddComponent <LoopingSounds>();
            this.rotateSound             = GlobalAssets.GetSound(this.rotateSound);
            KPrefabID kPrefabID = this.arm_go.AddComponent <KPrefabID>();

            kPrefabID.PrefabTag          = new Tag(name);
            this.arm_anim_ctrl           = this.arm_go.AddComponent <KBatchedAnimController>();
            this.arm_anim_ctrl.AnimFiles = new KAnimFile[1] {
                component.AnimFiles[0]
            };
            this.arm_anim_ctrl.initialAnim = "gun";
            this.arm_anim_ctrl.isMovable   = true;
            this.arm_anim_ctrl.sceneLayer  = Grid.SceneLayer.TransferArm;
            this.arm_anim_ctrl.TintColour  = new Color(0.5f, 0.5f, 1.0f, 1.0f);
            component.SetSymbolVisiblity("gun_target", is_visible: false);
            bool    symbolVisible;
            Vector4 column   = component.GetSymbolTransform(new HashedString("gun_target"), out symbolVisible).GetColumn(3);
            Vector3 position = column;

            position.z = Grid.GetLayerZ(Grid.SceneLayer.TransferArm);
            this.arm_go.transform.SetPosition(position);
            this.arm_go.SetActive(value: true);
            this.link = new KAnimLink(component, this.arm_anim_ctrl);
            this.SetupBeam();
            this.RotateArm(this.rotatable.GetRotatedOffset(Quaternion.Euler(0f, 0f, -this.arm_rot) * Vector3.up), warp: true, 0f);
            this.energyConsumer.UpdatePoweredStatus();
            this.operational.SetActive(true);
            this.selectable.AddStatusItem(charge_status, this);
            this.selectable.AddStatusItem(kills_status, this);
        }
    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);
    }
    protected override void OnSpawn()
    {
        base.OnSpawn();
        hitEffectPrefab = Assets.GetPrefab("fx_dig_splash");
        KBatchedAnimController component = GetComponent <KBatchedAnimController>();
        string name = component.name + ".gun";

        arm_go = new GameObject(name);
        arm_go.SetActive(false);
        arm_go.transform.parent = component.transform;
        looping_sounds          = arm_go.AddComponent <LoopingSounds>();
        rotateSound             = GlobalAssets.GetSound(rotateSound, false);
        KPrefabID kPrefabID = arm_go.AddComponent <KPrefabID>();

        kPrefabID.PrefabTag     = new Tag(name);
        arm_anim_ctrl           = arm_go.AddComponent <KBatchedAnimController>();
        arm_anim_ctrl.AnimFiles = new KAnimFile[1]
        {
            component.AnimFiles[0]
        };
        arm_anim_ctrl.initialAnim = "gun";
        arm_anim_ctrl.isMovable   = true;
        arm_anim_ctrl.sceneLayer  = Grid.SceneLayer.TransferArm;
        component.SetSymbolVisiblity("gun_target", false);
        bool    symbolVisible;
        Vector4 column   = component.GetSymbolTransform(new HashedString("gun_target"), out symbolVisible).GetColumn(3);
        Vector3 position = column;

        position.z = Grid.GetLayerZ(Grid.SceneLayer.TransferArm);
        arm_go.transform.SetPosition(position);
        arm_go.SetActive(true);
        link = new KAnimLink(component, arm_anim_ctrl);
        Subscribe(-592767678, OnOperationalChangedDelegate);
        RotateArm(rotatable.GetRotatedOffset(Quaternion.Euler(0f, 0f, -45f) * Vector3.up), true, 0f);
        StopDig();
        base.smi.StartSM();
    }