58 lines
1.4 KiB
C#
58 lines
1.4 KiB
C#
using ET;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace ET
|
|
{
|
|
public class UnitView : Entity
|
|
{
|
|
public GameObject gameObject;
|
|
public Transform transform;
|
|
|
|
public float yDelta;
|
|
public float xDelta;
|
|
|
|
public SpriteRenderer spriteRenderer;
|
|
|
|
public MonoAnimancer monoAnimancer;
|
|
|
|
public SpriteRenderer footEffect;
|
|
public Transform HeadPoint;
|
|
public Transform FootPoint;
|
|
public Unit unit;
|
|
/// <summary>
|
|
/// 父物体坐标
|
|
/// </summary>
|
|
public Vector3 Position
|
|
{
|
|
get
|
|
{
|
|
return transform.position;
|
|
}
|
|
set
|
|
{
|
|
transform.position = value + new Vector3(xDelta, yDelta, 0);
|
|
}
|
|
}
|
|
public bool IsFlip
|
|
{
|
|
get => spriteRenderer.flipX;
|
|
set => spriteRenderer.flipX = value;
|
|
}
|
|
public Vector3 AtkPosition
|
|
{
|
|
get
|
|
{
|
|
if (FootPoint && HeadPoint)
|
|
return new Vector3(FootPoint.position.x, (HeadPoint.position.y + FootPoint.position.y) / 2, FootPoint.position.z);
|
|
else
|
|
{
|
|
Log.Error($"HeadPoint = {HeadPoint} FootPoint = {FootPoint}");
|
|
return default;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|