private void OnHp() { float hp = (float)Enity.GetProperty("hp"); float maxHp = (float)Enity.GetProperty("maxHp"); _uilifeBar.SetBarLength(hp, maxHp); }
private void OnActionStateEnd() { AnimatorStateInfo state = (AnimatorStateInfo)Enity.GetProperty("actinStateEnd"); if (state.shortNameHash == AnimatorManager.atk01Hash) { } }
private void OnTitle() { Transform _t = Enity.GetProperty("title") as Transform; SpriteRenderer sr = _t.GetComponent <SpriteRenderer>(); string titleName = Enity.GetProperty("titleName").ToString(); sr.sprite = Resources.Load(titleName, typeof(Sprite)) as Sprite; }
private void LoadLifeBar() { GameObject _go = ResourceManager.Instance.LoadNewPrefab("UILifeBar2", UIMgr.Instance.GetLayer(UIMgr.Layer.layer2)); _go.name = "UILifeBar_" + Enity.GetProperty("name"); barTransfrom = _go.transform as RectTransform; _uilifeBar = barTransfrom.GetComponent <UILifeBar2>(); if (_uilifeBar == null) { _uilifeBar = barTransfrom.gameObject.AddComponent <UILifeBar2>(); } _uilifeBar._camera = Enity.GetProperty("camera") as Camera; _uilifeBar._actor = Enity.Transform; }
/// <summary> /// 测试放在这里 添加,将来可以 以 component 形式添加 /// </summary> /// <returns></returns> private GameObject LoadModel() { GameObject root = new GameObject(_myEnity.GetProperty("name").ToString()); GameObject go = GameObject.Instantiate(Resources.Load("HeroModel/Hero/A_JS_PuTong_A_001")) as GameObject; go.transform.SetParent(root.transform); CapsuleCollider collider = root.AddComponent <CapsuleCollider>(); collider.height = 2; collider.center = new Vector3(0, 1, 0); //Rigidbody rigidbody = root.AddComponent<Rigidbody>(); //rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezePositionY; return(root); }
private void OnDoAction() { if (_isLock) { } else { string actionName = Enity.GetProperty("actionName").ToString(); _animator.Play(actionName); } //if (AnimatorManager.Instance.IsSameCurrentAction(actionName)) return; /*return; * if (actionName == "attack01") * { * Animator.SetBool("isAttack", true); * }else * { * Animator.Play(actionName); * }*/ }
private void OnActionNormalizedTime() { string actionTime = Enity.GetProperty("normalizedTime").ToString(); if (actionTime == "effectNode") { Enity target = (Enity)Enity.GetProperty("patrolTarget"); Animator animator = (Animator)target.GetProperty("animator"); animator.Play("hit01", 0, 0); } else if (actionTime == "beAtkNode") { /*List<Enity> _listEnemy = Enity.GetProperty("enemy") as List<Enity>; * if (_listEnemy != null) * { * for (int i = 0; i < _listEnemy.Count; i++) * { * _listEnemy[i].SetProperty("actionName", "beAtk"); * } * }*/ } }
bool isPlayBack = false;//是否重播 true: 重播 private void OnMoveSpeed() { float speed = (float)(Enity.GetProperty("moveSpeed")); Animator.SetFloat("MoveSpeed", speed); }
private void OnIsLock() { _isLock = (bool)Enity.GetProperty("isLock"); }
private void OnPatrol() { _target = Enity.GetProperty("patrolTarget") as Enity; }
private void OnActionStateEnd() { AnimatorStateInfo state = (AnimatorStateInfo)Enity.GetProperty("actinStateEnd"); Debug.Log("------2 action state end " + AnimatorManager.Instance.HashToString(state.shortNameHash)); }
private void OnDialog() { int dialogId = (int)Enity.GetProperty("dialogId"); }
private void OnRoration() { Vector3 _v3 = (Vector3)Enity.GetProperty("rotation"); Model.localRotation = Quaternion.LookRotation(_v3); }
private void OnPosition() { Vector3 _v3 = (Vector3)Enity.GetProperty("position"); Enity.Transform.Translate(_v3); }
private void OnScale() { Enity.Transform.localScale = (Vector3)Enity.GetProperty("scale"); }