private BoostPad CreateBoostPad() { GameObject[] BoostPads = GameObject.FindGameObjectsWithTag("Boost"); int Count = 0; foreach (GameObject Boost in BoostPads) { GameObject BPCheck = Boost.transform.gameObject; Count++; } if (Count < 1) { //Invoke("setAliveState", 10); BoostPad BP = Instantiate(BoostPrefab) as BoostPad; //assign name to power-up BP.name = "Boost Pad"; BP.transform.parent = transform; //set the vector 3 position of the power-up BP.transform.localPosition = new Vector3(Random.Range(-0.3f, 0.3f), Random.Range(-0.3f, 0.5f), -2); return(BP); } else { return(null); } }
private void OnTriggerEnter(Collider other) { /* * if (other.CompareTag("BoostPickup")) * { * if (BoostAmount < BoostAmountMax) * { * MasterAudio.PlaySoundAndForget("MenuCancel"); * BoostAmount += other.gameObject.GetComponent<BoostPickups>().BoostToAdd; * * if (BoostAmount > BoostAmountMax) * BoostAmount = BoostAmountMax; * * Destroy(other.gameObject); * } * * } */ if (other.CompareTag("BoostPad")) { BoostPadScript = other.gameObject.GetComponent <BoostPad>(); StartCoroutine(AddPadBoost(BoostPadScript.BoostTime, BoostPadScript.BoostStrength)); } }
private double GetDistancePriority(BoostPad boostPad, ObjectPhysics playerPhysics) { if (boostPad == null) { return(0); } var playerLocation = playerPhysics.Location; var rawDistance = playerLocation.Distance2d(boostPad.Location); var maxDistance = boostPad.IsFullBoost ? MaxFullDistance : MaxNormalDistance; var angleToBoost = Math.Abs(BotMovementHelper.AngleToTarget(playerPhysics, boostPad.Location)); return((1 - (rawDistance / maxDistance)) * (1 - (angleToBoost / (Math.PI / 2)))); }
public FieldInfo(rlbot.flat.FieldInfo fieldInfo) { Goals = new GoalInfo[fieldInfo.GoalsLength]; BoostPads = new BoostPad[fieldInfo.BoostPadsLength]; for (int i = 0; i < fieldInfo.GoalsLength; i++) { Goals[i] = new GoalInfo(fieldInfo.Goals(i).Value); } for (int i = 0; i < fieldInfo.BoostPadsLength; i++) { BoostPads[i] = new BoostPad(fieldInfo.BoostPads(i).Value); } }