Reset() public method

public Reset ( ) : void
return void
コード例 #1
0
 private void FillAnimation(string name)
 {
     _glassAnim.Reset();
     _glassAnim.skeleton.SetToSetupPose();
     _glassAnim.state.SetAnimation(0, name, false);
     _glassAnim.skeleton.SetSkin(skin);
     _glassAnim.state.End += OnEnd;
 }
コード例 #2
0
ファイル: CSpineAnimationDep.cs プロジェクト: qipa/KEngine-1
    // 处理动画
    protected void ProcessSpineAnimation(string resourcePath)
    {
        //gameObject.SetActive(false);  // 故意关闭状态,SkeletonAnimation不报错
        LoadCSpineData(resourcePath, (SkeletonDataAsset _data) =>
        {
            if (!IsDestroy)
            {
                //SkeletonAnimation anim = gameObject.GetComponent<SkeletonAnimation>();
                SkeletonAnimation anim = (SkeletonAnimation)DependencyComponent;
                anim.timeScale         = CGame.TimeScale; // 動作加載完畢后,匹配上系統遊戲速度
                anim.skeletonDataAsset = _data;
                try
                {
                    anim.Reset();
                }
                catch (Exception e)
                {
                    Logger.LogError(e.Message);
                    Debug.LogError(string.Format("[ProcessSpineAnimation] {0}", resourcePath), this);
                }


                //gameObject.SetActive(true);  // SkeletonAnimation配置好重新开启
                OnFinishLoadDependencies(anim);
            }
            else
            {
                OnFinishLoadDependencies(null);
            }
        });
        //gameObject.name = resourcePath;
    }
コード例 #3
0
    public void SetRoleInfo(RoleData d, string cb, string cc, string nb, string nc, float v, string e)
    {
        name.text = d.name;
        wakeView.SetWakeLevel(d.wakeLevel);

        if (d.path != null)
        {
            SkeletonDataAsset sk = GameShared.Instance.GetSkeletonAssetByPath(d.path);
            anim.skeletonDataAsset = sk;
            anim.Reset();
        }

        curbattle.text   = cb;
        curcollect.text  = cc;
        nextbattle.text  = nb;
        nextcollect.text = nc;
        exp.value        = v;
        expLabel.text    = e;
        if (UserManager.Instance.level >= GameShared.Instance.config.xilian_level_open && d.is_possessed)
        {
            xilianBtn.gameObject.SetActive(true);
        }
        else
        {
            xilianBtn.gameObject.SetActive(false);
        }
    }
コード例 #4
0
    public static SkeletonAnimation InstantiateSkeletonAnimation(SkeletonDataAsset skeletonDataAsset, Skin skin = null)
    {
        GameObject        go   = new GameObject(skeletonDataAsset.name.Replace("_SkeletonData", ""), typeof(MeshFilter), typeof(MeshRenderer), typeof(SkeletonAnimation));
        SkeletonAnimation anim = go.GetComponent <SkeletonAnimation>();

        anim.skeletonDataAsset = skeletonDataAsset;

        bool requiresNormals = false;

        foreach (AtlasAsset atlasAsset in anim.skeletonDataAsset.atlasAssets)
        {
            foreach (Material m in atlasAsset.materials)
            {
                if (m.shader.name.Contains("Lit"))
                {
                    requiresNormals = true;
                    break;
                }
            }
        }



        anim.calculateNormals = requiresNormals;

        SkeletonData data = skeletonDataAsset.GetSkeletonData(true);

        if (data == null)
        {
            for (int i = 0; i < skeletonDataAsset.atlasAssets.Length; i++)
            {
                string reloadAtlasPath = AssetDatabase.GetAssetPath(skeletonDataAsset.atlasAssets[i]);
                skeletonDataAsset.atlasAssets[i] = (AtlasAsset)AssetDatabase.LoadAssetAtPath(reloadAtlasPath, typeof(AtlasAsset));
            }

            data = skeletonDataAsset.GetSkeletonData(true);
        }

        if (skin == null)
        {
            skin = data.DefaultSkin;
        }

        if (skin == null)
        {
            skin = data.Skins[0];
        }

        anim.Reset();

        anim.skeleton.SetSkin(skin);
        anim.initialSkinName = skin.Name;

        anim.skeleton.Update(1);
        anim.state.Update(1);
        anim.state.Apply(anim.skeleton);
        anim.skeleton.UpdateWorldTransform();

        return(anim);
    }
コード例 #5
0
    void SetSkin(object o)
    {
        Skin skin = (Skin)o;

        m_skeletonAnimation.initialSkinName = skin.Name;
        m_skeletonAnimation.Reset();
        m_requireRefresh = true;

        EditorPrefs.SetString(m_skeletonDataAssetGUID + "_lastSkin", skin.Name);
    }
