Esempio n. 1
0
        private void Start()
        {
            valueMonitorPool.Clear();
            base.Awake();
            var player1 = GameObject.Find("Player1");

            mainCollider = gameObject.GetChild("Collider").GetChild("BoxCollider").GetComponent <BoxCollider>();
            RoleBehaviorTree roleBehaviorTree = Owner.GetComponent <RoleBehaviorTree>();

            if (roleBehaviorTree != null)
            {
                Vector3 initvector3 = roleBehaviorTree.TargetController.transform.position;
                if (roleBehaviorTree.TargetController != null)
                {
                    InitPos(new Vector3(initvector3.x, transform.position.y, initvector3.z));
                }
                else
                {
                    InitPos(new Vector3(transform.position.x + (roleBehaviorTree.SelfController.GetDirectionInt() * 10), transform.position.y, transform.position.z));
                }

                behaviorTree = Owner.GetComponent <BehaviorDesigner.Runtime.BehaviorTree>();
                behaviorTree.SetVariableValue("hammerpos", transform.position);
                behaviorTree.SetVariableValue("hammer", gameObject);
            }
            //delayFunc(()=>
            //{
            //    MainAnimator.speed = 0f;
            //},0.4f);
            valueMonitorPool.AddMonitor <int>(() =>
            {
                if (roleBehaviorTree != null)
                {
                    if (roleBehaviorTree.TargetController != null)
                    {
                        Vector3 v3 = roleBehaviorTree.TargetController.transform.position;
                        return(v3.x - transform.position.x > 0 ? 1 : -1);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else
                {
                    return(0);
                }
            }, (int from, int to) =>
            {
                if (to != 0)
                {
                    MainDamageData.direction    = new Vector3(to, 0, 0);
                    MainDamageData.targetMoveBy = new Vector3(AngleIntensity.x * to, AngleIntensity.y, AngleIntensity.z).normalized *Intensity;
                }
            });
        }
Esempio n. 2
0
        public override void OnBegin()
        {
            roleBehaviorTree = GetComponent <RoleBehaviorTree>();
            if (roleBehaviorTree.enemys.Count <= 0)
            {
                return;
            }
            roleBehaviorTree.TargetController = roleBehaviorTree.enemys[0].GetComponent <RoleController>();

            ieEnumerator = roleBehaviorTree.MovePath(roleBehaviorTree.TargetController.transform.position,
                                                     roleBehaviorTree.TargetController.GetSpeedByMoveState(MoveState.Walk));
        }
Esempio n. 3
0
        public override void OnBegin()
        {
            roleBehaviorTree = GetComponent <RoleBehaviorTree>();

            waitIE = roleBehaviorTree.Wait(5);
        }
Esempio n. 4
0
 public override void OnBegin()
 {
     roleBehaviorTree = GetComponent <RoleBehaviorTree>();
     roleBehaviorTree.TargetController = roleBehaviorTree.enemys[0].GetComponent <RoleController>();
 }
Esempio n. 5
0
 public override void OnBegin()
 {
     roleBehaviorTree = GetComponent <RoleBehaviorTree>();
 }
Esempio n. 6
0
 private void Init()
 {
     selfRoleController = GetComponent <RoleController>();
     roleBehaviorTree   = GetComponent <RoleBehaviorTree>();
     roleNavMeshAgent   = GetComponent <RoleNavMeshAgent>();
 }