コード例 #1
0
        /**
         * <summary>Creates a new instance of the 'Character: Face direction' Action, set to command an NPC to stop following anyone</summary>
         * <param name = "npcToMove">The NPC to stop following anyone</param>
         * <returns>The generated Action</returns>
         */
        public static ActionCharFollow CreateNew_Stop(NPC npcToMove)
        {
            ActionCharFollow newAction = (ActionCharFollow)CreateInstance <ActionCharFollow>();

            newAction.followType = FollowType.StopFollowing;
            newAction.npcToMove  = npcToMove;
            return(newAction);
        }
コード例 #2
0
        /**
         * <summary>Creates a new instance of the 'Character: NPC follow' Action, set to command an NPC to follow a character</summary>
         * <param name = "npcToMove>The NPC to affect</param>
         * <param name = "characterToFollow">The character the NPC should follow</param>
         * <param name = "minimumDistance">The minimum distance the NPC should be from the NPC</param>
         * <param name = "maximumDistance">The maximum distance the NPC should be from the NPC</param>
         * <param name = "updateFrequency">How often the NPC should move towards the character they're following</param>
         * <param name = "randomisePosition">If True, then the NPC will move to some random point around the character they're following</param>
         * <param name = "faceCharacterWhenIdle">If True, then the NPC will face the character they're following whenever idle</param>
         * <returns>The generated Action</returns>
         */
        public static ActionCharFollow CreateNew_Start(NPC npcToMove, AC.Char characterToFollow, float minimumDistance, float maximumDistance, float updateFrequency = 2f, bool randomisePosition = false, bool faceCharacterWhenIdle = false)
        {
            ActionCharFollow newAction = (ActionCharFollow)CreateInstance <ActionCharFollow>();

            newAction.followType        = FollowType.StartFollowing;
            newAction.npcToMove         = npcToMove;
            newAction.charToFollow      = characterToFollow;
            newAction.followDistance    = minimumDistance;
            newAction.followDistanceMax = maximumDistance;
            newAction.updateFrequency   = updateFrequency;
            newAction.randomDirection   = randomisePosition;
            newAction.faceWhenIdle      = faceCharacterWhenIdle;
            return(newAction);
        }