コード例 #6
0
    public void ResetAnimation()
    {
        if (compAnimation.Skeleton == null)
        {
            compAnimation.Reset();
        }

        compAnimation.state.SetAnimation(0, "combo", false).Time = 0;
        compAnimation.Update(0);
        compAnimation.state.SetAnimation(0, "combo", false).Time = 0;
    }
コード例 #7
0
    public void SetPerformerSkillAnimation(SkillArtInfo skillInfo, bool activate)
    {
        SkeletonAnimation skillAnimation = unitAnimator.Effects.Find(item => item.name == skillInfo.ArtId);

        if (skillAnimation != null)
        {
            skillAnimation.gameObject.layer = CurrentState.gameObject.layer;
            skillAnimation.gameObject.SetActive(activate);
            skillAnimation.Reset();
        }
        unitAnimator.Animator.SetBool(skillInfo.AnimationId, activate);
    }
コード例 #8
0
    public void CreateSpineObject()
    {
        // 1.Spine/Skeletonのmaterialを生成
        Material material = new Material(Shader.Find("Spine/Skeleton"));

        material.mainTexture = texture;

        // 2.AtlasAssetを生成して、1のmaterialを紐づける
        AtlasAsset atlasAsset = AtlasAsset.CreateInstance <AtlasAsset> ();

        atlasAsset.atlasFile     = atlasText;
        atlasAsset.materials     = new Material[1];
        atlasAsset.materials [0] = material;

        // 3.SkeletonDataAssetを生成して、初期データを投入する
        SkeletonDataAsset dataAsset = SkeletonDataAsset.CreateInstance <SkeletonDataAsset> ();

        dataAsset.atlasAssets     = new AtlasAsset[1];
        dataAsset.atlasAssets [0] = atlasAsset;
        dataAsset.skeletonJSON    = jsonText;
        dataAsset.fromAnimation   = new string[0];
        dataAsset.toAnimation     = new string[0];
        dataAsset.duration        = new float[0];
        dataAsset.defaultMix      = 0.2f;
        dataAsset.scale           = 1.0f;

        // 4.実際にUnityに配置するGameObjectを生成して、SkeletonAnimationをadd
        GameObject        obj          = new GameObject("SpineObject");
        SkeletonAnimation anim         = obj.AddComponent <SkeletonAnimation> ();
        MeshRenderer      meshRenderer = obj.GetComponent <MeshRenderer>();

        meshRenderer.sortingLayerName = "spine";
        meshRenderer.sortingOrder     = 0;
        // 5.SkeletonAnimationにSkeletonDataAssetを紐付け、skinName、reset(),animationNameを設定する。
        anim.skeletonDataAsset = dataAsset;

        // Reset()前に呼び出す必要あり。後に呼ぶとskinデータが反映されない
        anim.initialSkinName = "goblin";

        // Reset()時にDataAssetからAnimationデータを読みだして格納している
        anim.Reset();

        // ループの設定はAnimation指定前じゃないと反映されない
        anim.loop          = true;
        anim.AnimationName = "walk";

        // アニメ終了イベントをセット
        anim.state.Complete += OnCompleteSpineAnim;

        obj.transform.SetParent(this.gameObject.transform);
    }
コード例 #9
0
    /// <summary>
    /// 重置Spine2D动画
    /// </summary>
    /// <param name="obj"></param>
    public static void ResetSpin2DAnim(GameObject obj)
    {
        if (obj == null)
        {
            return;
        }
        SkeletonAnimation skeletonAnimation = obj.GetComponent <SkeletonAnimation>();

        if (skeletonAnimation == null)
        {
            return;
        }

        skeletonAnimation.Reset();
    }
コード例 #10
0
 public void SetScoutingRadar()
 {
     scoutRadar.gameObject.SetActive(true);
     scoutRadar.Reset();
     scoutRadar.state.SetAnimation(0, "pulse", false);
     if (LastCurrentRoom != null)
     {
         scoutRadar.transform.SetParent(LastCurrentRoom.SlotRect, false);
         scoutRadar.transform.position = LastCurrentRoom.SlotRect.position;
     }
     else if (LastHallwaySector != null)
     {
         scoutRadar.transform.SetParent(LastHallwaySector.rectTransform, false);
         scoutRadar.transform.position = LastHallwaySector.rectTransform.position;
     }
 }
