Пример #1
0
    public CharacterActionHit(CharacterActionHitComponent component, float playback_time, Character _self, bool is_lighting, float action_scale, eSkillTargetHit hit)
    {
        self        = _self;
        this.m_Name = component.name;
        this.Data   = component.data.Clone(true, self);
        StartTime   = playback_time;

        if (hit == eSkillTargetHit.Hit)
        {
            m_Length = self.PlayAnimation(Data.AnimationName);

            foreach (var effect in Data.effects)
            {
                effect.Play(is_lighting, action_scale);
            }
        }

        if (string.IsNullOrEmpty(Data.TweenName) == false)
        {
            HFX_TweenSystem tween_system = component.GetComponent <HFX_TweenSystem>();
            if (tween_system != null && self.IgnoreTween == false)
            {
                tween_system.Play(Data.TweenName, null, self.GetComponent <HFX_TweenSystem>(), component.data.TweenTarget == eCharacterTweenTarget.Character?self.transform:self.transform.GetChild(0), hit == eSkillTargetHit.Hit?action_scale:0.6f);
            }
        }
    }
Пример #2
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);
            }
        }
    }
Пример #3
0
    protected override void Start(float playback_time)
    {
        HFX_ParticleSystem temp_particle_system_prefab = particle_system_prefab;

        particle_system_prefab = null;

        base.Start(playback_time);

        if (temp_particle_system_prefab != null)
        {
            particle_system = GameObject.Instantiate <HFX_ParticleSystem>(temp_particle_system_prefab);
            particle_system.SetLightingMax(IsLighting?1f:0f);
            particle_system.transform.localPosition += particle_position;
            particle_system.ApplyScale(ActionScale);

            switch (AttachParticle)
            {
            case eAttachParticle.Target:
            case eAttachParticle.TargetScale:
                particle_system.transform.SetParent(target.transform.parent, false);
                if (AttachParticle == eAttachParticle.TargetScale)
                {
                    Vector3 scale = particle_system.transform.localScale;
                    scale *= ActionScale;
                    particle_system.transform.localScale = scale;
                }
                break;

            case eAttachParticle.Self:
                particle_system.transform.SetParent(self.transform.parent, false);
                break;

            case eAttachParticle.World:
            case eAttachParticle.WorldScale:
            case eAttachParticle.Center:
            case eAttachParticle.SelfCenter:
            case eAttachParticle.TargetCenter:
                particle_system_container = new GameObject(particle_system.name + " Container");
                particle_system.transform.SetParent(particle_system_container.transform, false);
                particle_system_container.transform.position = self.transform.position;
                if (AttachParticle == eAttachParticle.TargetCenter && target.transform.lossyScale.x < 0f || AttachParticle != eAttachParticle.TargetCenter && self.transform.lossyScale.x < 0f)
                {
                    Vector3 scale = particle_system_container.transform.localScale;
                    scale.x = -1f;
                    particle_system_container.transform.localScale = scale;
                }

                switch (AttachParticle)
                {
                case eAttachParticle.WorldScale:
                {
                    Vector3 scale = particle_system.transform.localScale;
                    scale *= ActionScale;
                    particle_system.transform.localScale = scale;
                }
                break;

                case eAttachParticle.SelfCenter:
                {
                    var self_layout = self.transform.parent.parent.GetComponent <CharacterLayout>();
                    particle_system_container.transform.position = self_layout.Center.transform.position;
                }
                break;

                case eAttachParticle.TargetCenter:
                {
                    var target_layout = target.transform.parent.parent.GetComponent <CharacterLayout>();
                    particle_system_container.transform.position = target_layout.Center.transform.position;
                }
                break;

                case eAttachParticle.Center:
                    particle_system_container.transform.position = Vector3.zero;
                    break;
                }
                break;
            }
            particle_system.Play(true, 0);
            particle_system.SetLensTilt(target.CharacterAnimation.IsUIMode ? 0.15f : 0f);

            if (string.IsNullOrEmpty(TweenName) == false)
            {
                HFX_TweenSystem tween = self.GetComponent <HFX_TweenSystem>();
                if (tween != null)
                {
                    tween_system = particle_system.GetComponent <HFX_TweenSystem>();
                    if (tween_system == null)
                    {
                        tween_system = particle_system.gameObject.AddComponent <HFX_TweenSystem>();
                    }
                    tween_system.IsPause = true;
                    switch (AttachParticle)
                    {
                    case eAttachParticle.World:
                        tween_bundle = tween.Play(TweenName, target.transform.parent, tween_system, null, 1f);
                        tween_bundle.SetClearWhenFinish(false);
                        break;

                    case eAttachParticle.WorldScale:
                        tween_bundle = tween.Play(TweenName, target.transform.parent, tween_system, null, ActionScale);
                        tween_bundle.SetClearWhenFinish(false);
                        break;

                    default:
                        tween_bundle = tween.Play(TweenName, target.transform.parent, tween_system, target.transform.GetChild(0), ActionScale);
                        break;
                    }
                }
            }
        }
    }