IEnumerator ApplyEffect(KartMovement kart) { kart.AddKartModifier(boostStats); yield return(new WaitForSeconds(time)); kart.RemoveKartModifier(boostStats); }
void Awake() { trackManager = FindObjectOfType <TrackManager>(); racer = GetComponent <IRacer>(); kart = GetComponent <KartMovement>(); startingPos = this.transform.position; startingRot = this.transform.rotation; }
/// <summary> /// Instantiates the correct kart every level. /// </summary> public void InitLevel(string sceneName) { //print("InitLevel"); GameObject trackManagerGO = GameObject.Find("TrackManager"); GameObject displayGO = GameObject.Find("TimeDisplayCanvas"); GameObject kartGO = null; Vector3 kartPos = Vector3.zero; if (sceneName == "Level1") { kartPos = sceneData.level1KartPos; } else if (sceneName == "Level2") { kartPos = sceneData.level2KartPos; } if (isVR) { kartGO = Instantiate(VRKart, kartPos, Quaternion.identity); } else { GameObject kartParent = Instantiate(mobileKart, Vector3.zero, Quaternion.identity); // Get the kart gameobject kartGO = kartParent.transform.GetChild(1).gameObject; kartGO.transform.position = kartPos; } // Add kart references to classes that require it KartMovement movement = kartGO.GetComponent <KartMovement>(); Racer racer = kartGO.GetComponent <Racer>(); KartRepositionTrigger kartRepoTrig = trackManagerGO.GetComponent <KartRepositionTrigger>(); TimeDisplay display = displayGO.GetComponent <TimeDisplay>(); AudioSource audio = GameObject.Find("BackgroundMusic").GetComponent <AudioSource>(); audio.enabled = true; audio.Play(); kartRepoTrig.SetMovable(movement); display.SetRacer(racer); display.enabled = true; kartRepoTrig.enabled = true; trackManagerGO.GetComponent <TrackManager>().StartTrackManager(); display.StartDisplay(); // Set the Racer for EndController endController = GameObject.Find("EndGameController").GetComponent <EndController>(); endController.playerRacer = racer; }
/// <summary> /// Initialize the agent /// </summary> public override void Initialize() { kartMovement = GetComponent <KartMovement>(); checkpointHandler.checkpointReached += OnCheckpointReached; // If not training mode, no max step, play forever if (!trainingMode) { MaxStep = 0; } }
void Start() { rBody = GetComponent <Rigidbody>(); m_movable = (KartMovement)movable; m_trackManager = trackManager.GetComponent <TrackManager>(); racer = GetComponent <IRacer>(); // IInput relevant Params m_Acceleration = 0; m_Steering = 0; m_BoostPressed = false; m_FirePressed = false; isFirst = true; }
public void StartOnTire(KartMovement car) { car.AddTire(this, degradeInterval, degradeValue); }
private void Awake() { movement = GetComponentInChildren <KartMovement>(); pulse = GetComponentInChildren <KartPulse>(); }
public override void Trigger(KartMovement kart) { Instantiate(Spawn, kart.spawnPoint.transform.position, kart.spawnPoint.transform.rotation); }
public override void Trigger(KartMovement kart) { InstancedAction.DoRoutine(ApplyEffect(kart)); }
public virtual void Trigger(KartMovement kart) { }