Beispiel #1
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        CharacterActionBuffComponent component = ((CharacterActionBuffComponent)target);
        CharacterActionBuffData      data      = component.data;

        loop_list.data = data;
        hit_list.data  = data;

        data.AnimationName = EditorGUILayout.TextField("Animation", data.AnimationName);
        data.Freeze        = EditorGUILayout.Toggle("Freeze", data.Freeze);
        EditorGUILayout.BeginHorizontal();
        int select_index = EditorGUILayout.Popup("State Color", color_container.GetSelectedIndex(data.StateColorName), Names);

        ColorData new_color;

        if (select_index == Names.Length - 1)
        {
            var color_list = new List <ColorData>(color_container.Colors);
            new_color      = new ColorData();
            new_color.name = "New";
            color_list.Add(new_color);
            color_container.Colors = color_list.ToArray();

            RefreshNames();
        }
        new_color           = color_container.Colors[select_index];
        data.StateColorName = new_color.name;
        Color32 change_color = EditorGUILayout.ColorField(new_color.color);

        if (change_color.Equals(new_color.color) == false)
        {
            new_color.color = change_color;
            EditorUtility.SetDirty(color_container);
        }
        EditorGUILayout.EndHorizontal();

        data.TweenName = HFX_TweenSystemInspector.OnInspectorTween(component.GetComponent <HFX_TweenSystem>(), data.TweenName);

        if (component.sub_components == null)
        {
            component.sub_components = new CharacterActionBuffComponent[0];
            EditorUtility.SetDirty(target);
        }
        SerializedProperty sp = serializedObject.FindProperty("sub_components");

        EditorGUILayout.PropertyField(sp, new GUIContent(string.Format("Sub Actions ({0})", component.sub_components.Length)), true);

        loop_list.OnInspectorGUI();
        hit_list.OnInspectorGUI();

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
        serializedObject.ApplyModifiedProperties();
    }
Beispiel #2
0
    override public void OnBuff(CharacterActionBuffComponent buff_component, bool is_lighting, float apply_scale)
    {
        if (buff_index >= Skill.Info.Actions.Count)
        {
            Debug.LogErrorFormat("buff index failed : {0} in {1}", buff_index, Skill.Info.ID);
            return;
        }
        SkillInfo.Action buff_action = Skill.Info.Actions[buff_index++];

        if (m_Creature.IsDead == true || buff_action.check_distance == true && Character.MoveDistance > BattleConfig.Instance.HitDistance)
        {
            return;
        }

        ISkillBuff apply_buff = DoBuff(buff_action, Skill.Creature, m_Creature, Skill, m_TargetIndex, null);

        if (apply_buff != null)
        {
            CharacterActionBuff new_action = buff_component.data.CreateAction(buff_component, Character.PlaybackTime, Character, apply_buff.Duration, is_lighting, apply_scale);
            apply_buff.Action = new_action;
        }

        for (int sub_index = 0; sub_index < buff_action.SubActions.Count; ++sub_index)
        {
            var sub_action = buff_action.SubActions[sub_index];
            var sub_buff   = DoBuff(sub_action, Skill.Creature, m_Creature, Skill, m_TargetIndex, apply_buff);
            if (sub_buff == null)
            {
                continue;
            }

            if (apply_buff == null)
            {
                apply_buff = sub_buff;

                if (buff_component.sub_components.Length == 0)
                {
                    CharacterActionBuff new_action = buff_component.data.CreateAction(buff_component, Character.PlaybackTime, Character, apply_buff.Duration, is_lighting, apply_scale);
                    apply_buff.Action = new_action;
                }
            }

            if (sub_index < buff_component.sub_components.Length)
            {
                var sub_component = buff_component.sub_components[sub_index];
                CharacterActionBuff new_action = sub_component.data.CreateAction(sub_component, Character.PlaybackTime, Character, apply_buff.Duration, is_lighting, apply_scale);
                sub_buff.Action = new_action;
            }
        }
    }
Beispiel #3
0
    public CharacterActionBuff(CharacterActionBuffComponent component, float playback_time, Character self, float buff_time, bool is_lighting, float move_scale)
    {
        this.m_Name  = component.name;
        this.Data    = component.data.Clone(true, self);
        this.self    = self;
        StartTime    = playback_time;
        m_BuffTime   = buff_time;
        PlaybackTime = playback_time;

        if (Data.Freeze == true)
        {
            self.SetFreeze();
        }

        if (string.IsNullOrEmpty(Data.AnimationName) == false)
        {
            m_Length = self.PlayAnimation(Data.AnimationName);
        }

        foreach (var effect in Data.loop)
        {
            if (self.CharacterAnimation.DummyMode == eCharacterDummyMode.Hidden)
            {
                effect.SetHidden(true);
            }
            effect.Play(is_lighting, 0f);
            effect.Update(0f);
        }

        if (string.IsNullOrEmpty(Data.TweenName) == false)
        {
            HFX_TweenSystem tween_system = component.GetComponent <HFX_TweenSystem>();
            if (tween_system != null)
            {
                m_TweenBundle = tween_system.Play(Data.TweenName, null, self.GetComponent <HFX_TweenSystem>(), self.transform.GetChild(0), move_scale);
            }
        }
    }
Beispiel #4
0
 abstract public void OnBuff(CharacterActionBuffComponent buff_component, bool is_lighting, float apply_scale);
Beispiel #5
0
 public CharacterActionBuff CreateAction(CharacterActionBuffComponent component, float playback_time, Character self, float buff_time, bool is_lighting, float move_scale)
 {
     return(new CharacterActionBuff(component, playback_time, self, buff_time, is_lighting, move_scale));
 }