123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using Random = UnityEngine.Random;
- public class RobotManager : Regist
- {
- #region Config
- public static List<Robot> Robots = new List<Robot>();
- #endregion
- public static void AddRobot(int currentRobotAmt, long robotConfigID, bool randomPos, string nickname, List<string> dressdatas)
- {
- Robot.Init();
- int sfsRoomID = SFSManager.GardenSmartFox.PlazaRoomController.CurrentPlazaRoom.Id;
- int maxPlayer = SFSManager.GardenSmartFox.PlazaRoomController.CurrentRoomData.MaxPlayer;
- int maxRobot = (int) Auxiliary.FmlParse(Robot.MaxRobotAmtFml, "p", maxPlayer.ToString());
- //Debug.Log(currentRobotAmt + " " + maxRobot);
- if (currentRobotAmt < maxRobot)
- {
- Robot robot = new Robot(robotConfigID, randomPos, nickname, dressdatas);
- robot.Connect(sfsRoomID, maxRobot);
- Robots.Add(robot);
- }
- }
- public static void DeactivateAllRobots(bool delay)
- {
- for (int i = 0; i < Robots.Count; i++)
- {
- Robots[i].Deactivate(delay);
- if (!delay)
- {
- i--;
- }
- }
- }
- public void Update()
- {
- for (int i = 0; i < Robots.Count; i++)
- {
- if (Robots[i].Update())
- {
- Robots[i--].Deactivate(false);
- }
- }
- }
- }
|