134 lines
3.8 KiB
C#
134 lines
3.8 KiB
C#
using UnityEngine;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.IO;
|
||
|
||
namespace Thousandto.Cinematic
|
||
{
|
||
//事件数据
|
||
[Serializable]
|
||
public class CinematicEventData : ICinematic
|
||
{
|
||
//[NonSerialized]
|
||
public bool FoldOut = true; //界面上控制折叠
|
||
|
||
public int EventType;
|
||
public KeyFrameEvent EventTypeEx;
|
||
public WrapMode WrapMode;
|
||
public float[] PositionV3 = new float[3];
|
||
public float[] RotationV3 = new float[3];
|
||
public float[] ScaleV3 = new float[3];
|
||
|
||
//模型、声音、特效的路径,根据事件类型,有不同意义
|
||
public string Param = "";
|
||
//编辑器模式下配置的模型路径
|
||
public string EditorParam = "";
|
||
public bool IsLocalPlayer = false;
|
||
//使用曲线
|
||
public bool UseCurve = true;
|
||
|
||
[NonSerialized]
|
||
public GameObject ParentGo; //当前事件所在的GameObject
|
||
[NonSerialized]
|
||
public CinematicObj CinematicObj; //当前事件所在的类对象
|
||
[NonSerialized]
|
||
public float AnimDuration; //动作播放间隔,,在触发PlayAnimByFrame的时候需要设置
|
||
|
||
|
||
public Vector3 Position
|
||
{
|
||
get
|
||
{
|
||
return new Vector3(PositionV3[0], PositionV3[1], PositionV3[2]);
|
||
}
|
||
set
|
||
{
|
||
PositionV3[0] = value.x;
|
||
PositionV3[1] = value.y;
|
||
PositionV3[2] = value.z;
|
||
}
|
||
}
|
||
public Vector3 Rotation
|
||
{
|
||
get
|
||
{
|
||
return new Vector3(RotationV3[0], RotationV3[1], RotationV3[2]);
|
||
}
|
||
set
|
||
{
|
||
RotationV3[0] = value.x;
|
||
RotationV3[1] = value.y;
|
||
RotationV3[2] = value.z;
|
||
}
|
||
}
|
||
public Vector3 Scale
|
||
{
|
||
get
|
||
{
|
||
return new Vector3(ScaleV3[0], ScaleV3[1], ScaleV3[2]);
|
||
}
|
||
set
|
||
{
|
||
ScaleV3[0] = value.x;
|
||
ScaleV3[1] = value.y;
|
||
ScaleV3[2] = value.z;
|
||
}
|
||
}
|
||
|
||
public override void WriteAll(BinaryWriter bw)
|
||
{
|
||
PrepareWriter(bw);
|
||
WriteInt(EventType);
|
||
WriteInt((int)EventTypeEx);
|
||
WriteInt((int)WrapMode);
|
||
WriteVector3(PositionV3);
|
||
WriteVector3(RotationV3);
|
||
WriteVector3(ScaleV3);
|
||
WriteString(Param);
|
||
WriteString(EditorParam);
|
||
WriteBool(IsLocalPlayer);
|
||
WriteBool(UseCurve);
|
||
}
|
||
|
||
public override void ReadAll(BinaryReader rd)
|
||
{
|
||
PrepareReader(rd);
|
||
EventType = ReadInt();
|
||
EventTypeEx = (KeyFrameEvent) ReadInt();
|
||
WrapMode = (WrapMode)ReadInt();
|
||
PositionV3 = ReadVector3();
|
||
RotationV3 = ReadVector3();
|
||
ScaleV3 = ReadVector3();
|
||
Param = ReadString();
|
||
EditorParam = ReadString();
|
||
IsLocalPlayer = ReadBool();
|
||
UseCurve = ReadBool();
|
||
}
|
||
|
||
public CinematicEventData()
|
||
{ }
|
||
|
||
public CinematicEventData(KeyFrameEvent e)
|
||
{
|
||
EventTypeEx = e;
|
||
}
|
||
|
||
public CinematicEventData Clone()
|
||
{
|
||
CinematicEventData data = new CinematicEventData();
|
||
data.EventType = EventType;
|
||
data.Position = Position;
|
||
data.Rotation = Rotation;
|
||
data.Scale = Scale;
|
||
data.EditorParam = EditorParam;
|
||
data.EventTypeEx = EventTypeEx;
|
||
data.WrapMode = WrapMode;
|
||
data.Param = Param;
|
||
data.EditorParam = EditorParam;
|
||
return data;
|
||
}
|
||
|
||
|
||
}
|
||
}
|