Beispiel #1
0
        // ******************** //

        public AI_StateFollowCharacter(Character me, Character leader, AI_StateMachine machine)
        {
            this.me     = me;
            this.leader = leader;
            Farmer f = leader as Farmer;

            if (f != null)
            {
                leaderIsFarmer = true;
            }
            this.machine = machine;

            aStar = new aStar(me.currentLocation, me, leader);

            followThreshold     = 2.25f * fullTile;
            decelerateThreshold = 1.75f * fullTile;
            deceleration        = 0.075f;
            pathNodeTolerance   = 5f;
            monsterAggroRadius  = 8f * fullTile;

            characterMoveUp    = typeof(Character).GetField("moveUp", BindingFlags.NonPublic | BindingFlags.Instance);
            characterMoveDown  = typeof(Character).GetField("moveDown", BindingFlags.NonPublic | BindingFlags.Instance);
            characterMoveLeft  = typeof(Character).GetField("moveLeft", BindingFlags.NonPublic | BindingFlags.Instance);
            characterMoveRight = typeof(Character).GetField("moveRight", BindingFlags.NonPublic | BindingFlags.Instance);
        }
        // ******************** //

        public AI_StateFollowCharacter(Character me, Character leader, AI_StateMachine machine)
        {
            this.me     = me;
            this.leader = leader;
            Farmer f = leader as Farmer;

            if (f != null)
            {
                leaderIsFarmer = true;
            }
            this.machine = machine;
            r            = new Random((int)Game1.uniqueIDForThisGame + (int)Game1.stats.DaysPlayed + Game1.timeOfDay);

            aStar = new aStar(me.currentLocation, me, leader);

            deceleration       = 0.025f;
            pathNodeTolerance  = 3f;
            monsterAggroRadius = 8f * fullTile;

            characterMoveUp    = typeof(Character).GetField("moveUp", BindingFlags.NonPublic | BindingFlags.Instance);
            characterMoveDown  = typeof(Character).GetField("moveDown", BindingFlags.NonPublic | BindingFlags.Instance);
            characterMoveLeft  = typeof(Character).GetField("moveLeft", BindingFlags.NonPublic | BindingFlags.Instance);
            characterMoveRight = typeof(Character).GetField("moveRight", BindingFlags.NonPublic | BindingFlags.Instance);
        }