/// <summary> /// 获得一个实例 /// </summary> /// <param name="robot">所需创建的实例类型</param> /// <returns>对应实例</returns> public Robot GetRobot(RobotType robot) { //通过Swit判断要实例化的类型 switch (robot) { case RobotType.Robot: this.robot = new Robot(); break; case RobotType.Robot_Nor: this.robot = new Robot_Nor(); break; case RobotType.Robot_Hig: this.robot = new Robot_Hig(); break; default: //处理异常情况 Console.WriteLine("参数错误,无法创建对象"); break; } //返回实例 return(this.robot); }
public Sprite GetSpriteForType(RobotType type) { if (isBroken) { return(BrokenBody); } switch (type) { case RobotType.cleaner: return(CleanerBody); case RobotType.gardener: return(GardenerBody); case RobotType.construction: return(ConstructionBody); case RobotType.artist: return(ArtistBody); case RobotType.kill: return(KillBody); } return(null); }
private void OnRobotChange(RobotType newRobot) { _CurrentRobot = newRobot; _isInitializing = true; switch (newRobot) { case RobotType.ChainRobot: InitializeChainRobot(); break; case RobotType.CableCar: InitializeCableCar(); break; case RobotType.TwoAxisGimbal: InitializeTwoAxisGimbal(); break; case RobotType.SimpleCar: InitializeSimpleCar(); break; } _isInitializing = false; RobotChanged?.Invoke(this, new RobotChangedEventArgs(newRobot)); ValuesChanged?.Invoke(this, new RobotValuesChangedEventArgs((int)driveSpeed.Value, (int)innerMotorSpeed.Value, (int)horizontalTurnSpeed.Value, (int)verticalTurnSpeed.Value)); }
internal static string ToSerializedValue(this RobotType value) { switch (value) { case RobotType.NonProduction: return("NonProduction"); case RobotType.Attended: return("Attended"); case RobotType.Unattended: return("Unattended"); case RobotType.Studio: return("Studio"); case RobotType.Development: return("Development"); case RobotType.StudioX: return("StudioX"); case RobotType.Headless: return("Headless"); case RobotType.StudioPro: return("StudioPro"); case RobotType.TestAutomation: return("TestAutomation"); } return(null); }
private IEnumerator ZoomToWaifu(GameObject waifu, RobotType type) { Camera camera = Camera.main; Vector3 oldPosition = camera.transform.position; Vector3 newPosition = waifu.transform.position; newPosition.z = oldPosition.z; float oldSize = camera.orthographicSize; float newSize = oldSize * 0.5f; float timeToZoom = 3, timer = 0, percent = 0; while (percent < 1) { timer += Time.deltaTime; percent = timer / timeToZoom; if (percent > 1) { percent = 1; } camera.transform.position = Vector3.Lerp(oldPosition, newPosition, percent); camera.orthographicSize = Mathf.Lerp(oldSize, newSize, percent); yield return(null); } UIManager.Instance.PlayerWon(type); ItemSpawner.Instance.gameObject.SetActive(false); yield return(new WaitForSeconds(3)); SceneManager.LoadScene(sceneToLoadAfterWin); }
void Awake() { animator = GetComponent <Animator>(); BotHeadInstance = Instantiate(botHeadPrefab, headSocket); BotBodyInstance = Instantiate(botBodyPrefab, bodySocket); BotLeftArmInstance = Instantiate(armPrefab, leftArmSocket); BotRightArmInstance = Instantiate(armPrefab, rightArmSocket); BotLeftLegInstance = Instantiate(legPrefab, leftLegSocket); BotRightLegInstance = Instantiate(legPrefab, rightLegSocket); head = BotHeadInstance.GetComponent <BotHead>(); body = BotBodyInstance.GetComponent <BotBody>(); lArm = BotLeftArmInstance.GetComponent <BotArm>(); rArm = BotRightArmInstance.GetComponent <BotArm>(); lLeg = BotLeftLegInstance.GetComponent <BotLeg>(); rLeg = BotRightLegInstance.GetComponent <BotLeg>(); head.Init(); body.Init(); type = body.robotType; body.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0); lArm.Init(); lArm.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0); rArm.Init(); rArm.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0); lLeg.Init(); lLeg.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0); rLeg.Init(); rLeg.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0); GenerateFaults(); }
public Robot BuildRobot(RobotType RobotType) { var parts = GetRobotPartsFor(RobotType); if (parts?.Count == 0) { return(null); } switch (RobotType) { case RobotType.RoboticDog: return(_robotService.BuildRobotDog(parts)); case RobotType.RoboticCat: return(_robotService.BuildRobotCat(parts)); case RobotType.RoboticDrone: return(_robotService.BuildRobotDrone(parts)); case RobotType.RoboticCar: return(_robotService.BuildRobotCar(parts)); default: return(null); } }
/// <summary> /// 升级 机器人 /// </summary> private void DoUpRobot() { BaseRobotInfo robotInfo = RobotInfo.Instance.MainRobotInfo; bool isEnoughMoney = RobotInfo.Instance.Coin >= robotInfo.cost; if (isEnoughMoney) { RobotInfo.Instance.Coin -= robotInfo.cost; RobotType robotType = robotInfo.robotType; int newLevel = robotInfo.robotLevel + 1; //更新数据库 DataManager.Instance.SaveRobotLevel(robotType, newLevel); //更新robot数据 RobotInfo.Instance.MainRobotInfo = RobotInfo.Instance.LoadBaseRobotData(robotType, newLevel); UpdateRobotUI(); } else { //TODO } }
public void ChangeRobot(RobotType type) { if (type == RobotChangeManager.CurrentType && currentModel != null) { return; } if (currentModel != null) { Destroy(currentModel); } RobotChangeManager.CurrentType = type; switch (type) { case RobotType.Robot1: currentModel = Instantiate(previewPrefab1, transform); break; case RobotType.Robot2: currentModel = Instantiate(previewPrefab2, transform); break; case RobotType.Robot3: currentModel = Instantiate(previewPrefab3, transform); break; } currentModel.transform.localPosition = Vector3.zero; }
void OnTriggerEnter(Collider collision) { if (collision.tag == "Player") { // collider. collision.transform.GetComponent <PlayerHealthPoint>().Hurt(); Instantiate(Explosion, (collision.transform.position + transform.position) / 2.0f, transform.rotation); EventManager.TriggerEvent <Explosion1, Vector3>(transform.position); Destroy(gameObject); Debug.Log("Catch Player"); } else if (collision.tag == "Robot") { RobotType touchedType = collision.GetComponent <AIController>().robottype; if (touchedType == robottype) { Instantiate(Explosion_killed, (collision.transform.position + transform.position) / 2.0f, transform.rotation); EventManager.TriggerEvent <RobotExplosion, Vector3>((collision.transform.position + transform.position) / 2.0f); Destroy(collision.gameObject); Destroy(gameObject); } } }
public void Copy(BotBody body) { renderer = GetComponent <SpriteRenderer>(); robotType = body.robotType; isBroken = body.isBroken; renderer.sprite = body.GetSprite(); }
public void PlayerWon(RobotType type) { source.Stop(); source.clip = winMusic; source.Play(); playerWon.gameObject.SetActive(true); currentInteractable = playerWon.gameObject.GetComponent <IUIInteractable>(); GetComponentInChildren <PlayerWinsUI>().Display(type); }
public Environment CopyStartEnviroment(RobotType robot) { if (Count > 0) { throw new Exception("Can't Copy an Enviroment that already has started"); } var result = new Environment(robot, env, this.waitMilliSeconds); return(result); }
// Standard constructor allowing for defining of robot type and trial type. public Trial(EnvironmentType environmentType, RobotType robotType, TrialType trialType) { this.environmentType = environmentType; this.robotType = robotType; this.trialType = trialType; // Set trial number to current number of trials, then increment the number of trials. // E.g. the first trial will have the trial number 0. trialNum = numTrials++; }
public void Display(RobotType type) { for (int i = 0; i < finder.Length; i++) { if (finder[i].robotType == type) { image.sprite = finder[i].sprite; return; } } }
/// <summary> /// 构造函数 /// </summary> /// <param name="robot">机器人</param> /// <param name="type">机器人类型</param> /// <param name="maxClientCount">最大服务客户数</param> public RobotStruct(IRobot robot, RobotType type = RobotType.Public, int maxClientCount = 1) { if (RobotType.Private == type && maxClientCount > 1) { throw new ArgumentException("私有类型机器人的最大服务客户数为 1 "); } this._type = type; this._maxClientCount = maxClientCount; this._robot = robot; }
public float Score(RobotType type) { float retScore = 0f; if ((int)type == (int)headType) { retScore += 2; } return(retScore); }
// RobotType is an enum public override Robot BuildRobot(RobotType robotType) { // Removing all the redundant if statements since they all do the same thing. var parts = GetPartsFor(robotType); if (parts == null) { return(null); } return(_robotService.BuildRobotDog(parts)); }
public Rigidbody2D GetRobotRigidbody(RobotType robotType) { for (int i = 0; i < m_robots.Count; i++) { if (m_robots[i].type == robotType) { return(m_robots[i].objcet.GetComponent <Rigidbody2D>()); } } return(null); }
public GameObject GetRobotObjcet(RobotType robotType) { for (int i = 0; i < m_robots.Count; i++) { if (m_robots[i].type == robotType) { return(m_robots[i].objcet); } } return(null); }
private void Start() { //加载信息 //TODO 以下部分待完善 //读取当前主角数据 RobotType mainRobotType = RobotType.Base_Plane; int mainRobotLevel = DataManager.Instance.LoadRobotLevel(mainRobotType); RobotInfo.Instance.MainRobotInfo = RobotInfo.Instance.LoadBaseRobotData(mainRobotType, mainRobotLevel); }
private void RobotSelection_SelectionChanged(object sender, SelectionChangedEventArgs e) { RobotType newRobot = (RobotType)Enum.Parse(typeof(RobotType), robotSelection.SelectedItem.ToString()); if (_CurrentRobot == newRobot) { return; } else { OnRobotChange(newRobot); } }
public void Init() { animator = GetComponent <Animator>(); int type = Random.Range(0, 5); robotType = (RobotType)type; if (animator) { animator.SetInteger("Type", (int)robotType); } }
public void testType() { var shell = new AppDomainShell(); shell.Init(false); shell.Open(typeof(ThreadAttack).Assembly.Location); RobotType robotType = shell.GetRobotType(typeof(ThreadAttack).FullName); Assert.IsTrue(robotType.isAdvancedRobot()); shell.Open(typeof(MyFirstRobot).Assembly.Location); robotType = shell.GetRobotType(typeof(MyFirstRobot).FullName); Assert.IsTrue(robotType.isStandardRobot()); shell.Dispose(); }
public void testType() { var shell = new AppDomainShell(); shell.Init(false); shell.Open(typeof(ThreadAttack).Assembly.Location); RobotType type = shell.GetRobotType(typeof(ThreadAttack).FullName); Assert.AreEqual(RobotType.ADVANCED, type); shell.Open(typeof(MyFirstRobot).Assembly.Location); type = shell.GetRobotType(typeof(MyFirstRobot).FullName); Assert.AreEqual(RobotType.STANDARD, type); shell.Dispose(); }
public void SetBobotPlayerOne(GameObject mObj) { BtnPlayerForTeam tempPlayer = mObj.GetComponent <BtnPlayerForTeam>(); PanelStatic.StaticBtnGameManager.objsBobotPlayer[0] = tempPlayer.lblPlayerName.text; PanelStatic.StaticBtnGameManager.objsBobotPlayer[1] = tempPlayer.lblPlayerLevel.text; PanelStatic.StaticBtnGameManager.objsBobotPlayer[2] = tempPlayer.strPro; robotType = RobotType.One; // if(FriendTimebtnTwo==0){ // objsBobotPlayer[0]=tempPlayer.lblPlayerName.text; // objsBobotPlayer[1]=tempPlayer.lblPlayerLevel.text; // objsBobotPlayer[2]=tempPlayer.strPro; // FriendTimebtnTwo = 1; // } }
public InitCommand(string name, string teamName, RobotType robotType) { if (name == null) { throw new ArgumentNullException(nameof(name)); } if (teamName == null) { teamName = ""; } NAME = name.Substring(0, Math.Min(name.Length, NAME_MAX_LENGTH)); TEAM_NAME = teamName.Substring(0, Math.Min(teamName.Length, TEAM_NAME_MAX_LENGTH)); ROBOT_TYPE = robotType; }
public BaseRobotInfo(RobotType robotType, string robotResName, string robotName, string robotInfo, int robotLevel, int robotMaxLevel, int moveSpeed, int maxHP, int weaponPoints, int defensePoints, int movePoints, int otherPoints, int cost) { this.robotType = robotType; this.robotResName = robotResName; this.robotName = robotName; this.robotInfo = robotInfo; this.robotLevel = robotLevel; this.robotMaxLevel = robotMaxLevel; this.moveSpeed = moveSpeed; this.maxHP = maxHP; this.weaponPoints = weaponPoints; this.defensePoints = defensePoints; this.movePoints = movePoints; this.otherPoints = otherPoints; this.cost = cost; }
int ContainsWhere(List <Robot> robotList, GameObject robot) { int index = -1; RobotType type = robot.GetComponent <Enemy>().GetRobotType(); for (int i = 0; i < robotList.Count; i++) { RobotType rType = robotList[i].GetPrefab().GetComponent <Enemy>().GetRobotType(); if (rType == type) { index = i; break; } } return(index); }
/// <summary> /// 获取一个可以工作的机器人 /// </summary> /// <param name="clientKey">客户的唯一标识</param> /// <param name="type">申请机器人的类型</param> /// <returns>一台可工作的机器人</returns> public IRobot ApplyOneAvailableRobot(RobotType type, string clientKey = null) { IRobot robot = null; if (String.IsNullOrEmpty(clientKey)) { throw new ArgumentException("Client Key 不能为空"); } // 1. 如果之前有注册机器人,则继续使用 if (_roster.ContainsKey(clientKey)) { string apiKey = _roster[clientKey]; RobotStruct robotStruct = _robots[apiKey]; if (robotStruct.RobotType != type) { throw new UnmatchedTypeException(robotStruct.RobotType, "已经注册了不同类型的机器人"); } robot = robotStruct.Robot; return(robot); } // 2. 如果是共享类型的机器人,则搜索 if (RobotType.Public == type) { foreach (string apiKey in _robots.Keys) { RobotStruct robotStruct = _robots[apiKey]; if (RobotType.Public == robotStruct.RobotType && robotStruct.CanRegister()) { if (robotStruct.Register(clientKey)) { robot = robotStruct.Robot; return(robot); } } } } // 3. 找不到合适的机器人,则创建新的机器人,并加入池中 robot = CreateRobot(clientKey, type); return(robot); }
public QQActionFuture GetRobotReply(QQMsg input, RobotType robotType, QQActionEventHandler listener) { return PushHttpAction(new GetRobotReplyAction(Context, listener, input, robotType)); }
public GetRobotReplyAction(QQContext context, QQActionEventHandler listener, QQMsg input, RobotType robotType) : base(context, listener) { this.input = input; this.robotType = robotType; }
public IQQActionFuture GetRobotReply(QQMsg input, RobotType robotType, QQActionListener listener) { return PushHttpAction(new GetTuringRobotReplyAction(Context, listener, input)); }
public Task<ActionEvent> GetRobotReply(RobotType robotType, string input, ActionEventListener listener = null) { return new GetTuringRobotReplyAction(Context, input) .ExecuteAsyncAuto(); }