(client) feat:实现血条显示,实现攻击交互,添加碰撞体;fix:修复部分朝向贴图加载失败的问题;chore:规范工作类和行为获取类命名
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Prefab;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
@ -10,6 +10,7 @@ namespace Entity
|
||||
public GameObject body;
|
||||
public SpriteRenderer outlineRenderer;
|
||||
public CapsuleCollider2D outlineCollider;
|
||||
public ProgressBarPrefab progressBarPrefab;
|
||||
|
||||
public Entity entity;
|
||||
|
||||
@ -23,6 +24,9 @@ namespace Entity
|
||||
outlineRenderer.size = size;
|
||||
outlineCollider.direction = size.x > size.y ? CapsuleDirection2D.Horizontal : CapsuleDirection2D.Vertical;
|
||||
outlineCollider.size = size;
|
||||
|
||||
progressBarPrefab.transform.localPosition += new Vector3(0f,size.y * 2 / 3,0f);
|
||||
progressBarPrefab.transform.localScale = new Vector3(size.x, size.x / 10, 1);
|
||||
}
|
||||
|
||||
public void Show()
|
||||
@ -76,23 +80,23 @@ namespace Entity
|
||||
private void OnMouseEnter()
|
||||
{
|
||||
Show();
|
||||
_select = true;
|
||||
}
|
||||
|
||||
private void OnMouseExit()
|
||||
{
|
||||
Hide();
|
||||
_select = false;
|
||||
}
|
||||
|
||||
private void OnMouseOver()
|
||||
{
|
||||
if (!entity.canSelect)
|
||||
return;
|
||||
// 检测是否按下的是鼠标右键
|
||||
if (Input.GetMouseButtonDown(1)) // 鼠标右键对应的是按钮索引 1
|
||||
{
|
||||
var rightMenu = Base.RightMenu.Instance;
|
||||
rightMenu.Init(GetMenu());
|
||||
rightMenu.transform.position = Input.mousePosition;
|
||||
rightMenu.Position = Input.mousePosition;
|
||||
rightMenu.Show();
|
||||
}
|
||||
}
|
||||
@ -104,6 +108,14 @@ namespace Entity
|
||||
result.Add(("结束操控", EndControl));
|
||||
else
|
||||
result.Add(("手动操控", StartControl));
|
||||
if (CameraControl.CameraControl.Instance.focusedEntity == entity)
|
||||
{
|
||||
result.Add(("取消跟随", ()=>CameraControl.CameraControl.Instance.focusedEntity=null));
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Add(("视角跟随", ()=>CameraControl.CameraControl.Instance.focusedEntity=entity));
|
||||
}
|
||||
result.Add(("杀死", () => entity.Kill()));
|
||||
result.Add(("变成笨蛋", BecomeDefault));
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user