public void SetColor(RobotColor color) { this.color = color; switch (color) { case RobotColor.Colorless: baseSprite.color = Color.white; smokeSprite.color = Color.white; beltSprite.color = Color.white; maxLife = 50.0f; normalAttack.attackDamage = 2; break; case RobotColor.Copper: baseSprite.color = new Color(1.0f, 0.75f, 0.62f); smokeSprite.color = new Color(0.38f, 0.63f, 1.0f); beltSprite.color = new Color(0.86f, 0.85f, 0.71f); maxLife = 100.0f; normalAttack.attackDamage = 4; break; case RobotColor.Silver: baseSprite.color = Color.white; smokeSprite.color = new Color(0.38f, 1.0f, 0.5f); beltSprite.color = new Color(0.5f, 0.5f, 0.5f); maxLife = 125.0f; normalAttack.attackDamage = 5; break; case RobotColor.Gold: baseSprite.color = new Color(0.91f, 0.7f, 0.0f); smokeSprite.color = new Color(0.42f, 0.15f, 0.10f); beltSprite.color = new Color(0.86f, 0.5f, 0.32f); maxLife = 150.0f; normalAttack.attackDamage = 6; break; case RobotColor.Random: baseSprite.color = new Color(Random.Range(0, 1.0f), Random.Range(0, 1.0f), Random.Range(0, 1.0f)); smokeSprite.color = new Color(Random.Range(0, 1.0f), Random.Range(0, 1.0f), Random.Range(0, 1.0f)); beltSprite.color = new Color(Random.Range(0, 1.0f), Random.Range(0, 1.0f), Random.Range(0, 1.0f)); maxLife = Random.Range(100, 250); normalAttack.attackDamage = Random.Range(4, 10); break; } currentLife = maxLife; }
// Instantiates the robot avatar of the specified type at the robot agent's // positions as a child of the agent. Disables the default capsule mesh renderer. public void LoadRobotAvatar(RobotType type, RobotColor color) { // Get the desired robot avatar model prefab. AssetSelector assetSelector = GameObject.Find("AssetSelector").GetComponent <AssetSelector>(); GameObject robotPrefab = assetSelector.GetRobotAvatar(type); // If there is such a model. if (robotPrefab != null) { // Find robot agent game object, instantiate the model as a child, apply color and disable to capsule renderer. GameObject robotAgent = GameObject.Find("RobotAgent"); GameObject robotClone = Instantiate(robotPrefab, robotAgent.transform); assetSelector.ApplyRobotColor(robotClone, type, color); robotAgent.GetComponent <MeshRenderer>().enabled = false; robotAgent.GetComponent <CapsuleCollider>().radius = assetSelector.colliderRadii[type]; robotAgent.GetComponent <RobotController>().UpdateWidth(); } }
// Takes a robot game object and colors the appropriate parts of the robot with the wanted color. public void ApplyRobotColor(GameObject robot, RobotType type, RobotColor color) { Material wantedMaterial = robotMaterials[type][color]; if (robot != null && wantedMaterial != null) { if (type == RobotType.SOPHIA) { SkinnedMeshRenderer renderer = robot.GetComponentInChildren <SkinnedMeshRenderer>(); Material[] materials = renderer.materials; materials[1] = wantedMaterial; renderer.materials = materials; } else { foreach (string partName in coloredRobotParts[type]) { robot.transform.Find(partName).GetComponent <MeshRenderer>().material = wantedMaterial; } } } }
public RobotFacade() { rc = new RobotColor(); rh = new RobotHands(); rb = new RobotBody(); }
public RobotFacade(RobotType robotType, string color = "steel") { _robotBody = new RobotBody(robotType); _robotColor = new RobotColor(color); }
public RobotFacade() { rc = new RobotColor(); rm = new RoboMetal(); rb = new RobotBody(); }