コード例 #11
0
    public void SetPerformerSkillAnimationOverriden(SkillArtInfo skillInfo, string mode, bool activate)
    {
        SkeletonAnimation skillAnimation = unitAnimator.Effects.Find(item => item.name == skillInfo.ArtId);

        if (skillAnimation != null)
        {
            skillAnimation.gameObject.layer = CurrentState.gameObject.layer;
            skillAnimation.gameObject.SetActive(activate);
            if (activate)
            {
                skillAnimation.Reset();
                skillAnimation.state.SetAnimation(0, skillInfo.ArtId + "_" + mode, false).Time = 0;
                skillAnimation.Update(0);
                skillAnimation.AnimationName = skillInfo.ArtId + "_" + mode;
            }
        }
        unitAnimator.Animator.SetBool(skillInfo.AnimationId + "_" + mode, activate);
    }
コード例 #12
0
    // Use this for initialization
    void Start()
    {
        controller = GetComponent <Controller2D>();
        audio      = GetComponent <AudioSource> ();
        scale      = transform.localScale;

        // Ok we should get gravity and jumpVelocity from jumpHeight and timeToJumpApex
        // For gravity we will use the motion equation: delta(Movement) = v0 * time + (acceleration * time^2) / 2
        // in our case v0 = 0, time = timeToJumpApex, and delta(Movement) = jumpHeight...
        // so gravity = 2 * jumpHeight / timeToJumpApex^2
        gravity = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2);     // we added a "-" because we want it to be negative
        // Now we should get jump velocity from: velocity = v0 + acceleration * time
        jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;
        // Debug.Log("gravity: " + gravity + "; jumpVelocity: " + jumpVelocity);
        spineAnim = GetComponent <SkeletonAnimation>();
        spineAnim.Reset();
        spineAnim.state.SetAnimation(0, "idle", true);
        curr_anim = "idle";
    }
コード例 #13
0
    public static SkeletonAnimation SpawnAnimatedSkeleton(SkeletonDataAsset skeletonDataAsset, Skin skin = null)
    {
        GameObject        go   = new GameObject(skeletonDataAsset.name.Replace("_SkeletonData", ""), typeof(MeshFilter), typeof(MeshRenderer), typeof(SkeletonAnimation));
        SkeletonAnimation anim = go.GetComponent <SkeletonAnimation>();

        anim.skeletonDataAsset = skeletonDataAsset;

        bool requiresNormals = false;

        foreach (Material m in anim.skeletonDataAsset.atlasAsset.materials)
        {
            if (m.shader.name.Contains("Lit"))
            {
                requiresNormals = true;
                break;
            }
        }

        anim.calculateNormals = requiresNormals;

        if (skin == null)
        {
            skin = skeletonDataAsset.GetSkeletonData(true).DefaultSkin;
        }

        if (skin == null)
        {
            skin = skeletonDataAsset.GetSkeletonData(true).Skins[0];
        }

        anim.Reset();

        anim.skeleton.SetSkin(skin);
        anim.initialSkinName = skin.Name;

        anim.skeleton.Update(1);
        anim.state.Update(1);
        anim.state.Apply(anim.skeleton);
        anim.skeleton.UpdateWorldTransform();

        return(anim);
    }
コード例 #14
0
        public static void InitSpineAnim(this GameObject go, string skinName, string animName, bool loop = false)
        {
            SkeletonAnimation anim = go.GetComponentInChildren <SkeletonAnimation> ();

            if (anim == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(skinName))
            {
                anim.initialSkinName = skinName;
            }
            anim.loop = loop;
            if (!string.IsNullOrEmpty(animName))
            {
                anim.AnimationName = animName;
            }
            anim.Reset();
            anim.LateUpdate();
        }
コード例 #15
0
    public static SkeletonAnimation SpawnAnimatedSkeleton(SkeletonDataAsset skeletonDataAsset, Skin skin = null)
    {
        GameObject        go   = new GameObject(skeletonDataAsset.name.Replace("_SkeletonData", ""), typeof(MeshFilter), typeof(MeshRenderer), typeof(SkeletonAnimation));
        SkeletonAnimation anim = go.GetComponent <SkeletonAnimation>();

        anim.skeletonDataAsset = skeletonDataAsset;



        SkeletonData data = skeletonDataAsset.GetSkeletonData(true);

        if (data == null)
        {
            return(null);
        }

        if (skin == null)
        {
            skin = data.DefaultSkin;
        }

        if (skin == null)
        {
            skin = data.Skins[0];
        }

        anim.Reset();

        anim.skeleton.SetSkin(skin);
        anim.initialSkinName = skin.Name;

        anim.skeleton.Update(1);
        anim.state.Update(1);
        anim.state.Apply(anim.skeleton);
        anim.skeleton.UpdateWorldTransform();

        return(anim);
    }
