コード例 #1
0
        internal override void OnTimerTick()
        {
            if (SpeechTimer <= 0)
            {
                if (GetBotData() != null)
                {
                    if (GetBotData().RandomSpeech.Count > 0)
                    {
                        RandomSpeech Speech = GetBotData().GetRandomSpeech();
                        GetRoomUser().Chat(null, Speech.Message, Speech.Shout);
                    }
                }

                SpeechTimer = PiciEnvironment.GetRandomNumber(0, 150);
            }
            else
            {
                SpeechTimer--;
            }

            if (ActionTimer <= 0)
            {
                Point nextCoord = GetRoom().GetGameMap().getRandomWalkableSquare();
                //int randomX = PiciEnvironment.GetRandomNumber(0, GetRoom().Model.MapSizeX);
                //int randomY = PiciEnvironment.GetRandomNumber(0, GetRoom().Model.MapSizeY);

                GetRoomUser().MoveTo(nextCoord.X, nextCoord.Y);

                ActionTimer = PiciEnvironment.GetRandomNumber(0, 30);
            }
            else
            {
                ActionTimer--;
            }
        }
コード例 #2
0
        internal override void OnTimerTick()
        {
            if (GetBotData() == null)
            {
                return;
            }
            if (SpeechTimer <= 0)
            {
                if (GetBotData().RandomSpeech.Count > 0)
                {
                    RandomSpeech Speech = GetBotData().GetRandomSpeech();
                    GetRoomUser().Chat(null, Speech.Message, Speech.Shout);
                }

                SpeechTimer = PiciEnvironment.GetRandomNumber(10, 300);
            }
            else
            {
                SpeechTimer--;
            }

            if (ActionTimer <= 0)
            {
                switch (GetBotData().WalkingMode.ToLower())
                {
                default:
                case "stand":

                    // (8) Why is my life so boring?

                    break;

                case "freeroam":
                    Point nextCoord = GetRoom().GetGameMap().getRandomWalkableSquare();
                    GetRoomUser().MoveTo(nextCoord.X, nextCoord.Y);

                    break;

                case "specified_range":
                    Point nextCoord2 = GetRoom().GetGameMap().getRandomWalkableSquare();
                    GetRoomUser().MoveTo(nextCoord2.X, nextCoord2.Y);

                    break;
                }

                ActionTimer = PiciEnvironment.GetRandomNumber(1, 30);
            }
            else
            {
                ActionTimer--;
            }
        }