summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Avatar/Actions/ActionEffects/ActionPlayEffect.cs
blob: 6a00aaa84a124a679dc55d3446fe1c642119eb02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

// 播放特效
public class ActionPlayEffect : ActionBase
{
    enum Type
    {
        GivenPosition,  // 固定位置
        FollowObject,  // 动态位置
        Avatar, // 角色
    }

    Type m_Type;

    string m_Effect;
    Vector3 m_Position;
    Vector3 m_Rotation;
    Vector3 m_Scale;
    Transform m_Follow;
    Avatar m_Avatar;

    public ActionPlayEffect(string effect, Vector3 position, Vector3 rotation, Vector3 scale)
    {

    }

    public ActionPlayEffect(string effect, Transform followPosition, Vector3 rotation, Vector3 scale)
    {

    }

    public ActionPlayEffect(string effect, Avatar avatar, Vector3 rotation, Vector3 scale)
    {
        m_Type = Type.Avatar;
        m_Effect = effect;
        m_Avatar = avatar;
        m_Rotation = rotation;
        m_Scale = scale;
    }

    public override void Execute()
    {
        if (m_Type == Type.Avatar)
            m_Position = m_Avatar.GetEffectPosition();
        EffectsManager.Instance.PlayEffect(m_Effect, m_Position, m_Rotation, m_Scale);
    }
}