コード例 #16
0
    public void Initialize(int torchValue, int maxAmount = 100)
    {
        torchSwitch.Reset();
        torchSparks.Reset();

        if (!torchSwitch.gameObject.activeSelf)
        {
            torchSwitch.gameObject.SetActive(true);
        }
        if (!torchSparks.gameObject.activeSelf)
        {
            torchSparks.gameObject.SetActive(true);
        }

        TorchAmount = Mathf.Clamp(torchValue, 0, maxAmount);
        MaxAmount   = 100;

        Ranges = new List <TorchRange>()
        {
            new TorchRange(TorchRangeType.Radiant, "radiant_loop", 76, 100),
            new TorchRange(TorchRangeType.Dim, "dim_loop", 51, 75),
            new TorchRange(TorchRangeType.Shadowy, "shadowy_loop", 26, 50),
            new TorchRange(TorchRangeType.Dark, "dark_loop", 1, 25),
            new TorchRange(TorchRangeType.Out, "out_loop", 0, 0),
        };

        Ranges[0].SetChances(0.15f, 0, 0.25f);

        Ranges[1].SetChances(0.075f, 0, 0.15f);
        Ranges[1].HeroBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.StressDmgReceivedPercent,
            ModifierValue = 0.1f, Type = BuffType.StatAdd
        });
        Ranges[1].MonsterBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.DamageHigh,
            ModifierValue = 0.01f, Type = BuffType.StatAdd
        });

        Ranges[2].SetChances(0, 0.15f, 0.10f);
        Ranges[2].HeroBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.StressDmgReceivedPercent,
            ModifierValue = 0.2f, Type = BuffType.StatAdd
        });
        Ranges[2].HeroBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.CritChance,
            ModifierValue = 0.01f, Type = BuffType.StatAdd
        });
        Ranges[2].MonsterBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.AttackRating,
            ModifierValue = 0.05f, Type = BuffType.StatAdd
        });
        Ranges[2].MonsterBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.DamageLow,
            ModifierValue = 0.1f, Type = BuffType.StatMultiply
        });
        Ranges[2].MonsterBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.DamageHigh,
            ModifierValue = 0.1f, Type = BuffType.StatMultiply
        });
        Ranges[2].MonsterBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.DamageHigh,
            ModifierValue = 0.02f, Type = BuffType.StatAdd
        });

        Ranges[3].SetChances(0, 0.25f, 0.05f);
        Ranges[3].HeroBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.StressDmgReceivedPercent,
            ModifierValue = 0.3f, Type = BuffType.StatAdd
        });
        Ranges[3].HeroBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.CritChance,
            ModifierValue = 0.02f, Type = BuffType.StatAdd
        });
        Ranges[3].MonsterBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.AttackRating,
            ModifierValue = 0.1f, Type = BuffType.StatAdd
        });
        Ranges[3].MonsterBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.DamageLow,
            ModifierValue = 0.15f, Type = BuffType.StatMultiply
        });
        Ranges[3].MonsterBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.DamageHigh,
            ModifierValue = 0.15f, Type = BuffType.StatMultiply
        });
        Ranges[3].MonsterBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.DamageHigh,
            ModifierValue = 0.03f, Type = BuffType.StatAdd
        });

        Ranges[4].SetChances(0, 0.4f, 0);
        Ranges[4].HeroBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.StressDmgReceivedPercent,
            ModifierValue = 0.4f, Type = BuffType.StatAdd
        });
        Ranges[4].HeroBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.CritChance,
            ModifierValue = 0.03f, Type = BuffType.StatAdd
        });
        Ranges[4].MonsterBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.AttackRating,
            ModifierValue = 0.125f, Type = BuffType.StatAdd
        });
        Ranges[4].MonsterBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.DamageLow,
            ModifierValue = 0.25f, Type = BuffType.StatMultiply
        });
        Ranges[4].MonsterBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.DamageHigh,
            ModifierValue = 0.25f, Type = BuffType.StatMultiply
        });
        Ranges[4].MonsterBuffs.Add(new Buff()
        {
            Id            = "", AttributeType = AttributeType.DamageHigh,
            ModifierValue = 0.05f, Type = BuffType.StatAdd
        });

        for (int i = 0; i < Ranges.Count; i++)
        {
            if (Ranges[i].InRange(TorchAmount))
            {
                CurrentRange = Ranges[i];
                break;
            }
        }
        UpdateTorch();
    }
