public void PickUpHit(Transform racer, Transform other) { if(other.gameObject.tag == "PickUp") { player = racer.GetComponent<PlayerPickUp>(); thePickUp = other.GetComponent<PickUp>(); thePickUp.UseRefresh(); if(player.PickUpQueue.Length < 1) { switch(thePickUp.MyType) { case "Turbo": player.PickUpQueue = new string[1]; player.PickUpQueue[0] = "Turbo"; break; case "Forcefield": player.PickUpQueue = new string[1]; player.PickUpQueue[0] = "Forcefield"; break; default: break; } } } }
public void Release() { for (int i = carriers.Count - 1; i >= 0; i--) { PlayerPickUp playerPickup = carriers[i].GetComponentInChildren <PlayerPickUp>(); playerPickup.DropItem(); } }
public void Awake() { character = GetComponentInChildren <CreatureCptCharacter>(); playerPickUp = new PlayerPickUp(this); playerRay = new PlayerRay(this); InvokeRepeating("UpdatePlayerData", 0.2f, 0.2f); }
private void OnTriggerExit(Collider other) { _playerPU = other.GetComponent <PlayerPickUp>(); if (_playerPU != null) { _playerPU.inTrigger = false; _playerPU.inTriggerObject = null; } }
private void OnTriggerEnter(Collider other) { _playerPU = other.GetComponent <PlayerPickUp>(); if (_playerPU != null) { _playerPU.inTrigger = true; _playerPU.inTriggerObject = this.gameObject; } }
public void UsePickUp(string type, Transform other) { player = other.GetComponent<PlayerPickUp>(); switch(type) { case "Turbo": player.UseTurbo(TurboDuration); break; case "Forcefield": player.UseForcefield(ForcefieldTime); break; default: break; } }
void Start() { rb = GetComponent <Rigidbody>(); playerPickUp = GetComponent <PlayerPickUp>(); facialAnimation = GetComponent <FacialAnimation>(); startMaxSpeed = maxSpeed; SetHammerVisibility(false); if (gameObject.tag == "Player2") { playerID = 1; } else { playerID = 0; } player = ReInput.players.GetPlayer(playerID); }
public void OnTriggerEnter(Collider other) { Debug.Log("Collider entered by " + other.gameObject.name, gameObject); if (other.GetComponent <Pickupable>() != null) { _carriedPart = other.GetComponent <Pickupable>(); _playerPU = other.GetComponentInParent <PlayerPickUp>(); //Debug.Log("_carried part is " + _carriedPart.name + _carriedPart.itemID); _missingPart = transform.GetChild(0).gameObject; //Debug.Log("_missing part is " + _missingPart.name); if (transform.childCount > 1) { _brokenPart = transform.GetChild(1).gameObject; } else { _brokenPart = null; } switch (missingPartenum) { case MissingPartEnum.Wheel: if (_carriedPart.itemID == 1) //Player is carrying a Wheel { print("Missing part is active " + _missingPart.activeSelf + "carried part is active" + _carriedPart.gameObject.activeSelf); if (_missingPart.activeSelf) { break; //if the Wheel is not missing, don't do anything } else { _missingPart.SetActive(true); //if the Wheel is missing, fix it (turn it on) _carriedPart.gameObject.SetActive(false); //turn off the Wheel the player is carrying print("Found missing part " + _carriedPart.itemName); _playerPU.ResetHold(); AM.Play("Good2"); //UpdateScore(1); } } break; case MissingPartEnum.Hood: if (_carriedPart.itemID == 2) //Player is carrying a Hood { if (_missingPart.activeSelf) { break; } else { _missingPart.SetActive(true); _brokenPart.SetActive(false); _carriedPart.gameObject.SetActive(false); AM.Play("Good2"); //print("Found missing part " + _carriedPart.itemName); _playerPU.ResetHold(); //UpdateScore(1); } } break; case MissingPartEnum.Cabin: if (_carriedPart.itemID == 3) { if (_missingPart.activeSelf) { break; } else { _missingPart.SetActive(true); _brokenPart.SetActive(false); _carriedPart.gameObject.SetActive(false); _playerPU.ResetHold(); AM.Play("Good2"); //print("Found missing part " + _carriedPart.itemName); //UpdateScore(1); } } break; case MissingPartEnum.Boot: if (_carriedPart.itemID == 4) { if (_missingPart.activeSelf) { break; } else { _missingPart.SetActive(true); _brokenPart.SetActive(false); _carriedPart.gameObject.SetActive(false); print("Found missing part " + _carriedPart.itemName); _playerPU.ResetHold(); AM.Play("Good2"); //UpdateScore(1); } } break; default: Debug.LogError("Carried part does not one of the missing part enums" + _carriedPart.itemID); break; } } }
private void Awake() { Instance = this; }