87 lines
1.9 KiB
C#
87 lines
1.9 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace Stary.Evo
|
|
{
|
|
public static class VectorExtension
|
|
{
|
|
public static Vector3Ctor GetVector3Ctor(this Vector3 vector)
|
|
{
|
|
return new Vector3Ctor(vector);
|
|
}
|
|
|
|
public static Vector3 SetVector3Ctor(this Vector3Ctor vector3Ctor)
|
|
{
|
|
return new Vector3(vector3Ctor.x, vector3Ctor.y, vector3Ctor.z);
|
|
}
|
|
|
|
public static Vector2Ctor GetVector2Ctor(this Vector2 vector)
|
|
{
|
|
return new Vector2Ctor(vector);
|
|
}
|
|
|
|
public static Vector2 SetVector2Data(this Vector2Ctor vector3Ctor)
|
|
{
|
|
return new Vector2(vector3Ctor.x, vector3Ctor.y);
|
|
}
|
|
|
|
public static TransformCtor GetTransformCtor(this Transform transform)
|
|
{
|
|
return new TransformCtor(transform);
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public class Vector3Ctor
|
|
{
|
|
public float x;
|
|
public float y;
|
|
public float z;
|
|
|
|
public Vector3Ctor()
|
|
{
|
|
}
|
|
|
|
public Vector3Ctor(Vector3 vector)
|
|
{
|
|
x = vector.x;
|
|
y = vector.y;
|
|
z = vector.z;
|
|
}
|
|
|
|
public Vector3Ctor(float x, float y, float z)
|
|
{
|
|
this.x = x;
|
|
this.y = y;
|
|
this.z = z;
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public class Vector2Ctor
|
|
{
|
|
public float x;
|
|
public float y;
|
|
|
|
public Vector2Ctor(Vector2 vector)
|
|
{
|
|
x = vector.x;
|
|
y = vector.y;
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public class TransformCtor
|
|
{
|
|
public Vector3 position;
|
|
public Vector3 rotation;
|
|
public Vector3 scale;
|
|
|
|
public TransformCtor(Transform transform)
|
|
{
|
|
position = transform.position;
|
|
rotation = transform.eulerAngles;
|
|
scale = transform.localScale;
|
|
}
|
|
}
|
|
} |