コード例 #17
0
    protected override void gui()
    {
        base.gui();
        SkeletonAnimation component = (SkeletonAnimation)target;

        if (!component.valid)
        {
            return;
        }

        //catch case where SetAnimation was used to set track 0 without using AnimationName
        if (Application.isPlaying)
        {
            TrackEntry currentState = component.state.GetCurrent(0);
            if (currentState != null)
            {
                if (component.AnimationName != animationName.stringValue)
                {
                    animationName.stringValue = currentState.Animation.Name;
                }
            }
        }

        EditorGUILayout.Space();

        //TODO:  Refactor this to use GenericMenu and callbacks to avoid interfering with control by other behaviours.
        // Animation name.

        String[] animations = new String[component.skeleton.Data.Animations.Count + 1];
        animations[0] = "<None>";
        int animationIndex = 0;

        for (int i = 0; i < animations.Length - 1; i++)
        {
            String name = component.skeleton.Data.Animations[i].Name;
            animations[i + 1] = name;
            if (name == animationName.stringValue)
            {
                animationIndex = i + 1;
            }
        }

        animationIndex = EditorGUILayout.Popup("Animation", animationIndex, animations);

        String selectedAnimationName = animationIndex == 0 ? null : animations[animationIndex];

        if (component.AnimationName != selectedAnimationName)
        {
            component.AnimationName   = selectedAnimationName;
            animationName.stringValue = selectedAnimationName;
        }



        EditorGUILayout.PropertyField(loop);
        EditorGUILayout.PropertyField(timeScale);
        component.timeScale = Math.Max(component.timeScale, 0);

        //自己的编辑器
        SkeletonAnimationInspector.enableEditorMode = EditorGUILayout.Toggle("Enable Anim Previewer", SkeletonAnimationInspector.enableEditorMode);
        if (enableEditorMode)
        {
            EditorGUILayout.PropertyField(animPlayType);
            if (animationIndex > 0)
            {
                float animDuration = component.skeleton.Data.Animations [animationIndex - 1].Duration;
                EditorGUILayout.PropertyField(currentAnimTime);
                //帧设置和显示页面
                EditorGUILayout.BeginHorizontal();
                frame = EditorGUILayout.IntField("Current Anim Frame", (int)Math.Min(frame, animDuration * 30));
                float loadWidth = GUI.skin.label.CalcSize(new GUIContent("load")).x + 20;
                if (GUILayout.Button("load", GUILayout.Width(loadWidth)))
                {
                    if (component.skeletonDataAsset != null)
                    {
                        component.currentAnimTime = (float)(frame / (30.0 * component.timeScale));
                    }
                }
                EditorGUILayout.EndHorizontal();
                //END
                float time        = Math.Max(component.currentAnimTime, 0);
                float maxAnimTime = (float)(animDuration / component.timeScale);
                component.currentAnimTime = GUILayout.HorizontalSlider(Math.Min(time, maxAnimTime), 0f, maxAnimTime);
                if (component.currentAnimTime != lastMaxAnimTime)
                {
                    component.PlayTo();
                    lastMaxAnimTime = component.currentAnimTime;
                    frame           = (int)(component.currentAnimTime * 30 * component.timeScale);
                }
                float reloadWidth = GUI.skin.label.CalcSize(new GUIContent("Reload")).x + 20;
                if (GUILayout.Button("Reload", GUILayout.Width(reloadWidth)))
                {
                    if (component.skeletonDataAsset != null)
                    {
                        if (component.skeletonDataAsset.atlasAsset != null)
                        {
                            component.skeletonDataAsset.atlasAsset.Reset();
                        }
                        component.skeletonDataAsset.Reset();
                        component.Reset();
                    }
                }
            }
        }
        else
        {
            component.animPlayType = SkeletonAnimation.AnimPlayType.SpineAnimation;
        }
        //END

        EditorGUILayout.Space();

        if (!isPrefab)
        {
            if (component.GetComponent <SkeletonUtility>() == null)
            {
                if (GUILayout.Button(new GUIContent("Add Skeleton Utility", SpineEditorUtilities.Icons.skeletonUtility), GUILayout.Height(30)))
                {
                    component.gameObject.AddComponent <SkeletonUtility>();
                }
            }
        }
    }
