|
|
@@ -60,8 +60,8 @@ public class BlackUmbrella : MonoBehaviour
|
|
|
[LabelText("黑伞消失时长")]
|
|
|
public float disappearTime;
|
|
|
[LabelText("黑伞位置提示特效")]
|
|
|
- public GameObject effect;
|
|
|
- private GameObject effectIns;
|
|
|
+ //public GameObject effect;
|
|
|
+ public GameObject effectIns;
|
|
|
private SpriteRenderer effectInsSr;
|
|
|
public float initialTransparency = 0.5f;
|
|
|
//提示X坐标
|
|
|
@@ -81,6 +81,7 @@ public class BlackUmbrella : MonoBehaviour
|
|
|
attackCon = owner.GetComponent<WaterSpriteAttackController>();
|
|
|
pc = PlayersInput.instance[0];
|
|
|
ani.runtimeAnimatorController = rac;
|
|
|
+ effectIns.GetComponent<Bullet>().owner = ws;
|
|
|
}
|
|
|
|
|
|
//放出这个攻击!
|
|
|
@@ -199,14 +200,12 @@ public class BlackUmbrella : MonoBehaviour
|
|
|
{
|
|
|
umbrePastTime = 0;
|
|
|
hasBackAni = false;
|
|
|
- ws.isHoldingUmbre = true;
|
|
|
ChangeUmbrellaState(UmbrellaState.disappear);
|
|
|
}
|
|
|
else if (!hasBackAni && umbrePastTime >= backTime - 0.6f)
|
|
|
{
|
|
|
hasBackAni = true;
|
|
|
attackCon.isUmbrellaBack = true;
|
|
|
- ws.isHoldingUmbre = true;
|
|
|
}
|
|
|
//if(transform.position.y < 4)
|
|
|
//{
|
|
|
@@ -252,18 +251,23 @@ public class BlackUmbrella : MonoBehaviour
|
|
|
|
|
|
private void ShowTip()
|
|
|
{
|
|
|
- if (!effectIns)
|
|
|
- {
|
|
|
- effectIns = PoolManager.Instantiate(effect, Camera.main.transform);
|
|
|
- effectIns.GetComponent<Bullet>().owner = ws;
|
|
|
- effectInsSr = effectIns.GetComponentInChildren<SpriteRenderer>();
|
|
|
+ //if (!effectIns)
|
|
|
+ //{
|
|
|
+ // effectIns = PoolManager.Instantiate(effect, Camera.main.transform);
|
|
|
+ // effectIns.GetComponent<Bullet>().owner = ws;
|
|
|
+ // effectInsSr = effectIns.GetComponentInChildren<SpriteRenderer>();
|
|
|
|
|
|
- // 初始化透明度为半透明(假设原本是0.5)
|
|
|
- var color = effectInsSr.color;
|
|
|
- color.a = initialTransparency;
|
|
|
- effectInsSr.color = color;
|
|
|
- }
|
|
|
+ // // 初始化透明度为半透明(假设原本是0.5)
|
|
|
+ // var color = effectInsSr.color;
|
|
|
+ // color.a = initialTransparency;
|
|
|
+ // effectInsSr.color = color;
|
|
|
+ //}
|
|
|
+ effectInsSr = effectIns.GetComponentInChildren<SpriteRenderer>();
|
|
|
|
|
|
+ // 初始化透明度为半透明(假设原本是0.5)
|
|
|
+ var color = effectInsSr.color;
|
|
|
+ color.a = initialTransparency;
|
|
|
+ effectInsSr.color = color;
|
|
|
//bool isAboutToAttack = umbrellaState == UmbrellaState.stay
|
|
|
// && allTime > 0
|
|
|
// && (stayTime - umbrePastTime) <= 1f;
|
|
|
@@ -271,21 +275,21 @@ public class BlackUmbrella : MonoBehaviour
|
|
|
bool isAboutToAttack = umbrellaState == UmbrellaState.stay
|
|
|
&& (umbrePastTime - stayTime)> 0;
|
|
|
|
|
|
- if (!IsTargetVisible(gameObject) && umbrellaState == UmbrellaState.stay && allTime > -1)
|
|
|
+ if (/*!IsTargetVisible(gameObject) && */umbrellaState == UmbrellaState.stay && allTime > -1)
|
|
|
{
|
|
|
if (isAboutToAttack)
|
|
|
{
|
|
|
// 剩余时间在0-1秒之间,计算透明度(0.5 -> 1.0)
|
|
|
float remainingTime = umbrePastTime - stayTime;
|
|
|
float alpha = Mathf.Lerp(initialTransparency, 1f , remainingTime * 1/ attentionyTime); // 时间越少透明度越高
|
|
|
- var color = effectInsSr.color;
|
|
|
+ color = effectInsSr.color;
|
|
|
color.a = alpha;
|
|
|
effectInsSr.color = color;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
// 非攻击状态保持半透明
|
|
|
- var color = effectInsSr.color;
|
|
|
+ color = effectInsSr.color;
|
|
|
if (color.a != initialTransparency)
|
|
|
{
|
|
|
color.a = initialTransparency;
|
|
|
@@ -293,29 +297,29 @@ public class BlackUmbrella : MonoBehaviour
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (gameObject.transform.position.x > pc.transform.position.x)
|
|
|
- {
|
|
|
- effectIns.transform.localPosition = new Vector3(rightX, 0, 16);
|
|
|
- Vector3 pos = effectIns.transform.position;
|
|
|
- pos.y = gameObject.transform.position.y;
|
|
|
- effectIns.transform.position = pos;
|
|
|
- effectIns.transform.localEulerAngles = new Vector3(0.8f, 0.1f, 1);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- effectIns.transform.localPosition = new Vector3(leftX, 0, 16);
|
|
|
- Vector3 pos = effectIns.transform.position;
|
|
|
- pos.y = gameObject.transform.position.y;
|
|
|
- effectIns.transform.position = pos;
|
|
|
- effectIns.transform.localEulerAngles = new Vector3(-0.8f, 0.1f, 1);
|
|
|
- }
|
|
|
+ //if (gameObject.transform.position.x > pc.transform.position.x)
|
|
|
+ //{
|
|
|
+ // effectIns.transform.localPosition = new Vector3(rightX, 0, 16);
|
|
|
+ // Vector3 pos = effectIns.transform.position;
|
|
|
+ // pos.y = gameObject.transform.position.y;
|
|
|
+ // effectIns.transform.position = pos;
|
|
|
+ // effectIns.transform.localEulerAngles = new Vector3(0.8f, 0.1f, 1);
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // effectIns.transform.localPosition = new Vector3(leftX, 0, 16);
|
|
|
+ // Vector3 pos = effectIns.transform.position;
|
|
|
+ // pos.y = gameObject.transform.position.y;
|
|
|
+ // effectIns.transform.position = pos;
|
|
|
+ //effectIns.transform.localEulerAngles = new Vector3(-0.8f, 0.1f, 1);
|
|
|
+ //}
|
|
|
effectIns.SetActive(true);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
effectIns.SetActive(false);
|
|
|
// 重置透明度为半透明,避免下次显示时状态错误
|
|
|
- var color = effectInsSr.color;
|
|
|
+ color = effectInsSr.color;
|
|
|
if (color.a != initialTransparency)
|
|
|
{
|
|
|
color.a = initialTransparency;
|