示例#1
0
        private void OnHp()
        {
            float hp    = (float)Enity.GetProperty("hp");
            float maxHp = (float)Enity.GetProperty("maxHp");

            _uilifeBar.SetBarLength(hp, maxHp);
        }
示例#2
0
        public void Init()
        {
            _myEnity = new Enity();
            _myEnity.AddProperty("name", "hero");
            _myEnity.Go = LoadModel();
            _animator   = _myEnity.Go.GetComponentInChildren <Animator>();
            _myEnity.AddComponent("display", new DisplayComponent());
            _myEnity.AddComponent("actionComponent", new ActionComponent());
            _myEnity.AddComponent("transformComponent", new TransformComponent());
            _myEnity.AddComponent("titleComponent", new TitleComponent());
            //_myEnity.AddComponent("mouseInteractiveComponent", new MouseInteractiveComponent());
            _myEnity.AddComponent("lifeBarComponent", new LifeBarComponent());

            /*PatrolComponent patrolComponent = new PatrolComponent();
             * _myEnity.AddComponent("patrolComponent", patrolComponent);*/
            EnityData _enityData = new EnityData();

            _myEnity.AddProperty("enityData", _enityData);
            _myEnity.Transform.gameObject.AddComponent <EnityBind>().Owner = _myEnity;

            //GameInput.Instance.OnUpdate += patrolComponent.Update;

            //test
            LifeBarComponent life = _myEnity.AddComponent <LifeBarComponent>();

            life.key = "test add";
            GetCamera();
        }
示例#3
0
        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;
        }
示例#4
0
        private void OnActionStateEnd()
        {
            AnimatorStateInfo state = (AnimatorStateInfo)Enity.GetProperty("actinStateEnd");

            if (state.shortNameHash == AnimatorManager.atk01Hash)
            {
            }
        }
示例#5
0
        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;
        }
示例#6
0
 public override void Update()
 {
     if (_target != null && _isLock == false)
     {
         float distance = Vector3.Distance(Enity.Transform.position, _target.Transform.position);
         if (distance < 10)
         {
             Enity.SetProperty("actionName", "run01");
             Enity.Transform.LookAt(_target.Transform);
             Enity.Transform.Translate(Vector3.forward * Time.deltaTime * 1);
             if (distance < 1.0f)
             {
                 Enity.SetProperty("actionName", "attack01");
             }
         }
     }
 }
示例#7
0
        private void Init()
        {
            _myEnity = new Enity();
            _myEnity.SetProperty("name", "enemy");
            _myEnity.Go = LoadModel();
            _myEnity.AddComponent("display", new DisplayComponent());
            _myEnity.AddComponent("actionComponent", new ActionComponent());
            _myEnity.AddComponent("transformComponent", new TransformComponent());
            _myEnity.AddComponent("lifeBarComponent", new LifeBarComponent());

            PatrolComponent patrolComponent = new PatrolComponent();

            _myEnity.AddComponent("patrolComponent", patrolComponent);

            EnityData _enityData = new EnityData();

            _myEnity.AddProperty("enityData", _enityData);
            _myEnity.Transform.gameObject.AddComponent <EnityBind>().Owner = _myEnity;

            GameInput.Instance.OnUpdate += patrolComponent.Update;
        }
示例#8
0
        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);
             * }*/
        }
示例#9
0
        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");
                 *  }
                 * }*/
            }
        }
示例#10
0
 public virtual void RemoveEvent()
 {
     _enity = null;
 }
示例#11
0
        bool isPlayBack = false;//是否重播  true: 重播

        private void OnMoveSpeed()
        {
            float speed = (float)(Enity.GetProperty("moveSpeed"));

            Animator.SetFloat("MoveSpeed", speed);
        }
示例#12
0
 private void OnIsLock()
 {
     _isLock = (bool)Enity.GetProperty("isLock");
 }
示例#13
0
 private void OnPatrol()
 {
     _target = Enity.GetProperty("patrolTarget") as Enity;
 }
示例#14
0
        private void OnActionStateEnd()
        {
            AnimatorStateInfo state = (AnimatorStateInfo)Enity.GetProperty("actinStateEnd");

            Debug.Log("------2 action state end " + AnimatorManager.Instance.HashToString(state.shortNameHash));
        }
示例#15
0
 private void OnDialog()
 {
     int dialogId = (int)Enity.GetProperty("dialogId");
 }
示例#16
0
        private void OnRoration()
        {
            Vector3 _v3 = (Vector3)Enity.GetProperty("rotation");

            Model.localRotation = Quaternion.LookRotation(_v3);
        }
示例#17
0
        private void OnPosition()
        {
            Vector3 _v3 = (Vector3)Enity.GetProperty("position");

            Enity.Transform.Translate(_v3);
        }
示例#18
0
 private void OnScale()
 {
     Enity.Transform.localScale = (Vector3)Enity.GetProperty("scale");
 }