コード例 #18
0
    override public void OnInspectorGUI()
    {
        serializedObject.Update();
        SkeletonAnimation component = (SkeletonAnimation)target;

        EditorGUILayout.PropertyField(skeletonDataAsset);

        if (component.skeleton != null)
        {
            // Initial skin name.
            String[] skins     = new String[component.skeleton.Data.Skins.Count];
            int      skinIndex = 0;
            for (int i = 0; i < skins.Length; i++)
            {
                String name = component.skeleton.Data.Skins[i].Name;
                skins[i] = name;
                if (name == initialSkinName.stringValue)
                {
                    skinIndex = i;
                }
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Initial Skin");
            EditorGUIUtility.LookLikeControls();
            skinIndex = EditorGUILayout.Popup(skinIndex, skins);
            EditorGUILayout.EndHorizontal();

            initialSkinName.stringValue = skins[skinIndex];

            // Animation name.
            String[] animations = new String[component.skeleton.Data.Animations.Count + 1];
            animations[0] = "<None>";
            int animationIndex = 0;
            for (int i = 0; i < animations.Length - 1; i++)
            {
                String name = component.skeleton.Data.Animations[i].Name;
                animations[i + 1] = name;
                if (name == animationName.stringValue)
                {
                    animationIndex = i + 1;
                }
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Animation");
            EditorGUIUtility.LookLikeControls();
            animationIndex = EditorGUILayout.Popup(animationIndex, animations);
            EditorGUILayout.EndHorizontal();

            component.animationName   = animationIndex == 0 ? null : animations[animationIndex];
            animationName.stringValue = component.animationName;
        }

        // Animation loop.
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Loop");
        loop.boolValue = EditorGUILayout.Toggle(loop.boolValue);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.PropertyField(timeScale);
        EditorGUILayout.PropertyField(normals);
        EditorGUILayout.PropertyField(tangents);

        if (serializedObject.ApplyModifiedProperties() ||
            (Event.current.type == EventType.ValidateCommand && Event.current.commandName == "UndoRedoPerformed")
            )
        {
            if (!Application.isPlaying)
            {
                component.Reset();
            }
        }
    }
コード例 #19
0
 void Awake()
 {
     indicator.Reset();
     gameObject.SetActive(false);
 }
コード例 #20
0
    public void Initialize()
    {
        #region Popup Colors

        PopupColors = new Dictionary<string, Color>()
        {
            { "harmful", "harmful".ToColor() },
            { "notable", "notable".ToColor() },
            { "pop_text_stress_reduce", "pop_text_stress_reduce".ToColor() },
            { "pop_text_outline_stress_reduce", "pop_text_outline_stress_reduce".ToColor() },
            { "pop_text_stress_damage", "pop_text_stress_damage".ToColor() },
            { "pop_text_outline_stress_damage", "pop_text_outline_stress_damage".ToColor() },
            { "pop_text_miss", "pop_text_miss".ToColor() },
            { "pop_text_outline_miss", "pop_text_outline_miss".ToColor() },
            { "pop_text_no_damage", "pop_text_no_damage".ToColor() },
            { "pop_text_outline_no_damage", "pop_text_outline_no_damage".ToColor() },
            { "pop_text_crit_damage", "pop_text_crit_damage".ToColor() },
            { "pop_text_outline_crit_damage", "pop_text_outline_crit_damage".ToColor() },
            { "pop_text_damage", "pop_text_damage".ToColor() },
            { "pop_text_outline_damage", "pop_text_outline_damage".ToColor() },
            { "pop_text_deathblow", "pop_text_deathblow".ToColor() },
            { "pop_text_outline_deathblow", "pop_text_outline_deathblow".ToColor() },
            { "pop_text_death_avoided", "pop_text_death_avoided".ToColor() },
            { "pop_text_outline_death_avoided", "pop_text_outline_death_avoided".ToColor() },
            { "pop_text_disease_resist", "pop_text_disease_resist".ToColor() },
            { "pop_text_outline_disease_resist", "pop_text_outline_disease_resist".ToColor() },
            { "pop_text_pass", "pop_text_pass".ToColor() },
            { "pop_text_outline_pass", "pop_text_outline_pass".ToColor() },
            { "pop_text_heal", "pop_text_heal".ToColor() },
            { "pop_text_outline_heal", "pop_text_outline_heal".ToColor() },
            { "pop_text_heal_crit", "pop_text_heal_crit".ToColor() },
            { "pop_text_outline_heal_crit", "pop_text_outline_heal_crit".ToColor() },
            { "pop_text_buff", "pop_text_buff".ToColor() },
            { "pop_text_outline_buff", "pop_text_outline_buff".ToColor() }, 
            { "pop_text_debuff", "pop_text_debuff".ToColor() },
            { "pop_text_outline_debuff", "pop_text_outline_debuff".ToColor() },
            { "pop_text_stun", "pop_text_stun".ToColor() },
            { "pop_text_outline_stun", "pop_text_outline_stun".ToColor() },
            { "pop_text_stun_clear", "pop_text_stun_clear".ToColor() },
            { "pop_text_outline_stun_clear", "pop_text_outline_stun_clear".ToColor() },
            { "pop_text_poison", "pop_text_poison".ToColor() },
            { "pop_text_outline_poison", "pop_text_outline_poison".ToColor() },
            { "pop_text_bleed", "pop_text_bleed".ToColor() },
            { "pop_text_outline_bleed", "pop_text_outline_bleed".ToColor() },
            { "pop_text_cured", "pop_text_cured".ToColor() },
            { "pop_text_outline_cured", "pop_text_outline_cured".ToColor() },
            { "pop_text_tagged", "pop_text_tagged".ToColor() },
            { "pop_text_outline_tagged", "pop_text_outline_tagged".ToColor() },
            { "pop_text_riposte", "pop_text_riposte".ToColor() },
            { "pop_text_outline_riposte", "pop_text_outline_riposte".ToColor() },
            { "pop_text_guard", "pop_text_guard".ToColor() },
            { "pop_text_outline_guard", "pop_text_outline_guard".ToColor() },
            { "pop_text_full", "pop_text_full".ToColor() },
            { "pop_text_outline_full", "pop_text_outline_full".ToColor() },
            { "pop_text_heart_attack", "pop_text_heart_attack".ToColor() },
            { "pop_text_outline_heart_attack", "pop_text_outline_heart_attack".ToColor() },
            { "pop_text_move_resist", "pop_text_move_resist".ToColor() },
            { "pop_text_outline_move_resist", "pop_text_outline_move_resist".ToColor() },
            { "pop_text_debuff_resist", "pop_text_debuff_resist".ToColor() },
            { "pop_text_outline_debuff_resist", "pop_text_outline_debuff_resist".ToColor() },
            { "pop_text_stun_resist", "pop_text_stun_resist".ToColor() },
            { "pop_text_outline_stun_resist", "pop_text_outline_stun_resist".ToColor() },
            { "pop_text_poison_resist", "pop_text_poison_resist".ToColor() },
            { "pop_text_outline_poison_resist", "pop_text_outline_poison_resist".ToColor() },
            { "pop_text_bleed_resist", "pop_text_bleed_resist".ToColor() }, 
            { "pop_text_outline_bleed_resist", "pop_text_outline_bleed_resist".ToColor() },
        };

        #endregion

        loot.Initialize();
        meal.Initialize();
        itemInteraction.Initialize();
        itemInteraction.OnScrollOpened += RaidSceneManager.Instanse.DisablePartyMovement;

        battleAnnouncment.Reset();
    }
コード例 #21
0
ファイル: Player.cs プロジェクト: elrod/Aegyptia
    // Use this for initialization
    void Start()
    {
        controller = GetComponent<Controller2D>();
        audio = GetComponent<AudioSource> ();
        scale = transform.localScale;

        // Ok we should get gravity and jumpVelocity from jumpHeight and timeToJumpApex
        // For gravity we will use the motion equation: delta(Movement) = v0 * time + (acceleration * time^2) / 2
        // in our case v0 = 0, time = timeToJumpApex, and delta(Movement) = jumpHeight...
        // so gravity = 2 * jumpHeight / timeToJumpApex^2
        gravity = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2);     // we added a "-" because we want it to be negative
        // Now we should get jump velocity from: velocity = v0 + acceleration * time
        jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;
        // Debug.Log("gravity: " + gravity + "; jumpVelocity: " + jumpVelocity);
        spineAnim = GetComponent<SkeletonAnimation>();
        spineAnim.Reset();
        spineAnim.state.SetAnimation(0, "idle", true);
        curr_anim = "idle";
    }
コード例 #22
0
    public void Initialize()
    {
        #region Popup Colors
        PopupColors = new Dictionary <string, Color>()
        {
            { "harmful", DarkestDungeonManager.Data.FromHexDatabase("harmful") },
            { "notable", DarkestDungeonManager.Data.FromHexDatabase("notable") },
            { "pop_text_stress_reduce", DarkestDungeonManager.Data.FromHexDatabase("pop_text_stress_reduce") },
            { "pop_text_outline_stress_reduce", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_stress_reduce") },
            { "pop_text_stress_damage", DarkestDungeonManager.Data.FromHexDatabase("pop_text_stress_damage") },
            { "pop_text_outline_stress_damage", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_stress_damage") },
            { "pop_text_miss", DarkestDungeonManager.Data.FromHexDatabase("pop_text_miss") },
            { "pop_text_outline_miss", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_miss") },
            { "pop_text_no_damage", DarkestDungeonManager.Data.FromHexDatabase("pop_text_no_damage") },
            { "pop_text_outline_no_damage", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_no_damage") },
            { "pop_text_crit_damage", DarkestDungeonManager.Data.FromHexDatabase("pop_text_crit_damage") },
            { "pop_text_outline_crit_damage", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_crit_damage") },
            { "pop_text_damage", DarkestDungeonManager.Data.FromHexDatabase("pop_text_damage") },
            { "pop_text_outline_damage", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_damage") },
            { "pop_text_deathblow", DarkestDungeonManager.Data.FromHexDatabase("pop_text_deathblow") },
            { "pop_text_outline_deathblow", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_deathblow") },
            { "pop_text_death_avoided", DarkestDungeonManager.Data.FromHexDatabase("pop_text_death_avoided") },
            { "pop_text_outline_death_avoided", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_death_avoided") },
            { "pop_text_disease_resist", DarkestDungeonManager.Data.FromHexDatabase("pop_text_disease_resist") },
            { "pop_text_outline_disease_resist", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_disease_resist") },
            { "pop_text_pass", DarkestDungeonManager.Data.FromHexDatabase("pop_text_pass") },
            { "pop_text_outline_pass", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_pass") },
            { "pop_text_heal", DarkestDungeonManager.Data.FromHexDatabase("pop_text_heal") },
            { "pop_text_outline_heal", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_heal") },
            { "pop_text_heal_crit", DarkestDungeonManager.Data.FromHexDatabase("pop_text_heal_crit") },
            { "pop_text_outline_heal_crit", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_heal_crit") },
            { "pop_text_buff", DarkestDungeonManager.Data.FromHexDatabase("pop_text_buff") },
            { "pop_text_outline_buff", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_buff") },
            { "pop_text_debuff", DarkestDungeonManager.Data.FromHexDatabase("pop_text_debuff") },
            { "pop_text_outline_debuff", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_debuff") },
            { "pop_text_stun", DarkestDungeonManager.Data.FromHexDatabase("pop_text_stun") },
            { "pop_text_outline_stun", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_stun") },
            { "pop_text_stun_clear", DarkestDungeonManager.Data.FromHexDatabase("pop_text_stun_clear") },
            { "pop_text_outline_stun_clear", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_stun_clear") },
            { "pop_text_poison", DarkestDungeonManager.Data.FromHexDatabase("pop_text_poison") },
            { "pop_text_outline_poison", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_poison") },
            { "pop_text_bleed", DarkestDungeonManager.Data.FromHexDatabase("pop_text_bleed") },
            { "pop_text_outline_bleed", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_bleed") },
            { "pop_text_cured", DarkestDungeonManager.Data.FromHexDatabase("pop_text_cured") },
            { "pop_text_outline_cured", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_cured") },
            { "pop_text_tagged", DarkestDungeonManager.Data.FromHexDatabase("pop_text_tagged") },
            { "pop_text_outline_tagged", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_tagged") },
            { "pop_text_riposte", DarkestDungeonManager.Data.FromHexDatabase("pop_text_riposte") },
            { "pop_text_outline_riposte", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_riposte") },
            { "pop_text_guard", DarkestDungeonManager.Data.FromHexDatabase("pop_text_guard") },
            { "pop_text_outline_guard", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_guard") },
            { "pop_text_full", DarkestDungeonManager.Data.FromHexDatabase("pop_text_full") },
            { "pop_text_outline_full", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_full") },
            { "pop_text_heart_attack", DarkestDungeonManager.Data.FromHexDatabase("pop_text_heart_attack") },
            { "pop_text_outline_heart_attack", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_heart_attack") },
            { "pop_text_move_resist", DarkestDungeonManager.Data.FromHexDatabase("pop_text_move_resist") },
            { "pop_text_outline_move_resist", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_move_resist") },
            { "pop_text_debuff_resist", DarkestDungeonManager.Data.FromHexDatabase("pop_text_debuff_resist") },
            { "pop_text_outline_debuff_resist", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_debuff_resist") },
            { "pop_text_stun_resist", DarkestDungeonManager.Data.FromHexDatabase("pop_text_stun_resist") },
            { "pop_text_outline_stun_resist", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_stun_resist") },
            { "pop_text_poison_resist", DarkestDungeonManager.Data.FromHexDatabase("pop_text_poison_resist") },
            { "pop_text_outline_poison_resist", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_poison_resist") },
            { "pop_text_bleed_resist", DarkestDungeonManager.Data.FromHexDatabase("pop_text_bleed_resist") },
            { "pop_text_outline_bleed_resist", DarkestDungeonManager.Data.FromHexDatabase("pop_text_outline_bleed_resist") },
        };
        #endregion

        loot.partyInventory.Configuration = InventoryConfiguration.LootInventory;
        loot.Initialize();
        meal.Initialize();
        itemInteraction.Initialize();
        itemInteraction.onScrollOpened += RaidSceneManager.Instanse.DisablePartyMovement;

        battleAnnouncment.Reset();
    }