public override void Activate(PowerupUser player) { AudioSource.PlayClipAtPoint(BoostContSFX, player.transform.position, PlayerPrefs.GetFloat("SFXVolume", 1)); base.Activate(player); PlayerCarController pcc = player.GetComponent <PlayerCarController>(); StatusEffectManager manager = player.GetComponent <StatusEffectManager>(); manager.ApplyEffect(new BoostEffectContinuous(pcc), EffectTime); }
private void OnTriggerEnter(Collider other) { PlayerCarController player = other.GetComponent <PlayerCarController>(); StatusEffectManager manager = other.GetComponent <StatusEffectManager>(); if (player != null) { manager.ApplyEffect(new SpikeTrapEffect(player), EffectTime); } }
void Start() { UpComand = new UpComand(); DownComand = new DownComand(); LeftComand = new LeftComand(); rightComand = new RightComand(); Stopcomand = new StopComand(); Play = this.gameObject.GetComponent <PlayerCarController> (); }
private void Start() { currentSound = 0; foreach (AudioSource sound in engineLoop) { sound.loop = true; } carController = GetComponent <PlayerCarController>(); pitchFactor = carController.carMovementProperties.maxSpeed * 2; originalFactor = pitchFactor; }
/// <summary> /// Start is called on the frame when a script is enabled just before /// any of the Update methods is called the first time. /// </summary> void Start() { playerRB = GetComponent <Rigidbody>(); playerCarController = GetComponent <PlayerCarController>(); targetClosestPolice = GetComponent <TargetClosestPolice>(); increaseScoreController = GetComponent <PlayerIncreaseScoreController>(); bustedAmount = 0; bustedSet = false; }
private void OnTriggerExit(Collider other) { PlayerCarController player = other.GetComponent <PlayerCarController>(); WheelFrictionCurve ff = player.ForwardWheelFriction; WheelFrictionCurve sf = player.SideWheelFriction; ff.stiffness = ff.stiffness * Slipperyness; sf.stiffness = sf.stiffness * Slipperyness; player.ForwardWheelFriction = ff; player.SideWheelFriction = sf; }
public GameObject getCars(string name) { foreach (GameObject g in cars) { PlayerCarController pcc = g.GetComponent <PlayerCarController> (); if (pcc.carName == name) { return(g); } } return(null); }
private void SpawnPlayerAsNPC() { PlayerProperties.Skin = CarCustomizations.Skins.TaxiCar; GameObject npc = NPCManager.cars.First(); Transform t = npc.transform; PhotonNetwork.Destroy(npc); localPlayer = InstantiatePlayer("TaxiCar", t.position, t.rotation).GetComponent <PlayerCarController>(); PhotonNetwork.RaiseEvent(2, null, new RaiseEventOptions { Receivers = ReceiverGroup.All }, SendOptions.SendReliable); }
private void Awake() { _playerCar = Instantiate(_vehicles.SelectedCarController, _startingPoint); _checkpointsController.Init(_cameraController, OnCheckpointPassed, OnCheckpointGameFinished); _cameraController.AddTarget(_playerCar); _ghostController.Init(_playerCar); _uiController.Init(_playerCar); _directionArrow = Instantiate(_directionArrowTemplate); _directionArrow.Init(_playerCar); UpdateDirectionArrow(); }
void initializeCar(GameObject go, int playerNum) { PlayerCarController pcc = go.GetComponent <PlayerCarController>(); pcc.SetPath(path); pcc.LoadNodes(); pcc.setPlayerNum(playerNum); go.GetComponent <RaceEntity>().lapCountLabel = lapCountLabel; go.GetComponent <RaceEntity>().bestTimeLabel = bestTimeLabel; go.GetComponent <RaceEntity>().lapTimeLabel = lapTimeLabel; foreach (RubberBand a in aiCars) { a.addPlayer(pcc); } }
private void Update() { if (localPlayer == null && MultiplayerPlayer.LocalPlayer != null) { localPlayer = MultiplayerPlayer.LocalPlayer.GetComponent <PlayerCarController>(); } if (localPlayer != null) { if (localPlayer.Stuck) { StuckHelpOffer.gameObject.SetActive(true); } else { StuckHelpOffer.gameObject.SetActive(false); } } }
public void Init(PlayerCarController playerCarController) { _playerCarController = playerCarController; _recording = true; var sceneName = gameObject.scene.name; if (!PositionsCache.ContainsKey(sceneName)) { return; } var loadedPositions = PositionsCache[sceneName]; if (loadedPositions.Count > 0) { SetGhostPositions(loadedPositions); } }
private void StartGame() { running = true; foreach (GameObject player in GameObject.FindGameObjectsWithTag("Player")) { PlayerCarController pcc = player.GetComponent <PlayerCarController>(); if (pcc != null) { pcc.enabled = true; } } if (PhotonNetwork.IsMasterClient && ParkingGameSettings.GameMode == GameMode.KingOfTheHill) { moveParkingSpotCoroutine = WaitToMoveParkingSpot(ParkingSpotDuration); StartCoroutine(moveParkingSpotCoroutine); GameState.TimeUntilParkingSpotMoves = ParkingSpotDuration; countdownCoroutine = Countdown(1); StartCoroutine(countdownCoroutine); } }
public void GetAllEngineAccelerations() { try { foreach (GameObject car in GameManager.CarInstances) { Rigidbody RB = car.GetComponent <Rigidbody>(); PlayerCarController PCC = car.GetComponent <PlayerCarController>(); if (PCC != null) { car.transform.GetChild(2).GetChild(1).GetComponent <AudioSource>().pitch = 1f + ((RB.velocity.magnitude / PCC.MaxSpeed)); } else { car.transform.GetChild(1).GetComponent <AudioSource>().pitch = 1f + ((RB.velocity.magnitude / car.GetComponent <NPCCarController>().MaxSpeed)); } } } catch (MissingReferenceException) { ParkingGameManager.Instance.UpdatePlayerList(); GetAllEngineAccelerations(); } }
private void Start() { int p1Choice = PlayerPrefs.GetInt("P1_choice", -1); int p2Choice = PlayerPrefs.GetInt("P2_choice", -1); PlayerPrefs.DeleteAll(); if (p1Choice == -1) { Debug.Log("Serious error, no player 1 choice"); Application.Quit(); } GameObject go1 = Instantiate(carTypes[p1Choice], p1StartPos.position, p1StartPos.rotation); initializeCar(go1, 0); cameraFollowController.targetObject = go1.transform; PlayerCarController pcc = go1.GetComponent <PlayerCarController>(); pcc.speedSlider = speedSlider1; pcc.rpmSlider = rpmSlider1; go1.GetComponent <RaceEntity>().positionLabel = positionLabel1; if (p2Choice != -1) { GameObject go2 = Instantiate(carTypes[p2Choice], p2StartPos.position, p2StartPos.rotation); initializeCar(go2, 1); cameraFollowController2.targetObject = go2.transform; pcc = go2.GetComponent <PlayerCarController>(); pcc.speedSlider = speedSlider2; pcc.rpmSlider = rpmSlider2; go2.GetComponent <RaceEntity>().positionLabel = positionLabel2; } RaceManager.instance.setWinnerText(winnerText); RaceManager.instance.StartRace(); }
void OnTriggerStay2D(Collider2D other) { //Debug.Log ("Fire triggered by " + other.gameObject.name); PersonHealth ph = other.gameObject.transform.root.GetComponent <PersonHealth> (); if (ph == null) { } else { ph.dealDamageFromFire(); } PlayerCarController pcc = other.GetComponent <PlayerCarController> (); if (pcc == null) { } else { pcc.dealDamage(10); } }
public StatusEffect(PlayerCarController player) { this.player = player; }
bool doWeHaveTheItems() //removing the string item removes all instances not just the one so need to work around that { List <string> itemNames = itemsToGet; List <Item> toHandOver = new List <Item> (); foreach (Item i in Inventory.playerInventory.inventoryItems) { if (itemNames.Contains(i.itemName)) { itemNames.Remove(i.itemName); toHandOver.Add(i); } } if (itemNames.Count == 0) { foreach (Item i in toHandOver) { if (i.myContainer == null) { Inventory.playerInventory.removeItemWithoutDrop(i); } else { i.myContainer.removeItemFromContainer(i); } Destroy(i.gameObject); } return(true); } foreach (GameObject g in CarSpawner.me.carsInWorld) { PlayerCarController pcc = g.GetComponent <PlayerCarController> (); if (pcc == null) { } else { if (pcc.playerCar == true || pcc.stolen == true) { foreach (Item i in pcc.carContainer.itemsInContainer) { if (itemNames.Contains(i.itemName)) { itemNames.Remove(i.itemName); toHandOver.Add(i); } } } } } if (itemNames.Count == 0) { foreach (Item i in toHandOver) { if (i.myContainer == null) { Inventory.playerInventory.removeItemWithoutDrop(i); } else { i.myContainer.removeItemFromContainer(i); } Destroy(i.gameObject); } return(true); } return(false); }
// Use this for initialization void Start() { myRF = this.GetComponent <NewRoadFollower> (); myPCC = this.GetComponent <PlayerCarController> (); spawnTimer = Random.Range(5.0f, 10.0f); }
public void addPlayer(PlayerCarController p) { players.Add(p); }
void Start() { UpComand = new UpComand(); Play = this.gameObject.GetComponent <PlayerCarController> (); }
public SpikeTrapEffect(PlayerCarController player) : base(player) { }
public BoostEffect(PlayerCarController player) : base(player) { }
public void Init(PlayerCarController playerCarController) { _speedometer.Init(playerCarController); }
public BoostEffectContinuous(PlayerCarController player) : base(player) { }
public void Init(PlayerCarController playerCarController) { _playerCarController = playerCarController; }