コード例 #1
0
    public override bool Continue()
    {
        if (!CanContinue())
        {
            theEntity.SetInvestigatePosition(Vector3.zero, 0);
            return(false);
        }
        PathNavigate navigator = theEntity.navigator;
        PathEntity   path      = navigator.getPath();

        if (hadPath && path == null)
        {
            return(false);
        }

        if (++investigateTicks > 40)
        {
            investigateTicks = 0;
            return(false);
        }

        //float sqrMagnitude2 = (seekPos - theEntity.position).sqrMagnitude;
        //if(sqrMagnitude2 <= 4f || (path != null && path.isFinished()))
        //{
        //    return PerformAction();
        //}
        return(true);
    }
コード例 #2
0
    public override bool Continue()
    {
        DisplayLog("CanContinue()");
        bool result = false;

        if (entityAliveSDX)
        {
            result = entityAliveSDX.CanExecuteTask(EntityAliveSDX.Orders.Loot);
            DisplayLog("CanContinue() Loot Task? " + result);
            if (result == false)
            {
                return(false);
            }
        }

        PathNavigate navigator = this.theEntity.navigator;
        PathEntity   path      = navigator.getPath();

        if (this.hadPath && path == null)
        {
            DisplayLog(" Not Path to continue looting.");
            return(false);
        }
        if (++this.investigateTicks > 40)
        {
            this.investigateTicks = 0;
            if (!this.theEntity.HasInvestigatePosition)
            {
                result = FindNearestContainer();
            }

            //float sqrMagnitude = (this.investigatePos - this.theEntity.InvestigatePosition).sqrMagnitude;
            //if (sqrMagnitude > 4f)
            //{
            //    DisplayLog(" Too far away from my investigate Position: " + sqrMagnitude);
            //    return false;
            //}
        }

        float sqrMagnitude2 = (this.seekPos - this.theEntity.position).sqrMagnitude;

        DisplayLog(" Seek Position: " + this.seekPos + " My Location: " + this.theEntity.position + " Magnitude: " + sqrMagnitude2);
        if (sqrMagnitude2 < 4f)
        {
            DisplayLog("I'm at the loot container: " + sqrMagnitude2);
            CheckContainer();
            result = FindNearestContainer();
        }
        else if (path != null && path.isFinished())
        {
            result = FindNearestContainer();
        }

        DisplayLog(" Blocked Time: " + this.theEntity.getMoveHelper().BlockedTime);
        if (this.theEntity.getMoveHelper().BlockedTime > 2)
        {
        }
        DisplayLog("Continue() End: " + result);
        return(result);
    }
コード例 #3
0
 public EntityAIFollowOwner(EntityTameable par1EntityTameable, float par2, float par3, float par4)
 {
     ThePet        = par1EntityTameable;
     TheWorld      = par1EntityTameable.WorldObj;
     Field_48303_f = par2;
     PetPathfinder = par1EntityTameable.GetNavigator();
     MinDist       = par3;
     MaxDist       = par4;
     SetMutexBits(3);
 }
コード例 #4
0
    public override bool Continue()
    {
        if (!CanContinue())
        {
            this.theEntity.SetInvestigatePosition(Vector3.zero, 0);
            return(false);
        }
        PathNavigate navigator = this.theEntity.navigator;
        PathEntity   path      = navigator.getPath();

        if (this.hadPath && path == null)
        {
            return(false);
        }

        if (++this.investigateTicks > 40)
        {
            this.investigateTicks = 0;
            return(false);
            //if (!this.theEntity.HasInvestigatePosition)
            //    return false; // no invesitgative position

            //float sqrMagnitude = (this.investigatePos - this.theEntity.InvestigatePosition).sqrMagnitude;
            //if (sqrMagnitude >= 4f)
            //{
            //    return false; // not close enough.
            //}
        }

        float sqrMagnitude2 = (this.seekPos - this.theEntity.position).sqrMagnitude;

        if (sqrMagnitude2 <= 4f || (path != null && path.isFinished()))
        {
            return(PerformAction());
        }
        return(true);
    }
コード例 #5
0
    public override bool Continue()
    {
        DisplayLog("CanContinue()");
        bool result = false;

        if (entityAliveSDX)
        {
            result = EntityUtilities.CanExecuteTask(this.theEntity.entityId, EntityUtilities.Orders.Loot);
            DisplayLog("CanContinue() Loot Task? " + result);
            if (result == false)
            {
                return(false);
            }
        }

        if (++this.taskTimeOut > 40)
        {
            this.taskTimeOut = 0;
            return(false);
        }
        if (this.theEntity.Buffs.HasCustomVar("Owner"))
        {
            DisplayLog(" Checking my Leader");
            // Find out who the leader is.
            int    PlayerID = (int)this.theEntity.Buffs.GetCustomVar("Owner");
            Entity myLeader = this.theEntity.world.GetEntity(PlayerID);
            float  distance = this.theEntity.GetDistance(myLeader);
            DisplayLog(" Distance: " + distance);
            if (distance > this.theEntity.GetSeeDistance())
            {
                DisplayLog("I am too far away from my leader. Teleporting....");
                this.theEntity.SetPosition(myLeader.position, true);
                EntityUtilities.ExecuteCMD(this.theEntity.entityId, "FollowMe", myLeader as EntityPlayer);
            }
        }

        PathNavigate navigator = this.theEntity.navigator;
        PathEntity   path      = navigator.getPath();

        if (this.hadPath && path == null)
        {
            DisplayLog(" Not Path to continue looting.");
            return(false);
        }
        if (++this.investigateTicks > 40)
        {
            this.investigateTicks = 0;
            if (!this.theEntity.HasInvestigatePosition)
            {
                result = FindNearestContainer();
            }

            //float sqrMagnitude = (this.investigatePos - this.theEntity.InvestigatePosition).sqrMagnitude;
            //if (sqrMagnitude > 4f)
            //{
            //    DisplayLog(" Too far away from my investigate Position: " + sqrMagnitude);
            //    return false;
            //}
        }

        float sqrMagnitude2 = (this.seekPos - this.theEntity.position).sqrMagnitude;

        DisplayLog(" Seek Position: " + this.seekPos + " My Location: " + this.theEntity.position + " Magnitude: " + sqrMagnitude2);
        if (sqrMagnitude2 < 4f)
        {
            DisplayLog("I'm at the loot container: " + sqrMagnitude2);
            CheckContainer();
            result = FindNearestContainer();
        }
        else if (path != null && path.isFinished())
        {
            result = FindNearestContainer();
        }

        DisplayLog("Continue() End: " + result);
        return(result);
    }