Exemplo n.º 1
0
    private void OnTriggerEnter(Collider other)
    {
        switch (other.tag)
        {
        case ("LZ"):
            landingZone = other.GetComponent <LandingZone>();
            return;

        case ("Fuel"):
            AddFuel();
            Destroy(other.gameObject);
            audioManager.PlaySound("PowerUp");
            return;

        case ("Shield"):
            EnableShield();
            Destroy(other.gameObject);
            audioManager.PlaySound("PowerUp");
            return;

        case ("DoublePoints"):
            EnableDoublePoints();
            Destroy(other.gameObject);
            audioManager.PlaySound("PowerUp");
            return;
        }
    }
Exemplo n.º 2
0
 private void OnTriggerExit(Collider other)
 {
     if (other.CompareTag("LZ"))
     {
         landingZone = null;
     }
 }
Exemplo n.º 3
0
    internal void Deliver(Order o, LandingZone z)
    {
        this.DropoffZone = z;
        this.gameObject.SetActive(true);

        StartCoroutine(DropOff(o));
    }
Exemplo n.º 4
0
    public void TryToLand()
    {
        LandingZone zone = FindLandingZone();

        if (!zone)
        {
            return;
        }

        StartCoroutine(Land(zone.GetLandingPosition()));
    }
    public void OnLandingAttempted(bool wasSuccessful, LandingZone landingZone)
    {
        if (wasSuccessful)
        {
            Game.Instance.Mode.OnPlaneLanded();
        }

        foreach (MeshRenderer meshRenderer in GetComponentsInChildren <MeshRenderer>())
        {
            meshRenderer.material.color = wasSuccessful ? Color.green : Color.red;
        }
    }
Exemplo n.º 6
0
 private LandingZone FindLandingZone()
 {
     Collider[] colliders = Physics.OverlapSphere(transform.position, landingRadius);
     foreach (var c in colliders)
     {
         LandingZone zone = c.GetComponent <LandingZone>();
         if (zone)
         {
             return(zone);
         }
     }
     return(null);
 }
Exemplo n.º 7
0
    /// <summary>
    /// Set the LineItems from the order O as arriving now at landing zone Z
    /// </summary>
    /// <param name="o"></param>
    /// <param name="z"></param>
    internal void Deliver(Order o, LandingZone z)
    {
        this.LZ = z;
        this.transform.position = LZ.transform.position + Vector3.up * 2.25f;
        InitBays();

        float minAltitude = LZ.transform.position.y + MinimumAltitude;

        this.Data = new CargoLanderData()
        {
            LZInstanceID   = this.LZ.Data.LZInstanceID,
            Transform      = this.transform,
            Delivery       = o.LineItemUnits,
            BallisticAngle = UnityEngine.Random.Range(0, 360),
            Altitude       = UnityEngine.Random.Range(minAltitude, minAltitude + AltitudeRangeAboveMinimum),
            FromSave       = false //this gets called before Start, so this is a way to signal Start not to re-call Land()
        };
        InitHingePositions();

        Land();
    }
Exemplo n.º 8
0
    void Land()
    {
        float deltaScore = 50;

        if (landingZone != null)
        {
            deltaScore *= landingZone.GetMulti();
            zoneController.DeactivateSpawn(landingZone.gameObject);
            zoneController.AddZones(1);
            landingZone = null;
            audioManager.PlaySound("SuccessfulLanding");
        }

        if (doublePoints)
        {
            deltaScore *= 2;
        }

        score += deltaScore;

        grounded = true;

        gameController.InvokeRespawn(this, false);
    }
 void OnEnable()
 {
     this.landingZone = (LandingZone)this.target;
 }
Exemplo n.º 10
0
 void Awake()
 {
     Instance = this;
 }