quero fazer acender a luz do conta giro
2 participantes
Página 1 de 1
quero fazer acender a luz do conta giro
using UnityEngine;
public class luzturbo: MonoBehaviour{
public Material[] Texturas;
private int Indice = 1;
void Update () {
if (Drivetrain.shiftUpRPM) {
if(Indice < Texturas.Length){
GetComponent Indice++;
}
else{
GetComponent<MeshRenderer>().material = Texturas[0];
Indice = 1;
}
}
}
}
using UnityEngine;
using System.Collections; // needed for IEnumerator
using System.Collections.Generic; //needed for List class
[RequireComponent (typeof (Axles))]
public class Drivetrain : MonoBehaviour {
[HideInInspector]
public bool engineTorqueFromFile=false;
[HideInInspector]
public int torqueRPMValuesLen=0;
[HideInInspector]
public float[,] torqueRPMValues = new float[0,0];
[HideInInspector]
public Clutch clutch;
[HideInInspector]
public CarController carController;
Setup setup;
Axles axles;
[HideInInspector]
public FuelTank[] fuelTanks;
// Cached rigidbody
Rigidbody body;
Transform myTransform;
// All the wheels the drivetrain should power
[HideInInspector]
public Wheel[] poweredWheels;
// engine's maximal power (in HP) and relative RPM
public float maxPower = 210;
public float maxPowerRPM=5000;
// engine's maximal torque (in Nm) and relative RPM
public float maxTorque=360;
public float maxTorqueRPM=2500;
[HideInInspector]
public float originalMaxPower = 210;
[HideInInspector]
public float maxNetPower;
[HideInInspector]
public float maxNetPowerRPM;
[HideInInspector]
public float maxNetTorque;
[HideInInspector]
public float maxNetTorqueRPM;
[HideInInspector]
public float torque;
float netTorque;
float netTorqueImpulse;
[HideInInspector]
public float wheelTireVelo;
// powerband RPM range
public float minRPM = 1000;
public float maxRPM=6000;
// can engine stall?
public bool canStall = false;
[HideInInspector]
public bool startEngine=false;
public bool revLimiter=false;
public float revLimiterTime = 0.1f; //50ms
[HideInInspector]
public bool revLimiterTriggered=false;
[HideInInspector]
public bool revLimiterReleased=false;
float timer;
// engine inertia (how fast the engine spins up), in kg*m^2
public float engineInertia = 0.3f;
// drivetrain inertia in kg*m^2
public float drivetrainInertia=0.02f;
float rotationalInertia;
//engine's friction coefficient.
//this cause the engine to slow down, and cause engine braking
public float engineFrictionFactor=0.25f;
// Engine orientation (typically either Vector3.forward or Vector3.right).
// This determines how the car body moves as the engine revs up.
public Vector3 engineOrientation = Vector3.forward;
public enum Transmissions {RWD, FWD, AWD, XWD};
public Transmissions transmission;
// The gear ratios, including neutral (0) and reverse (negative) gears
public float[] gearRatios={-2.66f, 0f, 2.66f, 1.91f, 1.39f, 1f, 0.71f};
[HideInInspector]
public int neutral=1; //index of neutral gear;
[HideInInspector]
public int first=0;
[HideInInspector]
public int firstReverse=0;
// The final drive ratio, which is multiplied to each gear ratio
public float finalDriveRatio = 6.09f;
// Coefficient determining how much torque is Transferred between the wheels when they move at
// different speeds, to simulate differential locking.
public float differentialLockCoefficient = 80;
// shifter with one button for every gear
public bool shifter=false;
// shift gears automatically?
public bool automatic = true;
// shift in reverse automatically? (with automatic mode)
public bool autoReverse = true;
public float shiftDownRPM=2000;
public float shiftUpRPM;
// How long the car takes to shift gears in secs
public float shiftTime = 0.5f;
[HideInInspector]
public float clutchMaxTorque=0; // clutch max torque. If left to zero, its calculated automatically from engine torque
public class luzturbo: MonoBehaviour{
public Material[] Texturas;
private int Indice = 1;
void Update () {
if (Drivetrain.shiftUpRPM) {
if(Indice < Texturas.Length){
GetComponent
}
else{
GetComponent<MeshRenderer>().material = Texturas[0];
Indice = 1;
}
}
}
}
using UnityEngine;
using System.Collections; // needed for IEnumerator
using System.Collections.Generic; //needed for List class
[RequireComponent (typeof (Axles))]
public class Drivetrain : MonoBehaviour {
[HideInInspector]
public bool engineTorqueFromFile=false;
[HideInInspector]
public int torqueRPMValuesLen=0;
[HideInInspector]
public float[,] torqueRPMValues = new float[0,0];
[HideInInspector]
public Clutch clutch;
[HideInInspector]
public CarController carController;
Setup setup;
Axles axles;
[HideInInspector]
public FuelTank[] fuelTanks;
// Cached rigidbody
Rigidbody body;
Transform myTransform;
// All the wheels the drivetrain should power
[HideInInspector]
public Wheel[] poweredWheels;
// engine's maximal power (in HP) and relative RPM
public float maxPower = 210;
public float maxPowerRPM=5000;
// engine's maximal torque (in Nm) and relative RPM
public float maxTorque=360;
public float maxTorqueRPM=2500;
[HideInInspector]
public float originalMaxPower = 210;
[HideInInspector]
public float maxNetPower;
[HideInInspector]
public float maxNetPowerRPM;
[HideInInspector]
public float maxNetTorque;
[HideInInspector]
public float maxNetTorqueRPM;
[HideInInspector]
public float torque;
float netTorque;
float netTorqueImpulse;
[HideInInspector]
public float wheelTireVelo;
// powerband RPM range
public float minRPM = 1000;
public float maxRPM=6000;
// can engine stall?
public bool canStall = false;
[HideInInspector]
public bool startEngine=false;
public bool revLimiter=false;
public float revLimiterTime = 0.1f; //50ms
[HideInInspector]
public bool revLimiterTriggered=false;
[HideInInspector]
public bool revLimiterReleased=false;
float timer;
// engine inertia (how fast the engine spins up), in kg*m^2
public float engineInertia = 0.3f;
// drivetrain inertia in kg*m^2
public float drivetrainInertia=0.02f;
float rotationalInertia;
//engine's friction coefficient.
//this cause the engine to slow down, and cause engine braking
public float engineFrictionFactor=0.25f;
// Engine orientation (typically either Vector3.forward or Vector3.right).
// This determines how the car body moves as the engine revs up.
public Vector3 engineOrientation = Vector3.forward;
public enum Transmissions {RWD, FWD, AWD, XWD};
public Transmissions transmission;
// The gear ratios, including neutral (0) and reverse (negative) gears
public float[] gearRatios={-2.66f, 0f, 2.66f, 1.91f, 1.39f, 1f, 0.71f};
[HideInInspector]
public int neutral=1; //index of neutral gear;
[HideInInspector]
public int first=0;
[HideInInspector]
public int firstReverse=0;
// The final drive ratio, which is multiplied to each gear ratio
public float finalDriveRatio = 6.09f;
// Coefficient determining how much torque is Transferred between the wheels when they move at
// different speeds, to simulate differential locking.
public float differentialLockCoefficient = 80;
// shifter with one button for every gear
public bool shifter=false;
// shift gears automatically?
public bool automatic = true;
// shift in reverse automatically? (with automatic mode)
public bool autoReverse = true;
public float shiftDownRPM=2000;
public float shiftUpRPM;
// How long the car takes to shift gears in secs
public float shiftTime = 0.5f;
[HideInInspector]
public float clutchMaxTorque=0; // clutch max torque. If left to zero, its calculated automatically from engine torque
edugamer69- Avançado
- PONTOS : 3664
REPUTAÇÃO : 16
Idade : 27
Respeito as regras :
Re: quero fazer acender a luz do conta giro
Bom dia! você somente posta o script e não diz nada do que precisa? quer implementar uma luz é isso? o que não está conseguindo fazer?edugamer69 escreveu:using UnityEngine;
public class luzturbo: MonoBehaviour{
public Material[] Texturas;
private int Indice = 1;
void Update () {
if (Drivetrain.shiftUpRPM) {
if(Indice < Texturas.Length){
GetComponentIndice++;
}
else{
GetComponent<MeshRenderer>().material = Texturas[0];
Indice = 1;
}
}
}
}
using UnityEngine;
using System.Collections; // needed for IEnumerator
using System.Collections.Generic; //needed for List class
[RequireComponent (typeof (Axles))]
public class Drivetrain : MonoBehaviour {
[HideInInspector]
public bool engineTorqueFromFile=false;
[HideInInspector]
public int torqueRPMValuesLen=0;
[HideInInspector]
public float[,] torqueRPMValues = new float[0,0];
[HideInInspector]
public Clutch clutch;
[HideInInspector]
public CarController carController;
Setup setup;
Axles axles;
[HideInInspector]
public FuelTank[] fuelTanks;
// Cached rigidbody
Rigidbody body;
Transform myTransform;
// All the wheels the drivetrain should power
[HideInInspector]
public Wheel[] poweredWheels;
// engine's maximal power (in HP) and relative RPM
public float maxPower = 210;
public float maxPowerRPM=5000;
// engine's maximal torque (in Nm) and relative RPM
public float maxTorque=360;
public float maxTorqueRPM=2500;
[HideInInspector]
public float originalMaxPower = 210;
[HideInInspector]
public float maxNetPower;
[HideInInspector]
public float maxNetPowerRPM;
[HideInInspector]
public float maxNetTorque;
[HideInInspector]
public float maxNetTorqueRPM;
[HideInInspector]
public float torque;
float netTorque;
float netTorqueImpulse;
[HideInInspector]
public float wheelTireVelo;
// powerband RPM range
public float minRPM = 1000;
public float maxRPM=6000;
// can engine stall?
public bool canStall = false;
[HideInInspector]
public bool startEngine=false;
public bool revLimiter=false;
public float revLimiterTime = 0.1f; //50ms
[HideInInspector]
public bool revLimiterTriggered=false;
[HideInInspector]
public bool revLimiterReleased=false;
float timer;
// engine inertia (how fast the engine spins up), in kg*m^2
public float engineInertia = 0.3f;
// drivetrain inertia in kg*m^2
public float drivetrainInertia=0.02f;
float rotationalInertia;
//engine's friction coefficient.
//this cause the engine to slow down, and cause engine braking
public float engineFrictionFactor=0.25f;
// Engine orientation (typically either Vector3.forward or Vector3.right).
// This determines how the car body moves as the engine revs up.
public Vector3 engineOrientation = Vector3.forward;
public enum Transmissions {RWD, FWD, AWD, XWD};
public Transmissions transmission;
// The gear ratios, including neutral (0) and reverse (negative) gears
public float[] gearRatios={-2.66f, 0f, 2.66f, 1.91f, 1.39f, 1f, 0.71f};
[HideInInspector]
public int neutral=1; //index of neutral gear;
[HideInInspector]
public int first=0;
[HideInInspector]
public int firstReverse=0;
// The final drive ratio, which is multiplied to each gear ratio
public float finalDriveRatio = 6.09f;
// Coefficient determining how much torque is Transferred between the wheels when they move at
// different speeds, to simulate differential locking.
public float differentialLockCoefficient = 80;
// shifter with one button for every gear
public bool shifter=false;
// shift gears automatically?
public bool automatic = true;
// shift in reverse automatically? (with automatic mode)
public bool autoReverse = true;
public float shiftDownRPM=2000;
public float shiftUpRPM;
// How long the car takes to shift gears in secs
public float shiftTime = 0.5f;
[HideInInspector]
public float clutchMaxTorque=0; // clutch max torque. If left to zero, its calculated automatically from engine torque
Abraço!
Obs.: poste scripts dentro da caixa "Script" no editor do fórum, para melhor visualização dele.
Re: quero fazer acender a luz do conta giro
no caso quero que o material seja alterado quando o carro passar de marcha
edugamer69- Avançado
- PONTOS : 3664
REPUTAÇÃO : 16
Idade : 27
Respeito as regras :
Re: quero fazer acender a luz do conta giro
Boa tarde! dê uma olhadinha nesse tópico aqui: https://www.schultzgames.com/t6034-como-acessar-o-emission-do-material-e-mudar-a-cor-via-script?highlight=alterar+cor+materialedugamer69 escreveu:no caso quero que o material seja alterado quando o carro passar de marcha
Abraço!
Tópicos semelhantes
» Só o networkIndetity é o suficiente para o que eu quero fazer? Como ele funciona?
» Quero fazer minha propria lens flare
» [ajuda]Quero fazer um jogo estilo resident evil
» Quero fazer um sistema de apertar uma tecla e ativar uma ação ou animação, como faço?
» como fazer o objeto spawnar com uma cor aleatória dentre as que eu quero?
» Quero fazer minha propria lens flare
» [ajuda]Quero fazer um jogo estilo resident evil
» Quero fazer um sistema de apertar uma tecla e ativar uma ação ou animação, como faço?
» como fazer o objeto spawnar com uma cor aleatória dentre as que eu quero?
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos