Пример #1
0
    private Vector3 GetScannerRange()
    {
        if (ShipStatsUpgradesStatic.GetShipScannerRange() == 0)
        {
            scannerRange = new Vector3(3f, 3f, 1f);
        }
        else if (ShipStatsUpgradesStatic.GetShipScannerRange() == 1)
        {
            scannerRange = new Vector3(4f, 4f, 1f);
        }
        else if (ShipStatsUpgradesStatic.GetShipScannerRange() == 2)
        {
            scannerRange = new Vector3(5f, 5f, 1f);
        }
        else if (ShipStatsUpgradesStatic.GetShipScannerRange() == 3)
        {
            scannerRange = new Vector3(6f, 6f, 1f);
        }
        else if (ShipStatsUpgradesStatic.GetShipScannerRange() == 4)
        {
            scannerRange = new Vector3(7f, 7f, 1f);
        }
        else
        {
            scannerRange = new Vector3(3f, 3f, 1f);
            Debug.Log("Scanner range not working");
        }

        return(scannerRange);
    }
Пример #2
0
    private void GetPossiblePlanetsToScan(string enterOrExit)
    {
        if (enterOrExit == "enter")
        {
            foreach (GameObject planet in planetSpawnerScript.spawnedPlanets)
            {
                PlanetInformation planetInfo = planet.GetComponent <PlanetInformation>();

                float distance = Vector3.Distance(planet.transform.position, playerShip.transform.position);
                // if the planet is in range and is not already scanned
                if (!planetInfo.planetComplete && planetInfo.planetName != "Home Planet")
                {
                    if (ShipStatsUpgradesStatic.GetShipScannerRange() == 0)
                    {
                        if (distance <= 8f)
                        {
                            planetInfo.GetComponent <SpriteRenderer>().sprite = planetInfo.unknownPlanetScanSprite;
                        }
                    }
                    else if (ShipStatsUpgradesStatic.GetShipScannerRange() == 1)
                    {
                        if (distance <= 10f)
                        {
                            planetInfo.GetComponent <SpriteRenderer>().sprite = planetInfo.unknownPlanetScanSprite;
                        }
                    }
                    else if (ShipStatsUpgradesStatic.GetShipScannerRange() == 2)
                    {
                        if (distance <= 12f)
                        {
                            planetInfo.GetComponent <SpriteRenderer>().sprite = planetInfo.unknownPlanetScanSprite;
                        }
                    }
                    else if (ShipStatsUpgradesStatic.GetShipScannerRange() == 3)
                    {
                        if (distance <= 14f)
                        {
                            planetInfo.GetComponent <SpriteRenderer>().sprite = planetInfo.unknownPlanetScanSprite;
                        }
                    }
                    else if (ShipStatsUpgradesStatic.GetShipScannerRange() == 4)
                    {
                        if (distance <= 16f)
                        {
                            planetInfo.GetComponent <SpriteRenderer>().sprite = planetInfo.unknownPlanetScanSprite;
                        }
                    }
                }
            }
        }
        else
        {
            foreach (GameObject planet in planetSpawnerScript.spawnedPlanets)
            {
                PlanetInformation planetInfo = planet.GetComponent <PlanetInformation>();

                // if the planet is in range and is not already scanned
                if (planetInfo.GetComponent <SpriteRenderer>().sprite == planetInfo.unknownPlanetScanSprite)
                {
                    if (planetInfo.isScanned || planetInfo.planetProximityScan)
                    {
                        planetInfo.GetComponent <SpriteRenderer>().sprite = planetInfo.planetSprite;
                    }
                    else
                    {
                        planetInfo.GetComponent <SpriteRenderer>().sprite = planetInfo.unknownPlanetSprite;
                    }
                }
            }
        }
    }