Ejemplo n.º 1
0
        public void OnMoveToTarget(object sender, GameEventArgs e)
        {
            GameObject            gb     = GameEntry.Entity.GetEntity(Id).Handle as GameObject;
            MoveToTargetEventArgs mvArgs = e as MoveToTargetEventArgs;
            //start move new position
            MoveTarget ctl = GetComponentInParent <MoveTarget>();

            ctl.Move(gb.transform.position, mvArgs.MovePos);
            //start move state
            Animator animator = GetComponentInParent <Animator>();

            animator.SetBool("Move", true);
        }
Ejemplo n.º 2
0
        public void RefreshEnemy(GameObject target, GameObject dest, Vector3 pos)
        {
            if (target && dest)
            {
                trans          = dest.transform;
                trans.position = new Vector3(
                    UnityEngine.Random.Range(pos.x - 5, pos.x + 5),
                    pos.y,
                    UnityEngine.Random.Range(pos.z - 5, pos.z + 5));

                MoveTarget ctl = target.GetComponent <MoveTarget>();
                if (ctl)
                {
                    ctl.SetTarget(trans.position);
                }
            }
        }