void setKinematic() { j = GetComponentInChildren <Jointer>(); c = j.cone; if (c != null) { if (c.GetComponent <Rigidbody>().velocity == Vector3.zero) { c.GetComponent <Rigidbody>().isKinematic = true; } } }
private void DibujarPropulsor() { GameObject propulsorObject = GameObject.CreatePrimitive(PrimitiveType.Cube); propulsorObject.AddComponent <Cone>(); propulsor = propulsorObject.GetComponent <Cone>(); propulsor.Altura = AlturaPropulsor + 10; propulsor.Radio = RadioPropulsor; propulsor.PosInicial = new Vector3(posInicial.x, posInicial.y, posInicial.z); propulsor.DibujarCono(); propulsor.GetComponent <MeshRenderer>().material.color = colorPropulsor; propulsorObject.transform.parent = cohete.transform; propulsorObject.name = "Propulsor"; GameObject fueginho = GameObject.CreatePrimitive(PrimitiveType.Cube); fueginho.AddComponent <Cone>(); fuego = fueginho.GetComponent <Cone>(); fuego.Altura = AlturaPropulsor + 10; fuego.Radio = RadioPropulsor - 2; fuego.PosInicial = new Vector3(posInicial.x, posInicial.y - 20, posInicial.z); fuego.DibujarCono(); fuego.GetComponent <MeshRenderer>().material.color = new Color(1, 0.647f, 0); fueginho.transform.parent = cohete.transform; fueginho.transform.Rotate(new Vector3(-180, 0, 0)); fueginho.AddComponent <AnimacionFuego>(); fueginho.name = "Fuego"; }
private void DibujarPropulsor() { GameObject propulsorObject = GameObject.CreatePrimitive(PrimitiveType.Cube); propulsorObject.AddComponent <Cone>(); propulsor = propulsorObject.GetComponent <Cone>(); propulsor.Altura = AlturaPropulsor + 10; propulsor.Radio = RadioPropulsor; propulsor.PosInicial = new Vector3(posInicial.x, posInicial.y, posInicial.z); propulsor.DibujarCono(); propulsor.GetComponent <MeshRenderer>().material.color = colorPropulsor; propulsorObject.transform.parent = cohete.transform; propulsorObject.name = "Propulsor"; }
private void DibujarPunta() { GameObject coneObject = GameObject.CreatePrimitive(PrimitiveType.Cube); coneObject.AddComponent <Cone>(); cone = coneObject.GetComponent <Cone>(); cone.Altura = AlturaPunta; cone.Radio = RadioCohete; cone.PosInicial = new Vector3(posInicial.x, posInicial.y + AlturaCuerpo + AlturaPropulsor, posInicial.z); cone.DibujarCono(); cone.GetComponent <MeshRenderer>().material.color = colorPunta; coneObject.transform.parent = cohete.transform; coneObject.name = "Punta"; }
private void DibujarArbolCono() { GameObject coneObject = GameObject.CreatePrimitive(PrimitiveType.Cube); coneObject.AddComponent <Cone>(); Cone cone = coneObject.GetComponent <Cone>(); cone.Altura = Random.Range(minAlturaCono, maxAlturaCono); cone.Radio = Random.Range(minRadioCono, maxRadioCono + 1); cone.PosInicial = new Vector3(posInicial.x, posInicial.y + altura, posInicial.z); cone.DibujarCono(); cone.GetComponent <MeshRenderer>().material.color = coloresHoja[Random.Range(0, coloresHoja.Length)]; coneObject.transform.parent = arbol.transform; coneObject.name = "Copa"; }
void RobotControls() { if (Input.GetKey(KeyCode.W)) { WheelForce(force); } else if (Input.GetKey(KeyCode.S)) { WheelForce(-force); } else { WheelForce(0); } Vector3 pos = jointee.transform.position; if (Input.GetKey(KeyCode.R)) { if (pos.y <= 2) { pos.y += .01f; print(pos); jointee.transform.position = pos; } } else if (Input.GetKey(KeyCode.F)) { if (pos.y >= 0.1) { pos.y -= .01f; print(pos); jointee.transform.position = pos; } } else if (Input.GetKey(KeyCode.T)) { j = GetComponentInChildren <Jointer>(); c = j.cone; if (c) { c.GetComponent <Rigidbody>().isKinematic = false; c.GetComponent <Rigidbody>().useGravity = true; transform.GetComponentInChildren <Cone>().transform.SetParent(null); j.cone = null; c.transform.parent = null; } } if (Input.GetKey(KeyCode.Q)) { climbingDrum.spinMotor = true; } else { climbingDrum.spinMotor = false; } Rotate(); }
public void SpellCombTip(int lvlAndnumber) { CurSpellToolTipBox2.SetActive(true); if (spellCombTip1 == true && lvlAndnumber <= 3) { Empty1(); } if (spellCombTip2 == true && (lvlAndnumber > 3 && lvlAndnumber < 30)) { Empty2(); } if (spellCombTip3 == true && (lvlAndnumber >= 30 && lvlAndnumber < 40)) { Empty3(); } if (spellCombTip4 == true && (lvlAndnumber >= 40 && lvlAndnumber < 50)) { Empty4(); } if (spellCombTip5 == true && (lvlAndnumber >= 50 && lvlAndnumber < 60)) { Empty5(); } if (spellCombTip6 == true && (lvlAndnumber >= 60 && lvlAndnumber < 70)) { Empty6(); } switch (lvlAndnumber) { case 1: curSpellname[0] = fire.spellname; curDamage = fire.damagePure; curCooldown = fire.cooldownSeconds; spellCombTip1 = true; if (GameManager.FindObjectOfType <GameManager>().empowerToken_) { Effect0.text = fire.effect2; } else { Effect0.text = fire.effect; } SpellImage1.sprite = fire.GetComponent <Image>().sprite; break; case 2: curSpellname[0] = frost.spellname; curDamage = frost.damagePure; curCooldown = frost.cooldownSeconds; spellCombTip1 = true; Effect0.text = frost.effect; SpellImage1.sprite = frost.GetComponent <Image>().sprite; if (GameManager.FindObjectOfType <GameManager>().empowerToken_2) { Effect0.text = frost.effect2; } else { Effect0.text = frost.effect; } break; case 3: curSpellname[0] = lightning.spellname; curDamage = lightning.damagePure; curCooldown = lightning.cooldownSeconds; spellCombTip1 = true; Effect0.text = lightning.effect; SpellImage1.sprite = lightning.GetComponent <Image>().sprite; if (GameManager.FindObjectOfType <GameManager>().empowerToken_3) { Effect0.text = lightning.effect2; } else { Effect0.text = lightning.effect; } break; case 21: curSpellname[1] = "-" + meteor.spellname; curDamageModifierlvl2 = meteor.damagePure; curExtraCD = meteor.cooldownSeconds; spellCombTip2 = true; SpellImage2.sprite = meteor.GetComponent <Image>().sprite; break; case 22: curSpellname[1] = "-" + cone.spellname; curExtraCD = cone.cooldownSeconds; curDamageModifierlvl2 = cone.damagePure; spellCombTip2 = true; SpellImage2.sprite = cone.GetComponent <Image>().sprite; break; case 23: curSpellname[1] = "-" + ghostcast.spellname; curDamageModifierlvl2 = ghostcast.damagePure; curExtraCD = ghostcast.cooldownSeconds; spellCombTip2 = true; SpellImage2.sprite = ghostcast.GetComponent <Image>().sprite; break; case 31: curSpellname[2] = "-" + doublecast.spellname; curExtraCD2 = doublecast.cooldownPercent; curDamageModifierlvl3 = doublecast.damagePercent; spellCombTip3 = true; SpellImage3.sprite = doublecast.GetComponent <Image>().sprite; break; case 32: curSpellname[2] = "-" + splitcast.spellname; curExtraCD2 = splitcast.cooldownPercent; curDamageModifierlvl3 = splitcast.damagePercent; spellCombTip3 = true; SpellImage3.sprite = splitcast.GetComponent <Image>().sprite; break; case 33: curSpellname[2] = "-" + companion.spellname; curExtraCD2 = companion.cooldownPercent; curDamageModifierlvl3 = companion.damagePercent; spellCombTip3 = true; SpellImage3.sprite = companion.GetComponent <Image>().sprite; break; case 41: curSpellname[3] = "-" + boost.spellname; curDamageModifierlvl4 = boost.damagePercent; curDamageModifierlvl4_2 = boost.damagePure; spellCombTip4 = true; SpellImage4.sprite = boost.GetComponent <Image>().sprite; break; case 42: curSpellname[3] = "-" + hasten.spellname; curExtraCD3 = hasten.cooldownPercent; spellCombTip4 = true; SpellImage4.sprite = hasten.GetComponent <Image>().sprite; break; case 43: curSpellname[3] = "-" + empower.spellname; spellCombTip4 = true; SpellImage4.sprite = empower.GetComponent <Image>().sprite; break; case 51: curSpellname[4] = "-" + blackhole.spellname; curExtraCD4 = blackhole.cooldownSeconds; spellCombTip5 = true; SpellImage5.sprite = blackhole.GetComponent <Image>().sprite; break; case 52: curSpellname[4] = "-" + push.spellname; curExtraCD4 = push.cooldownSeconds; spellCombTip5 = true; SpellImage5.sprite = push.GetComponent <Image>().sprite; break; case 53: curSpellname[4] = "-" + pool.spellname; curExtraCD4 = pool.cooldownSeconds; spellCombTip5 = true; SpellImage5.sprite = pool.GetComponent <Image>().sprite; break; case 61: curSpellname[5] = "-" + chaosorb.spellname; curExtraCD5 = chaosorb.cooldownPercent; curExtraCD5_2 = chaosorb.cooldownSeconds; spellCombTip6 = true; SpellImage6.sprite = chaosorb.GetComponent <Image>().sprite; break; case 62: curSpellname[5] = "-" + channling.spellname; curExtraCD5 = channling.cooldownPercent; curExtraCD5_2 = channling.cooldownSeconds; curDamageModifierlvl5 = channling.damagePercent; spellCombTip6 = true; SpellImage6.sprite = channling.GetComponent <Image>().sprite; break; case 63: curSpellname[5] = "-" + blessedaim.spellname; curExtraCD5 = blessedaim.cooldownPercent; curDamageModifierlvl5 = blessedaim.damagePercent; spellCombTip6 = true; SpellImage6.sprite = blessedaim.GetComponent <Image>().sprite; break; default: break; } curTSpellname.text = curSpellname[0] + curSpellname[1] + curSpellname[2] + curSpellname[3] + curSpellname[4] + curSpellname[5]; curTDamage.text = "Damage: " + ((curDamage + curDamageModifierlvl2 + curDamageModifierlvl4_2) * curDamageModifierlvl3 * curDamageModifierlvl4 * curDamageModifierlvl5).ToString("F1"); curTCooldown.text = "Cooldown: " + ((curCooldown + curExtraCD + curExtraCD4 + curExtraCD5_2) * curExtraCD2 * curExtraCD3 * curExtraCD5).ToString("F1"); }