예제 #1
0
        /// <summary>
        /// </summary>
        public TownMove(GoalBase parent, int priority, Act5Town location)
            : base(parent, priority)
        {
            mArea     = AreaLevel.Harrogath;
            mLocation = (int)location;

            switch (location)
            {
            case Act5Town.Anya:
            case Act5Town.DeckardCain:
            case Act5Town.Larzuk:
            case Act5Town.Malah:
            case Act5Town.Nihlathak:
            case Act5Town.QualKehk:
                mUnitType = UnitType.NPC;
                break;

            case Act5Town.Stash:
            case Act5Town.Waypoint:
                mUnitType = UnitType.GameObject;
                break;

            default:
                mUnitType = UnitType.Invalid;
                break;
            }

            Update();
        }
예제 #2
0
        public static string StatusClass(this GoalBase goal)
        {
            var goalStatusClass = string.Empty;

            switch (goal.Status)
            {
            case GoalStatus.NotStarted:
                goalStatusClass = "goal-status-not-started";
                break;

            case GoalStatus.InProgressOnSchedule:
                goalStatusClass = "goal-status-on-schedule";
                break;

            case GoalStatus.InProgressDelayed:
                goalStatusClass = "goal-status-delayed";
                break;

            case GoalStatus.Completed:
                goalStatusClass = "goal-status-completed";
                break;

            case GoalStatus.Cancelled:
                goalStatusClass = "goal-status-cancelled";
                break;
            }

            return(goalStatusClass);
        }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     goalBase   = GameObject.FindGameObjectWithTag("GameEngine").GetComponent <GoalBase>();
     balleRouge = GameObject.FindGameObjectWithTag("TennisRouge");
     balleBleu  = GameObject.FindGameObjectWithTag("TennisBleu");
     init();
 }
예제 #4
0
    void DetermineGoal()
    {
        GoalBase   bestGoal   = null;
        ActionBase bestAction = null;

        // find the highest priority goal that can run
        foreach (var goal in Goals)
        {
            // can't run - do nothing
            if (!goal.CanRun())
            {
                continue;
            }

            // pick the best goal
            if ((bestGoal == null) || (goal.Priority > bestGoal.Priority))
            {
                bestAction = null;

                // find a matching action
                foreach (var action in Actions)
                {
                    if (action.CanSatisfy.Contains(goal.UniqueID))
                    {
                        bestAction = action;
                        break;
                    }
                }

                if (bestAction != null)
                {
                    bestGoal = goal;
                }
            }
        }

        if (bestGoal == null)
        {
            Debug.LogError("[GOAP] Failed to find new best goal for " + gameObject.name);
            return;
        }

        // is this a new best goal
        if (ActiveGoal != bestGoal)
        {
            if (ActiveGoal != null)
            {
                ActiveGoal.GoToSleep();
            }

            ActiveGoal = bestGoal;
            ActiveGoal.ChangeAction(bestAction);

            bestGoal.WakeUp();
        }
        else if (bestAction != bestGoal.ActiveAction)
        {
            // could switch if better goal
        }
    }
예제 #5
0
 /// <summary>
 /// </summary>
 public InteractWaypoint(GoalBase Parent, int Priority, AreaLevel source, AreaLevel destination, bool teleport)
     : base(Parent, Priority)
 {
     mDestination = destination;
     mSource      = source;
     mTeleport    = teleport;
 }
예제 #6
0
        /// <summary>
        /// </summary>
        public TownMove(GoalBase parent, int priority, Act3Town location)
            : base(parent, priority)
        {
            mArea     = AreaLevel.KurastDocks;
            mLocation = (int)location;

            switch (location)
            {
            case Act3Town.Alkor:
            case Act3Town.Asheara:
            case Act3Town.DeckardCain:
            case Act3Town.Hratli:
            case Act3Town.Meshif:
            case Act3Town.Natalya:
            case Act3Town.Ormus:
                mUnitType = UnitType.NPC;
                break;

            case Act3Town.Stash:
            case Act3Town.Waypoint:
                mUnitType = UnitType.GameObject;
                break;

            default:
                mUnitType = UnitType.Invalid;
                break;
            }

            Update();
        }
예제 #7
0
        /// <summary>
        /// </summary>
        public TownMove(GoalBase parent, int priority, Act4Town location)
            : base(parent, priority)
        {
            mArea     = AreaLevel.ThePandemoniumFortress;
            mLocation = (int)location;

            switch (location)
            {
            case Act4Town.DeckardCain:
            case Act4Town.Halbu:
            case Act4Town.Jamella:
            case Act4Town.Tyrael:
                mUnitType = UnitType.NPC;
                break;

            case Act4Town.Stash:
            case Act4Town.Waypoint:
                mUnitType = UnitType.GameObject;
                break;

            default:
                mUnitType = UnitType.Invalid;
                break;
            }

            Update();
        }
예제 #8
0
        /// <summary>
        /// </summary>
        public TownMove(GoalBase parent, int priority, Act2Town location)
            : base(parent, priority)
        {
            mArea     = AreaLevel.LutGholein;
            mLocation = (int)location;

            switch (location)
            {
            case Act2Town.Atma:
            case Act2Town.DeckardCain:
            case Act2Town.Drognan:
            case Act2Town.Elzix:
            case Act2Town.Fara:
            case Act2Town.Geglash:
            case Act2Town.Greiz:
            case Act2Town.Jerhyn:
            case Act2Town.Kaelan:
            case Act2Town.Lysander:
            case Act2Town.Meshif:
            case Act2Town.Warriv:
                mUnitType = UnitType.NPC;
                break;

            case Act2Town.Stash:
            case Act2Town.Waypoint:
                mUnitType = UnitType.GameObject;
                break;

            default:
                mUnitType = UnitType.Invalid;
                break;
            }

            Update();
        }
