Exemple #1
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();
        }
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        /*AnimatorClipInfo[] _arrClipInfos = animator.GetCurrentAnimatorClipInfo(layerIndex);
        AnimatorClipInfo c = _arrClipInfos[0];
        slipName = c.clip.name;*/
        //Debug.Log("animator.name : " + animator.name + "   c.clip.name  " + c.clip.name + "   stateInfo.length :" + stateInfo.length +  "  nameHash " + (Animator.StringToHash(c.clip.name) == stateInfo.shortNameHash));
        //if (stateInfo.length > 0)
        //{
        /*AnimationClip _clip = new AnimationClip();
        AnimationEvent _event = new AnimationEvent();
        _event.functionName = "OnClipEvent";
        _event.intParameter = 1;
        _event.time = 0.6f;
        _clip.AddEvent(_event);*/

        /*MyStateMachineBehaviour  myState = animator.GetBehaviour<MyStateMachineBehaviour>();
        Debug.Log("-----------------------" + myState._name);*/
        //}
        _enity = animator.transform.GetComponentInParent<EnityBind>().Owner;
        _enityData = _enity.GetProperty("enityData") as EnityData;
        _enity.SetProperty("onStateEnter",stateInfo);
        DataEventSource.Instance.DispatcherEvent("onStateEnter", stateInfo);
        _isEnd = false;
        _isLock = AnimatorManager.Instance.IsLock(stateInfo.shortNameHash);
        if (_isLock)
        {
            IsLock = _isLock;
        }
        GameInput.Log(" state enter >>>>>>>>>>>>>>>>>>>>>>>>>  " + AnimatorManager.Instance.HashToString(stateInfo.shortNameHash));
    }
Exemple #3
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();
        }
 public override void OnStateEnter(UnityEngine.Animator animator, UnityEngine.AnimatorStateInfo stateInfo, int layerIndex)
 {
     //DataEventSource.Instance.DispatcherEvent("onStateEnter", stateInfo);
     _enity = animator.transform.GetComponentInParent<EnityBind>().Owner;
     _enityData = _enity.GetProperty("enityData") as EnityData;
     _isEnd = false;
     _isLock = AnimatorManager.Instance.IsLock(stateInfo.shortNameHash);
     if (_isLock)
     {
         IsLock = _isLock;
     }
 }
Exemple #5
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;
        }
Exemple #6
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;
        }