// Use this for initialization void Start() { animator = GetComponent <Animator>(); MyHelpNode.FindTransform(transform, "racingCar", out racingCar); carAudio = racingCar.GetComponent <CarAudio>(); liftMachineAudio = GetComponent <LiftMachineAudio>(); origGarageOpenTime = GarageOpenTime; }
// Use this for initialization void Start() { CarController = GetComponent <CarController>(); CarUser = GetComponent <CarUserControl>(); CarAudio = GetComponent <CarAudio>(); VehicleMass = GetComponent <Rigidbody>(); AircraftController = GetComponent <AeroplaneController>(); AircraftUser = GetComponent <AeroplaneUserControl4Axis>(); AircraftAudio = GetComponent <AeroplaneAudio>(); }
internal static bool Prefix(CarAudio __instance, Horn.Data data) { int carIndex = G.Sys.ProfileManager_.knownCars_[__instance.carLogic_.PlayerData_.CarName_]; if (carIndex >= Mod.DefaultCarCount && Mod.Instance.Config.UseTrumpetHorn) { __instance.phantom_.SetRTPCValue("Horn_volume", Mathf.Clamp01(data.hornPercent_ + 0.5f)); __instance.phantom_.Play("SpookyHorn", getEvent: true); return(false); } return(true); }
void Awake() { ca = GetComponent <CarAudio> (); audio = GetComponent <AudioSource> (); sounds = GameObject.Find("Sound"); if (!turnedOn) { ca.enabled = false; transform.Find("Lights").gameObject.SetActive(false); } else { ca.enabled = true; transform.Find("Lights").gameObject.SetActive(true); } }
/// <summary> /// Enables core vehicles sounds, like engine and tires. /// </summary> /// <param name="active">If set to <c>true</c> active.</param> protected virtual void ToggleCoreVehicleSounds(bool active) { AudioSource[] vehicleSounds = GetComponents <AudioSource> (); foreach (AudioSource aSources in vehicleSounds) { aSources.enabled = active; } CarAudio carA = GetComponent <CarAudio> (); carA.enabled = active; if (active) { vehicleSounds [2].Play(); vehicleSounds [0].Play(); } }
// Start is called before the first frame update void Start() { NumberOfWrongGuesses = 0; WaypointCarController = WaypointCar.gameObject.GetComponent <CarController>(); WaypointCarAudio = WaypointCar.gameObject.GetComponent <CarAudio>(); aicontrol = WaypointCar.gameObject.GetComponent <CarAIControl>(); StarterCanvas.gameObject.SetActive(true); WaypointCarController.m_Topspeed = 80; camera.gameObject.transform.SetParent(StarterCanvas.transform); //Somehow make WaypointCarAudio inaudible WaypointCar.gameObject.SetActive(false); ProceedButton.onClick.AddListener(EnableGame); Incorrect.gameObject.SetActive(false); CodeExecPanel.gameObject.SetActive(false); soundPlayed = false; PauseCanvas.gameObject.SetActive(false); }
// CLIENT SIDE SCRIPTS GO HERE void AddScripts() { // Anything you want to have running in the lobby should go in the netLobby script. // This function gets called when a game starts. // All scripts are called after we have a reference to the buggy and a NetworkViewID. // updates network-sunk fiziks gameObject.AddComponent <controlClient>(); //hit ball gameObject.AddComponent <netSwing>(); //ball range finder gameObject.AddComponent <netTransferToSwing>(); //ball marker BallMarker bms = gameObject.AddComponent <BallMarker>() as BallMarker; bms.m_nvs = nvs; bms.m_myCamera = nvs.myCam; // can be set in the script instead //show names over player's cart gameObject.AddComponent <PlayerNames>(); // set the camera in the audio script on the buggy - PUT THIS IN A SCRIPT SOMEONE CarAudio mca = myInfo.cartGameObject.GetComponent("CarAudio") as CarAudio; mca.followCamera = nvs.myCam; // replace tmpCam with our one - this messes up sound atm (nvs.myCam.gameObject.AddComponent <FollowPlayerScript>() as FollowPlayerScript).target = myInfo.cartGameObject.transform; // add smooth follow script // finally disable the preview scene (GameObject.Find("main").GetComponent(typeof(GameControl)) as GameControl).ed_levelPreviewScreen.SetActive(false); //show chat bubble over players when they chat gameObject.AddComponent <ChatBubble>(); //cart reset gameObject.AddComponent <netPlayerRespawn>(); // show that we connected connected = true; }
void Start() { Rigidbody rigidBody = GetComponent <Rigidbody>(); rigidBody.mass = 1000; carController = GetComponent <CarController>(); carAudio = GetComponent <CarAudio>(); name = "vehicle"; // Apply vehicle reflection and update materials ProcessVehicleMaterial(); // Process vehicle lights ProcessLightMaterial(); // Add Bumps and Crash audio clips ProcessCarAudioEffects(); }
// ANY SERVER SIDE SCRIPTS GO HERE void AddScripts() { // receives all players inputs and handles fiziks gameObject.AddComponent("controlServer"); //pause gameObject.AddComponent("netPause"); //cart reset gameObject.AddComponent("netPlayerRespawn"); // set the camera in the audio script on the buggy - PUT THIS IN A SCRIPT SOMEONE CarAudio mca = myInfo.cartGameObject.GetComponent("CarAudio") as CarAudio; mca.followCamera = nvs.myCam; // replace tmpCam with our one - this messes up sound atm (nvs.myCam.gameObject.AddComponent("FollowPlayerScript") as FollowPlayerScript).target = myInfo.cartGameObject.transform; // add player follow script // add the swing script //gameObject.AddComponent("netSwing"); }
// CLIENT SIDE SCRIPTS GO HERE // all scripts are called after we have a reference to the buggy and a NetworkViewID void AddScripts() { // updates network-sunk fiziks gameObject.AddComponent("controlClient"); // chat gameObject.AddComponent("netChat"); //pause gameObject.AddComponent("netPause"); // set the camera in the audio script on the buggy - PUT THIS IN A SCRIPT SOMEONE networkVariables nvs = GetComponent("networkVariables") as networkVariables; CarAudio mca = myInfo.cartGameObject.GetComponent("CarAudio") as CarAudio; mca.followCamera = nvs.myCam; // replace tmpCam with our one - this messes up sound atm (nvs.myCam.gameObject.AddComponent("SmoothFollow") as SmoothFollow).target = myInfo.cartGameObject.transform; // add smooth follow script // get self myInfo.player = Network.player; // get server myInfo.server = myInfo.cartViewIDTransform.owner; // show that we connected connected = true; }
// CLIENT SIDE SCRIPTS GO HERE // all scripts are called after we have a reference to the buggy and a NetworkViewID void AddScripts() { Component.Destroy(GetComponent("netLobby")); // updates network-sunk fiziks gameObject.AddComponent("controlClient"); //pause gameObject.AddComponent("netPause"); // set the camera in the audio script on the buggy - PUT THIS IN A SCRIPT SOMEONE CarAudio mca = myInfo.cartGameObject.GetComponent("CarAudio") as CarAudio; mca.followCamera = nvs.myCam; // replace tmpCam with our one - this messes up sound atm (nvs.myCam.gameObject.AddComponent("FollowPlayerScript") as FollowPlayerScript).target = myInfo.cartGameObject.transform; // add smooth follow script // add the swing script //gameObject.AddComponent("netSwing"); // show that we connected connected = true; }
private void InitializeData() { vOutput = new TextBoxOutput(textBoxOutput); vMobilePhone = new SimCorpMobile(new Battery(3000, BatteryType.LiPo), new Simcard("Vodafone", FormFactor.Nano, NetworkType.LTE), vOutput); vPlaybackDevices = new List <IPlayback>(); vPlaybackDevices.Add(new IphoneOriginalHeadphones(vOutput)); vPlaybackDevices.Add(new UnofficialHeadset(vOutput)); vChargers = new List <ICharge>(); vChargers.Add(new IphoneCharger(vOutput)); vChargers.Add(new SmartCharger(vOutput)); vChargers.Add(new UniversalChinaCharger(vOutput)); var carAudioDevice = new CarAudio(vOutput); //This device has both interfaces vPlaybackDevices.Add(carAudioDevice); vChargers.Add(carAudioDevice); //Bind data populateGroup(vChargers, groupBoxChargers); populateGroup(vPlaybackDevices, groupBoxPlaybackDevices); }
private void Start() { volumeFadeIn = true; AudioListener.volume = 0.0f; // Initialize values pauseAnimation = false; pause = false; started = false; settings = false; isDrifting = false; canContinue = false; canDrift = true; canShowExtra = true; avoiding = false; pressedExit = false; tutorial = false; canAdvanceTutorial = true; driftTutorial = false; driftTutorialObjective = false; driftTutorialDriftDone = false; checkingGamepad = false; disabledUI = false; totalScore = 0; driftScore = 0; maxDriftScore = 0; multiplier = 0; challengeTextState = 0; tutorialState = 0; driftTutorialState = 0; playerName = ""; previousTimeScale = Time.timeScale; rigidbodyVelocity = Vector3.zero; multiplierTemp = multiplierTempInit; collisionTemp = collisionTempInit; avoidTemp = avoidTempInit; initPosition = new Vector3[labelsUI.Length]; dataManager = DataManager.Instance; carInput = CarInput.Instance; // Initialize time challenge values leftTime = leftTimeInit; timePickupsCount = timePickupRoot.transform.childCount; currentTimePickup = 0; timePickups = new GameObject[timePickupsCount]; for(int i = 0; i < timePickups.Length; i++) { timePickups[i] = timePickupRoot.transform.GetChild (i).gameObject; } for(int i = 0; i < timePickups.Length; i++) { timePickups[i].GetComponent<DriftPickup>().DisablePickupForMinimap(); } timeChallengeUI.SetActive (false); for(int i = 0; i < freeTutorialLabels.Length; i++) { freeTutorialCameras[i].enabled = false; freeTutorialLabels[i].SetActive (false); } for(int i = 0; i < challengeTutorialCameras.Length; i++) { challengeTutorialCameras[i].enabled = false; challengeTutorialLabels[i].SetActive (false); } // Get player references carController = GameObject.FindWithTag ("Player").GetComponent<CarController>(); carEngine = carController.GetComponent<CarEngine>(); carSetup = carController.GetComponent<CarSetup>(); carAudio = carController.GetComponent<CarAudio>(); carRigidbody = carController.GetComponent<Rigidbody>(); introAnimation = GetComponent<CameraIntroAnimation>(); settingsManager = GetComponent<SettingsManager>(); extraTweenText = extraTween.GetComponent<Text>(); challengeLabelTween = challengeLabel.GetComponent<TweenFontSize>(); bloomUI = GameObject.Find ("UICamera").GetComponent<Bloom>(); if(dataManager.isGamepad) { #if !UNITY_EDITOR UnityEngine.Cursor.visible = false; UnityEngine.Cursor.lockState = CursorLockMode.Locked; #endif } else { #if !UNITY_EDITOR UnityEngine.Cursor.visible = false; UnityEngine.Cursor.lockState = CursorLockMode.None; #endif } // Load data maxDriftScore = dataManager.bestDrift; for(int i = 0; i < labelsUI.Length; i++) { labelsUI[i].color = initColor; auxColor = labelsUI[i].color; auxColor.a = initAlpha; labelsUI[i].color = auxColor; initPosition[i] = labelsUI[i].transform.position; } pauseUI.SetActive (false); settingsUI.SetActive (false); gameplayUI.SetActive (false); startUI.SetActive(false); bloomUI.enabled = false; carController.enabled = false; carEngine.enabled = false; carSetup.enabled = false; carRigidbody.isKinematic = true; //carRigidbody.constraints = RigidbodyConstraints.FreezeAll; // Disable car audio carAudio.EnableSources(0.5f); EventSystem.current.SetSelectedGameObject(null); }
public void StartGamePlayer() { // Get player references players = GameObject.FindGameObjectsWithTag("Player"); for(int i = 0; i < players.Length; i++) { if(players[i].GetComponent<NetworkIdentity>().isLocalPlayer) { carController = players[i].GetComponent<CarController>(); carEngine = carController.GetComponent<CarEngine>(); carSetup = carController.GetComponent<CarSetup>(); carAudio = carController.GetComponent<CarAudio>(); carRigidbody = carController.GetComponent<Rigidbody>(); carController.enabled = false; carEngine.enabled = true; // Disable car audio carAudio.EnableSources(0.5f); Debug.Log ("MultiplayerManager: player initialization complete"); break; } } }
// Use this for initialization void Start() { // setup reference to networkVariables nvs = gameObject.GetComponent("networkVariables") as networkVariables; // get server version serverVersion = nvs.serverVersion; // get server name string serverName = nvs.serverName; // Use NAT punchthrough if no public IP present Network.InitializeServer(32, 11177, !Network.HavePublicAddress()); MasterServer.RegisterHost(serverVersion, SystemInfo.deviceName, serverName); // create server owners buggy // This line will get changed at some point - no need to have the camera and the marker in the prefab - they should be in their own scripts GameObject cartGameObject = (Instantiate(Resources.Load("buggy_m"), new Vector3(0, 5, 0), Quaternion.identity) as GameObject); // **************************** GameObject ballGameObject = Instantiate(Resources.Load("ball"), new Vector3(3, 5, 0), Quaternion.identity) as GameObject; GameObject characterGameObject = Instantiate(Resources.Load("lil_patrick"), new Vector3(0, 4, 0), Quaternion.identity) as GameObject; // set buggy as characters parent characterGameObject.transform.parent = cartGameObject.transform; // networkview that shit NetworkViewID cartViewIDTransform = Network.AllocateViewID(); NetworkView cgt = cartGameObject.GetComponent("NetworkView") as NetworkView; cgt.observed = cartGameObject.transform; cgt.viewID = cartViewIDTransform; cgt.stateSynchronization = NetworkStateSynchronization.Unreliable; NetworkViewID cartViewIDRigidbody = Network.AllocateViewID(); NetworkView cgr = cartGameObject.AddComponent("NetworkView") as NetworkView; cgr.observed = cartGameObject.rigidbody; cgr.viewID = cartViewIDRigidbody; cgr.stateSynchronization = NetworkStateSynchronization.Unreliable; NetworkViewID ballViewID = Network.AllocateViewID(); ballGameObject.networkView.viewID = ballViewID; NetworkViewID characterViewID = Network.AllocateViewID(); characterGameObject.networkView.viewID = characterViewID; // turn it into a PlayerInfo nvs.myInfo.cartGameObject = cartGameObject; nvs.myInfo.cartModel = "buggy_m"; nvs.myInfo.cartViewIDTransform = cartViewIDTransform; nvs.myInfo.cartViewIDRigidbody = cartViewIDRigidbody; nvs.myInfo.ballGameObject = ballGameObject; nvs.myInfo.ballModel = "ball"; nvs.myInfo.ballViewID = ballViewID; nvs.myInfo.characterGameObject = characterGameObject; nvs.myInfo.characterModel = "lil_patrick"; nvs.myInfo.characterViewID = characterViewID; nvs.myInfo.currentMode = 0; // set in buggy // get self nvs.myInfo.player = Network.player; // keep a copy myInfo = nvs.myInfo; // add myInfo to the player list nvs.players = new ArrayList(); nvs.players.Add(myInfo); // ANY SERVER SIDE SCRIPTS GO HERE //******************************************** // receives all players inputs and handles fiziks gameObject.AddComponent("controlServer"); // chat gameObject.AddComponent("netChat"); //pause gameObject.AddComponent("netPause"); // set the camera in the audio script on the buggy - PUT THIS IN A SCRIPT SOMEONE CarAudio mca = myInfo.cartGameObject.GetComponent("CarAudio") as CarAudio; mca.followCamera = nvs.myCam; // replace tmpCam with our one - this messes up sound atm (nvs.myCam.gameObject.AddComponent("SmoothFollow") as SmoothFollow).target = myInfo.cartGameObject.transform; // add smooth follow script //******************************************** }
private void Start() { car = GetComponent <Car>(); carAudio = GetComponent <CarAudio>(); }
private void Awake() { transmission = GetComponent <Transmission>(); vehicleInput = GetComponent <VehicleInput>(); carAudio = GetComponent <CarAudio>(); }
static void Main(string[] args) { var consoleOutput = new MobilePhoneApp.ConsoleOutput(); List <MobilePhone> phones = new List <MobilePhone>(); phones.Add(new SimCorpMobile(new Battery(3000, BatteryType.LiPo), new Simcard("Vodafone", FormFactor.Nano, NetworkType.LTE), consoleOutput)); phones.Add(new Nokia3310(new Battery(1500, BatteryType.NiMg), new Simcard("LifeCell"), consoleOutput)); List <IPlayback> playbackDevices = new List <IPlayback>(); playbackDevices.Add(new IphoneOriginalHeadphones(consoleOutput)); playbackDevices.Add(new UnofficialHeadset(consoleOutput)); List <ICharge> chargingDevices = new List <ICharge>(); chargingDevices.Add(new IphoneCharger(consoleOutput)); chargingDevices.Add(new SmartCharger(consoleOutput)); chargingDevices.Add(new UniversalChinaCharger(consoleOutput)); var carAudioDevice = new CarAudio(consoleOutput); //This device has both interfaces playbackDevices.Add(carAudioDevice); chargingDevices.Add(carAudioDevice); //TODO: Move choice to separate method Console.WriteLine("Following phones are available :"); int choice = 0; foreach (MobilePhone phone in phones) { Console.WriteLine("{0} - {1} \n", choice, phone.GetDescription()); choice++; } choice = 0; do { Console.WriteLine("Please select phone you want to use :"); string res = Console.ReadLine(); int.TryParse(res, out choice); } while (phones.ElementAtOrDefault(choice) == null); var selectedPhone = phones.ElementAt(choice); Console.WriteLine("Following charging devices are available :"); choice = 0; foreach (ICharge device in chargingDevices) { Console.WriteLine("{0} - {1}", choice, device.GetType()); choice++; } choice = 0; do { Console.WriteLine("Please select device you want to use :"); string res = Console.ReadLine(); int.TryParse(res, out choice); } while (chargingDevices.ElementAtOrDefault(choice) == null); selectedPhone.ChargerComponent = chargingDevices.ElementAt(choice); Console.WriteLine("Following playback devices are available :"); choice = 0; foreach (IPlayback device in playbackDevices) { Console.WriteLine("{0} - {1}", choice, device.GetType()); choice++; } choice = 0; do { Console.WriteLine("Please select device you want to use :"); string res = Console.ReadLine(); int.TryParse(res, out choice); } while (playbackDevices.ElementAtOrDefault(choice) == null); selectedPhone.PlaybackComponent = playbackDevices.ElementAt(choice); selectedPhone.Play(new object()); Console.ReadLine(); }