예제 #9
0
        /// <summary>
        /// </summary>
        public TownMove(GoalBase parent, int priority, Act1Town location)
            : base(parent, priority)
        {
            mArea     = AreaLevel.RogueEncampment;
            mLocation = (int)location;

            switch (location)
            {
            case Act1Town.Akara:
            case Act1Town.Charsi:
            case Act1Town.DeckardCain:
            case Act1Town.Gheed:
            case Act1Town.Kashya:
            case Act1Town.Warriv:
                mUnitType = UnitType.NPC;
                break;

            case Act1Town.Stash:
            case Act1Town.Waypoint:
                mUnitType = UnitType.GameObject;
                break;

            default:
                mUnitType = UnitType.Invalid;
                break;
            }

            Update();
        }
예제 #10
0
 public void AttackTarget(ActorController target, int skillIndex, bool focusTarget = true)
 {
     if (this.curGoal != null)
     {
         this.curGoal.OnInterrupt();
         this.curGoal = null;
     }
     if (this.attackTargetGoal == null)
     {
         this.attackTargetGoal = new GoalAttackTarget(this.actorCtrler);
     }
     if (!this.attackTargetGoal.SetAttackTarget(target, skillIndex, focusTarget))
     {
         this.curGoal = this.attackTargetGoal;
     }
 }
예제 #11
0
 /// <summary>
 /// </summary>
 public MoveToPoint(GoalBase Parent, int Priority, Point destination, bool teleport)
     : base(Parent, Priority)
 {
     mDestination = destination;
     mTeleport    = teleport;
 }
예제 #12
0
 /// <summary>
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="priority"></param>
 public OpenWaypointMenu(GoalBase parent, int priority)
     : base(parent, priority)
 {
 }
예제 #13
0
 /// <summary>
 /// </summary>
 public InteractWaypoint(GoalBase Parent, int Priority, AreaLevel destination, bool teleport)
     : this(Parent, Priority, AreaLevel.None, destination, teleport)
 {
 }
예제 #14
0
 /// <summary>
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="priority"></param>
 /// <param name="destination"></param>
 public SelectDestination(GoalBase parent, int priority, AreaLevel destination)
     : base(parent, priority)
 {
     mDestination = destination;
 }
예제 #15
0
 /// <summary>
 /// </summary>
 public MoveToWaypoint(GoalBase parent, int priority, bool teleport)
     : this(parent, priority, AreaLevel.None, teleport)
 {
 }
예제 #16
0
 public void SetControlLocked(bool locked)
 {
     if (locked)
     {
         if (this.curGoal != null)
         {
             this.curGoal.OnInterrupt();
             this.curGoal = null;
         }
         this.touchDownEffect.SetActive(false);
         this.touchMoveEffect.SetActive(false);
     }
     this.Locked = locked;
 }
예제 #17
0
 private void MoveJoystick(Vector3 inputPosition)
 {
     if (!this.touchMove)
     {
         return;
     }
     Vector3 vector = inputPosition - this.touchBeginPosition;
     float num = (!GameUIManager.mInstance) ? 960f : 720f;
     float num2 = (float)Screen.width / num;
     if (vector.magnitude >= 60f * num2)
     {
         this.touchBeginPosition = inputPosition - vector.normalized * 60f * num2;
         this.joystick.SetDPadInitDirection(this.touchBeginPosition);
     }
     this.joystick.SetDPadDirection(inputPosition);
     this.actorCtrler.AiCtrler.Locked = true;
     if (this.actorCtrler.CanMove(true, false))
     {
         if (this.curGoal != null)
         {
             this.curGoal.OnInterrupt();
             this.curGoal = null;
         }
         Vector3 vector2 = new Vector3(vector.x, 0f, vector.y);
         Vector3 targetPos = base.transform.position - vector2.normalized * 2f;
         this.actorCtrler.InterruptSkill(0);
         this.actorCtrler.AnimationCtrler.StopAnimation();
         this.actorCtrler.StartMove(targetPos);
     }
 }
예제 #18
0
 private void LateUpdate()
 {
     if (this.Locked)
     {
         return;
     }
     if (!this.actorCtrler.IsDead)
     {
         this.InputProcess();
     }
     if (this.curGoal != null && this.curGoal.Update(Time.deltaTime))
     {
         this.curGoal = null;
     }
     this.UpdateTargetDirection();
 }
예제 #19
0
 /// <summary>
 /// </summary>
 public MoveToWaypoint(GoalBase parent, int priority, AreaLevel area, bool teleport)
     : base(parent, priority)
 {
     mArea     = area;
     mTeleport = teleport;
 }
예제 #20
0
 public void MoveToPosition(Vector3 targetPos)
 {
     if (this.curGoal != null)
     {
         this.curGoal.OnInterrupt();
         this.curGoal = null;
     }
     if (this.mvoe2PosGoal == null)
     {
         this.mvoe2PosGoal = new GoalMoveToPosition(this.actorCtrler, this);
     }
     if (!this.mvoe2PosGoal.SetTargetPosition(targetPos, 0.2f))
     {
         this.curGoal = this.mvoe2PosGoal;
     }
 }