private void button1_Click(object sender, EventArgs e) { Game game = VesterosBuilder.VesterosMap(); var places = game.places; pictureBox1.Image = VisualDebug.DrawPlaces(places, pictureBox1.Width, pictureBox1.Height); }
void ShowWaypoints() { foreach (Waypoint waypoint in DebugTarget.wayPoints) { VisualDebug.DrawCross(waypoint.Position, 0.5f, waypointColor, waypointVisibleDuration); } }
private void ChooseArea() { VisualDebug.WriteLine($"Selected area: {SelectedArea}, original area: {originalArea}"); if (SelectedArea != originalArea) { gm.WorldMgr.MoveToArea(originalWorld, SelectedArea); } CloseApp(Screen.Character); }
/// <summary> /// Awake is called when the script instance is being loaded. /// </summary> void Awake() { if (Instance != null) { Destroy(this); return; } debugs = new List <string>(); Instance = this; }
public override void StartApp() { friendlyDigimon = gm.logicMgr.GetAllDDockDigimon().GetRandomElement(); gm.EnqueueAnimation(Animations.EncounterEnemy("jackpot", 0.5f)); gm.EnqueueAnimation(Animations.SummonDigimon(friendlyDigimon)); pattern = GeneratePattern(Random.Range(MINIMUM_LENGTH, MAXIMUM_LENGTH + 1)); playerSelection = new int[pattern.Length]; delay = Random.Range(MINIMUM_TIME, MAXIMUM_TIME); VisualDebug.WriteLine($"Generated pattern with {pattern.Length} keys, and a delay of {delay}"); }
private void Update() { // Attack debug if (IsAttacking) { float direction = m_characterController.FacingDirection == EDirection.LEFT ? -1f : 1f; Vector2 attackOrigin = new Vector2(transform.position.x + (direction * (m_sr.size.x / 2f)), transform.position.y + m_sr.size.y / 2f); VisualDebug.DrawCross(attackOrigin, 0.15f, Color.green); Vector2 boxOrigin = new Vector2(attackOrigin.x + (direction * (m_attackX / 2f)), attackOrigin.y); VisualDebug.DrawBox(boxOrigin, new Vector2(m_attackX, m_attackY), Color.cyan); } }
void Update() { Color color = Color.blue; if (m_player.transform.position.x > transform.position.x) { m_characterController.FacingDirection = EDirection.RIGHT; } else { m_characterController.FacingDirection = EDirection.LEFT; } if (m_characterController.FacingDirection == EDirection.LEFT && transform.rotation.y != 180f) { transform.rotation = Quaternion.Euler(new Vector3(0f, 180f, 0f)); } else if (m_characterController.FacingDirection == EDirection.RIGHT && transform.rotation.y != 0f) { transform.rotation = Quaternion.Euler(new Vector3(0f, 0f, 0f)); } float distance = Vector2.Distance(transform.position, m_player.transform.position); if (!m_combat.IsAttacking) { if (distance > m_safeDistance) { Vector2 direction = m_player.transform.position - transform.position; m_characterController.Direction = direction; color = Color.red; } else { m_combat.Attack(); color = Color.green; } } else { float direction = m_characterController.FacingDirection == EDirection.LEFT ? 1f : -1f; Vector2 attackOrigin = new Vector2(transform.position.x + (direction * (m_sr.size.x / 2f)), transform.position.y + m_sr.size.y / 2f); VisualDebug.DrawCross(attackOrigin, 0.15f, Color.green); Vector2 boxOrigin = new Vector2(attackOrigin.x + (direction * (m_attackX / 2f)), attackOrigin.y); VisualDebug.DrawBox(boxOrigin, new Vector2(m_attackX, m_attackY), Color.cyan); } Debug.DrawLine(transform.position, m_player.transform.position, color); }
void Start() { settings = GameObject.Find("Root").GetComponent <Settings> (); // get a reference to the settings visualDebug = new VisualDebug(GameObject.Find("Root")); // create a general purpose visual debugging object, which will have a target gameobject at root level. theCamera = GameObject.Find("MainCamera"); // get a reference tot he main cam theIslands = new ArrayList(); currentIsland = spawnIsland(settings.initialVerticeCount, settings.initialAmplitude, settings.initialRoughness); theIslands.Add(currentIsland); spawnCamera(); mat = Resources.Load("Colour01") as Material; GameObject.Find("Cube").GetComponent <Renderer> ().material = mat; }
public void OnPathChange(List <Node> path) { if (!enablePathDebug || path == null) { return; } Node prevNode = null; foreach (Node node in path) { VisualDebug.DrawCross(node.RealWorldPos, 0.5f, pathColor, pathVisibleDuration); if (prevNode != null) { Debug.DrawLine(prevNode.RealWorldPos, node.RealWorldPos, pathColor, pathVisibleDuration); } prevNode = node; } }
// Returns an array containing the points nearest to one another out of the given set public static Vector3[] FindClosestPairOfPoints(Vector3[] points) { #if DEBUG_EXAMPLE_ALGORITHM VisualDebug.Initialize(); VisualDebug.BeginFrame("All points", true); VisualDebug.DrawPoints(points, .1f); #endif Vector3[] closestPointPair = new Vector3[2]; float bestDst = float.MaxValue; for (int i = 0; i < points.Length; i++) { for (int j = i + 1; j < points.Length; j++) { float dst = Vector3.Distance(points[i], points[j]); if (dst < bestDst) { bestDst = dst; closestPointPair[0] = points[i]; closestPointPair[1] = points[j]; } #if DEBUG_EXAMPLE_ALGORITHM VisualDebug.BeginFrame("Compare dst", true); VisualDebug.SetColour(Colours.lightRed, Colours.veryDarkGrey); VisualDebug.DrawPoint(points[i], .1f); VisualDebug.DrawLineSegment(points[i], points[j]); VisualDebug.DontShowNextElementWhenFrameIsInBackground(); VisualDebug.SetColour(Colours.lightGreen); VisualDebug.DrawLineSegmentWithLabel(closestPointPair[0], closestPointPair[1], bestDst.ToString()); #endif } } #if DEBUG_EXAMPLE_ALGORITHM VisualDebug.BeginFrame("Finished"); VisualDebug.SetColour(Colours.lightGreen); VisualDebug.DrawPoints(closestPointPair, .15f); VisualDebug.DrawLineSegmentWithLabel(closestPointPair[0], closestPointPair[1], bestDst.ToString()); VisualDebug.Save(); #endif return(closestPointPair); }
static Node[,] CreateNodes() { Vector2 currentPos; List <Node> result = new List <Node>(); Vector2Int totalAmount = GetRaycastAmount(); int x = 0; int y = 0; while (x < totalAmount.x) { while (y < totalAmount.y) { currentPos = settings.bottomLeftCorner + new Vector2(x * settings.cellSize, y * settings.cellSize); RaycastHit2D hit = Physics2D.BoxCast(currentPos, new Vector2(settings.cellSize, settings.cellSize), 0, Vector2.zero, Mathf.Infinity, settings.unwalkableLayers); if (hit.collider == null) { if (settings.enableVisualDebug) { VisualDebug.DrawCross(currentPos, settings.cellSize * 0.5f, Color.green, 100f); } result.Add(new Node(new Vector2Int(x, y), currentPos)); } else { if (settings.enableVisualDebug) { VisualDebug.DrawCross(currentPos, settings.cellSize * 0.5f, Color.red, 100f); } } y++; } y = 0; x++; } Node[,] resultArray = new Node[totalAmount.x, totalAmount.y]; foreach (Node node in result) { resultArray[node.Position.x, node.Position.y] = node; } return(resultArray); }
private IEnumerator AnimateLoadingBar() { sbHourglass = ScreenElement.BuildSprite("Hourglass", Parent).SetSprite(gm.spriteDB.hourglass); yield return(new WaitForSeconds(0.5f)); sbHourglass.Dispose(); while (result == 1) { if (tries == 5) { result = 2; break; } int thisRoundRNG = Random.Range(0, 10); VisualDebug.WriteLine($"RNG: {thisRoundRNG}"); if (thisRoundRNG == 0) { result = 3; break; } sbLoading.PlaceOutside(Direction.Up); for (int i = 0; i < 64; i++) { sbLoading.Move(Direction.Down); yield return(new WaitForSeconds(1.75f / 64)); } tries++; } if (result == 2) { SetScreen(gm.spriteDB.error); rbBlackScreen.Dispose(); sbLoading.Dispose(); } else if (result == 3) { StartCoroutine(AnimateSuccessBar()); } }
private void button3_Click(object sender, EventArgs e) { try { game.Move(); pictureBox1.Image = VisualDebug.DrawPlaces(game.places, pictureBox1.Width, pictureBox1.Height); listBox1.Items.Insert(0, game.gamePhase); if (game.players[0] is PapaKarlo) { listBox1.Items.Insert(0, ((PapaKarlo)game.players[0]).lastGames); } } catch (GameException excp) { pictureBox1.Image = VisualDebug.DrawPlaces(excp.game.places, pictureBox1.Width, pictureBox1.Height); listBox1.Items.Insert(0, excp.game.gamePhase); listBox1.Items.Insert(0, excp.exception.ToString()); } }
public void Update() { TimingDebugger.Start("Tester - Update"); VisualDebug.WireSphere(Vector3.zero, 2f, Color.red); VisualDebug.WireMesh(testMesh, Vector3.zero, Quaternion.identity, Vector3.one, Color.red); //VisualDebug.DrawLine(Vector3.zero, Vector3.one * 10f, Color.blue, Color.red); VisualDebug.Wire(new VisualDebug.WireVertex(Vector3.up, Color.blue), new VisualDebug.WireVertex(Vector3.up * 6f + Vector3.left * 2.5f, Color.red), new VisualDebug.WireVertex(Vector3.up * 1f + Vector3.left * 5f, Color.green), new VisualDebug.WireVertex(Vector3.up, Color.blue)); VisualDebug.Circle(Vector3.up * 2f, Vector3.up, 1f, Color.yellow); VisualDebug.WireCube(Vector3.up * 2f, Vector3.one, Color.cyan); VisualDebug.WireSphere(Vector3.right * 2f, 1f, Color.yellow); Camera mainCam = Camera.main; VisualDebug.Frustum(mainCam.worldToCameraMatrix, mainCam.projectionMatrix, mainCam.nearClipPlane, mainCam.farClipPlane, Color.red, Color.green); TimingDebugger.Stop(); }
// class to generate and hold random terrain data public RandomTerrain(float _size, int _iterations, float _amp, float _roughness) { /* // http://www.gameprogrammer.com/fractal.html#diamond size is the pixelsize, will be a square iterations is the number of times we'll subdivide. So 0 means 4 cornervalues only amp is amplitude roughness defines the multiplier for amplitude with each iteration. 2 to the -H every iteration */ size = _size; iterations = _iterations; amp = _amp; roughness = _roughness; arraySize = 1 + Mathf.FloorToInt (Mathf.Pow (2.0f, iterations)); unitSize = size / (arraySize - 1); visualDebug = GameObject.Find ("Root").GetComponent <World> ().getVisualDebug (); }
// class to generate and hold random terrain data public RandomTerrain(float _size, int _iterations, float _amp, float _roughness) { /* * // http://www.gameprogrammer.com/fractal.html#diamond * * size is the pixelsize, will be a square * iterations is the number of times we'll subdivide. So 0 means 4 cornervalues only * amp is amplitude * roughness defines the multiplier for amplitude with each iteration. 2 to the -H every iteration * */ size = _size; iterations = _iterations; amp = _amp; roughness = _roughness; arraySize = 1 + Mathf.FloorToInt(Mathf.Pow(2.0f, iterations)); unitSize = size / (arraySize - 1); visualDebug = GameObject.Find("Root").GetComponent <World> ().getVisualDebug(); }
private void initialiseIsland(GameObject _parent, String _name) { iSelf = new GameObject(_name); iSelf.transform.parent = _parent.transform; iVisualDebug = new VisualDebug(iSelf); }
public void setVisualDebug(VisualDebug _visualDebug) { visualDebug = _visualDebug;// override the general visual debug and set it to a specific one. }
public void setVisualDebug(VisualDebug _visualDebug) { visualDebug = _visualDebug; // override the general visual debug and set it to a specific one. }
private void symmetricButton_Click(object sender, EventArgs e) { game = new Game(); List <Place> places = game.places; places.Add(new Place { name = "L_Sea", position = new Vector2(0.4f, 0.25f), isSea = true, units = new List <Unit>() { new Unit { type = UnitType.Boat, player = PlayerType.Black } } }); places.Add(new Place { name = "R_Sea", position = new Vector2(0.6f, 0.25f), isSea = true, units = new List <Unit>() { new Unit { type = UnitType.Boat, player = PlayerType.Red } } }); places.Add(new Place { name = "L_Castle", position = new Vector2(0.2f, 0.25f), units = new List <Unit>() { new Unit { type = UnitType.Soldat, player = PlayerType.Black }, new Unit { type = UnitType.Soldat, player = PlayerType.Black } } }); places.Add(new Place { name = "L_Middle", position = new Vector2(0.2f, 0.5f) }); places.Add(new Place { name = "R_Castle", position = new Vector2(0.8f, 0.25f), units = new List <Unit>() { new Unit { type = UnitType.Soldat, player = PlayerType.Red }, new Unit { type = UnitType.Soldat, player = PlayerType.Red } } }); places.Add(new Place { name = "R_Middle", position = new Vector2(0.8f, 0.5f) }); places.Add(new Place { name = "Center", position = new Vector2(0.5f, 0.75f) }); places.AddLink("L_Sea", "R_Sea"); places.AddLink("R_Castle", "R_Sea"); places.AddLink("R_Middle", "R_Sea"); places.AddLink("Center", "R_Sea"); places.AddLink("L_Castle", "L_Sea"); places.AddLink("L_Middle", "L_Sea"); places.AddLink("Center", "L_Sea"); places.AddLink("L_Middle", "Center"); places.AddLink("L_Middle", "L_Castle"); places.AddLink("R_Middle", "Center"); places.AddLink("R_Middle", "R_Castle"); game.players = new List <Player>() { new PapaKarlo { type = PlayerType.Black }, new RandomPlayer { type = PlayerType.Red } }; pictureBox1.Image = VisualDebug.DrawPlaces(game.places, pictureBox1.Width, pictureBox1.Height); //timer1.Start(); }
private void timer1_Tick(object sender, EventArgs e) { game.Move(); pictureBox1.Image = VisualDebug.DrawPlaces(game.places, pictureBox1.Width, pictureBox1.Height); }
private void DecideBattle() { VisualDebug.WriteLine($"Original input: {string.Join(",", pattern)}"); VisualDebug.WriteLine($"Player input: {string.Join(",", playerSelection)}"); currentScreen = 2; int energyRank = GetEnergyRank(); int rewardCategory = GetRewardCategory(); Reward reward = GetRandomReward(rewardCategory); //To prevent abusing jackpot to level up fast, level up/down is restricted to certain conditions. //If those conditions aren't met, they are replaced with increase/reduce distance. if (reward == Reward.LevelDown && gm.logicMgr.GetPlayerLevelProgression() > 0.5f || reward == Reward.ForceLevelDown && gm.logicMgr.GetPlayerLevelProgression() == 0f) { reward = Reward.IncreaseDistance500; } else if (reward == Reward.LevelUp && gm.logicMgr.GetPlayerLevelProgression() < 0.5f || reward == Reward.ForceLevelUp && gm.logicMgr.GetPlayerLevelProgression() == 0f) { reward = Reward.ReduceDistance500; } Sprite[] friendlySprites = gm.spriteDB.GetAllDigimonBattleSprites(friendlyDigimon, energyRank); //Play animations of the battle against the box. gm.EnqueueAnimation(Animations.LaunchAttack(friendlySprites, 0, false, false)); gm.EnqueueAnimation(Animations.AttackCollision(0, friendlySprites, 3, null, 0)); if (rewardCategory < 2) { gm.EnqueueAnimation(Animations.BoxResists(friendlyDigimon)); } else { gm.EnqueueAnimation(Animations.DestroyBox()); if (Random.Range(0, 20) > gm.JackpotValue) { reward = Reward.Empty; } } //Apply the reward and play its animation. if (reward == Reward.Empty) { gm.EnqueueRewardAnimation(reward, null, null, null); } else if (reward == Reward.PunishDigimon) { gm.logicMgr.ApplyReward(reward, friendlyDigimon, out object resultBefore, out object resultAfter); gm.EnqueueRewardAnimation(reward, friendlyDigimon, resultBefore, resultAfter); } else if (reward == Reward.RewardDigimon) { gm.logicMgr.ApplyReward(reward, null, out object resultBefore, out object resultAfter); gm.EnqueueRewardAnimation(reward, null, resultBefore, resultAfter); } else if (reward == Reward.UnlockDigicodeOwned) { gm.logicMgr.ApplyReward(reward, null, out object resultBefore, out object resultAfter); gm.EnqueueRewardAnimation(reward, null, resultBefore, resultAfter); } else if (reward == Reward.UnlockDigicodeNotOwned) { gm.logicMgr.ApplyReward(reward, null, out object resultBefore, out object resultAfter); gm.EnqueueRewardAnimation(reward, null, resultBefore, resultAfter); } else if (reward == Reward.TriggerBattle) { gm.EnqueueAnimation(TriggerBattle()); return; } else { gm.logicMgr.ApplyReward(reward, null, out object resultBefore, out object resultAfter); gm.EnqueueRewardAnimation(reward, null, resultBefore, resultAfter); } CloseApp(Screen.GamesRewardMenu); }
//Before rendering a frame void Update() { if (this.transform.position.y < -100) { CheckPoint(); } switch (state) { case State.DIRECTION: VisualDebug.DisableRenderer(VisualDebug.Vectors.GREEN, transform); redArrow.gameObject.SetActive(true); text.text = "Angle: " + Mathf.Round(ang).ToString(); // TIMER - ang if (increaseAngle) { ang += Time.deltaTime * turnSpeed; if (ang >= maxAngle) { increaseAngle = false; } } else if (!increaseAngle) { ang -= Time.deltaTime * turnSpeed; if (ang <= -maxAngle) { increaseAngle = true; } } if (InputManager.Space()) { Quat rotate = Quat.AngleAxis(ang, (Vec3)this.transform.up); this.transform.rotation = (Quaternion)(rotate * (Quat)this.transform.rotation); redArrow.gameObject.SetActive(false); velocity = minForce; state = State.PROPULSION; previousPos = (Vec3)transform.position; } float angArrow = ang; Quat rotateArrow = Quat.AngleAxis(ang - 90, (Vec3)this.transform.forward * -1); redArrow.transform.rotation = (Quaternion)(rotateArrow * (Quat)this.transform.rotation); break; case State.PROPULSION: powerBar.gameObject.SetActive(true); text.text = "Force: " + Mathf.Round(velocity).ToString(); // TIMER - FORCE if (increase) { velocity += Time.deltaTime * powerSpeed; if (velocity >= maxForce) { increase = false; } } else if (!increase) { velocity -= Time.deltaTime * powerSpeed; if (velocity <= minForce) { increase = true; } } powerBar.value = velocity; // INPUT if (InputManager.Space()) { state = State.STRINGS; grounded = false; powerBar.gameObject.SetActive(false); direction += (Vec3)transform.forward; //Vec3 endPos = Physics_functions.TrobarPosicioFinalTir((direction + (Vec3)this.transform.forward) * velocity, this.transform); //GameObject.Find("base").GetComponent<ENTICourse.IK.InverseKinematics>().target = endPos; } break; case State.STRINGS: direction = Physics_functions.Molla(direction, transform); state = State.JUMP; break; case State.JUMP: if (!grounded) { transform.position = (Vector3)Physics_functions.TirParabolic(direction, this.transform); direction.y -= 9.81f * Time.deltaTime; //endPos = Physics_functions.TrobarPosicioFinalTir(direction, (Vec3)this.transform.position); } VisualDebug.DrawVector(direction, VisualDebug.Vectors.GREEN, transform); break; case State.LANDING: Vec3 friction = Physics_functions.FrictionJump(direction, drag); VisualDebug.DrawVector(friction, VisualDebug.Vectors.RED, transform); direction += friction * Time.deltaTime; if (direction.x > 0.1f && direction.z > 0.1f) { transform.position += (Vector3)direction; } else { state = State.DIRECTION; } break; default: break; } }
private void button2_Click(object sender, EventArgs e) { game = new Game(); game.players.Add(new RandomPlayer()); game.places.Add(new Place { position = new Vector2(0.1f, 0.5f), name = "1", }); game.places.Add(new Place { position = new Vector2(0.9f, 0.5f), name = "2" }); game.places.Add(new Place { position = new Vector2(0.5f, 0.3f), name = "3" }); game.places.Add(new Place { position = new Vector2(0.1f, 0.3f), name = "sea", isSea = true }); game.places.AddLink("1", "2"); game.places.AddLink("1", "sea"); game.places.AddLink("3", "sea"); game.places[0].units.Add(new Unit { }); game.places[0].units.Add(new Unit { }); game.places[3].units.Add(new Unit { type = UnitType.Boat }); Bitmap map = VisualDebug.DrawPlaces(game.places, pictureBox1.Width, pictureBox1.Height); VisualDebug.DrawMoves(ref map, game, game.places[0], game.places[0].units[0], map.Width, map.Height); pictureBox1.Image = map; DateTime start = DateTime.Now; int count = 0; while ((DateTime.Now - start).TotalSeconds < 1) { count++; game.GetMoves(game.places[0], game.places[0].units[0]); } listBox1.Items.Insert(0, count + ":" + 1.0f / count); }
//Before rendering a frame void Update() { if (this.transform.position.y < -50) { CheckPoint(); } switch (state) { case State.DIRECTION: VisualDebug.DisableRenderer(VisualDebug.Vectors.GREEN, transform); VisualDebug.DisableRenderer(VisualDebug.Vectors.RED, transform); redArrow.gameObject.SetActive(true); text.text = "Angle: " + Mathf.Round(ang).ToString(); // TIMER - ang if (increaseAngle) { ang += Time.deltaTime * turnSpeed; if (ang >= maxAngle) { increaseAngle = false; } } else if (!increaseAngle) { ang -= Time.deltaTime * turnSpeed; if (ang <= -maxAngle) { increaseAngle = true; } } if (InputManager.Space()) { Quat rotate = Quat.AngleAxis(ang, (Vec3)this.transform.up); this.transform.rotation = (Quaternion)(rotate * (Quat)this.transform.rotation); redArrow.gameObject.SetActive(false); velocity = minForce; state = State.PROPULSION; previousPos = (Vec3)transform.position; } float angArrow = ang; Quat rotateArrow = Quat.AngleAxis(ang - 90, (Vec3)this.transform.forward * -1); redArrow.transform.rotation = (Quaternion)(rotateArrow * (Quat)this.transform.rotation); break; case State.PROPULSION: powerBar.gameObject.SetActive(true); text.text = "Force: " + Mathf.Round(velocity).ToString(); // TIMER - FORCE if (increase) { velocity += Time.deltaTime * powerSpeed; if (velocity >= maxForce) { increase = false; } } else if (!increase) { velocity -= Time.deltaTime * powerSpeed; if (velocity <= minForce) { increase = true; } } powerBar.value = velocity; // INPUT if (InputManager.Space()) { state = State.STRINGS; grounded = false; powerBar.gameObject.SetActive(false); direction += (Vec3)transform.forward; } break; case State.STRINGS: direction = Physics_functions.Molla(direction, transform); state = State.JUMP; break; case State.JUMP: if (!grounded) { transform.position = (Vector3)Physics_functions.TirParabolic(direction, this.transform); direction.y -= 9.81f * Time.deltaTime; } VisualDebug.DrawVector(direction, VisualDebug.Vectors.GREEN, transform); break; case State.LANDING: Vec3 friction = Physics_functions.FrictionJump(direction, drag); VisualDebug.DrawVector(friction, VisualDebug.Vectors.RED, transform); //x = x0 + (v0 + Ft) * t direction += Physics_functions.TirParabolic(friction, transform) * Time.deltaTime; float aux = (direction * Time.deltaTime).Module(); if (aux >= 0.0001f && (direction.z * Time.deltaTime) >= 0) { transform.position += transform.forward * aux; } else { state = State.DIRECTION; transform.rotation = (Quaternion)inicialRotation; direction = auxVel; } break; default: break; } }
void Start() { settings = GameObject.Find ("Root").GetComponent <Settings> (); // get a reference to the settings visualDebug = new VisualDebug (GameObject.Find ("Root")); // create a general purpose visual debugging object, which will have a target gameobject at root level. theCamera = GameObject.Find ("MainCamera");// get a reference tot he main cam theIslands = new ArrayList (); currentIsland = spawnIsland (settings.initialVerticeCount, settings.initialAmplitude, settings.initialRoughness); theIslands.Add (currentIsland); spawnCamera (); mat = Resources.Load ("Colour01") as Material; GameObject.Find ("Cube").GetComponent<Renderer> ().material = mat; }