123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityGameFramework.Runtime;
- /// <summary>
- /// 场景组件 地刺
- /// </summary>
- public class SceneEventSunkensLogic : MonoBehaviour
- {
- public int hurtHP = 0;
- public float hurtTime = 2;
- private float nowTime = 0;
- private float animTime = 1;
- private bool isHurt = false;
- private Animator anim;
- private Role player;
- private void Awake()
- {
- anim = this.GetComponent<Animator>();
- }
- // Start is called before the first frame update
- void Start()
- {
- SceneCmptManager.Instance.AddMechanism(this.gameObject);
- SceneEventSunkens info = this.gameObject.GetComponent<SceneEventSunkens>();
- this.hurtHP = info.hurtHP;
- this.hurtTime = info.hurtTime;
- }
- private void Update()
- {
- nowTime += Time.deltaTime;
- if (nowTime > hurtTime)
- {
- nowTime -= hurtTime;
- Animator anim = this.GetComponent<Animator>();
- anim.Play("running2", 0, 0);
- }
- }
- public void Hurt()
- {
- if (!player || player.isDie || !player.IsTeamLeader)
- {
- return;
- }
- X2Battle.X2BattleManager.Instance.mBulletModel.OnCastSkill(
- 0, "702002",
- false, X2Battle.EBulletCastPoint.ECAST_POINT_DEFLUAT, player.mData.UID, false);
- }
- public void CloseHurt()
- {
- isHurt = false;
- }
- public void OnTriggerEnter(Collider collider)
- {
- Role role = collider.GetComponent<Role>();
- if (role != null && role.IsTeamLeader)
- {
- player = collider.GetComponent<Role>();
- SceneCmptManager.Instance.OpenMechanism(this.gameObject);
- }
- }
- public void OnTriggerStay(Collider other)
- {
- }
- public void OnTriggerExit(Collider collider)
- {
- Role role = collider.GetComponent<Role>();
- if (role != null && role.IsTeamLeader)
- {
- player = null;
- }
- }
- public void EnableCollider()
- {
- }
- public void OnClickInteractive()
- {
- }
- }
|