private void Update() { if (_targetPosition != transform.position) { transform.position = Vector3.Lerp(transform.position, _targetPosition, Time.deltaTime * 10f); } if (_onShadow) { AddShadowTimeToStaticContainter(Time.deltaTime); _powerBar.LosePower(_powerChangeVelocity * 7.5f); _linkedRoad.PowerSpeedModifier = _powerBar.NormalizedPowerModifier; //Pollution visual Color pollutionColor = _pollution.color; if (pollutionColor.a < 0.75f) { pollutionColor.a += 1.0f * Time.deltaTime; } _pollution.color = pollutionColor; } else { _powerBar.AddPower(_powerChangeVelocity); _linkedRoad.PowerSpeedModifier = _powerBar.NormalizedPowerModifier; //Pollution visual Color pollutionColor = _pollution.color; if (pollutionColor.a > 0.0f) { pollutionColor.a -= 1.0f * Time.deltaTime; } _pollution.color = pollutionColor; } }
public override void AddService() { base.AddService(); power.AddPower(this); power.addLocalPower += DoEffect; power.servicePayment += PayForService; }
/* * When a pickup is gathered, increment stats for the player and game. Play * the sounds needed and charge the player's meters. */ public void CollectPickup(GameObject pickup) { if (pickup.GetComponent <CrystalPickup> () != null) { RGB pickupRGB = pickup.GetComponent <RGB> (); int randSound = Random.Range(0, 2); if (randSound == 1) { audio.PlayOneShot(pickupSound01); } else { audio.PlayOneShot(pickupSound00); } Power powerToCharge = GetPowerForColor(pickupRGB); if (powerToCharge.IsChargedAndReady()) { // Logic for spillover goes here } else { powerToCharge.AddPower(POWER_UNIT); } GameManager.Instance.AddPickupPoints(1); // Add up our money (only if tutorial challenge is over) if (GameManager.Instance.SAVE_TUTORIAL_COMPLETE) { AddMoney(1); } ForgetPickup(pickup); } else if (pickup.CompareTag(Tags.WILDCARD)) { AwardWildcard(); audio.PlayOneShot(wildcardSound); } else { Debug.Log("Player encountered unknown Pickup! Handle this with a new tag on the pickup."); } }