Exemplo n.º 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);
    }
    // Use this for initialization
    void Start()
    {
        //REMOVE ME starting card
        Debug.Log("Remove Me Starting Card Build on new Game");
        GameObject startingCard = Instantiate(removeThisPrefabBuildAtStart);

        DontDestroyOnLoad(startingCard);
        PlayerInfoStatic.PlayerDeck.Add(startingCard);
        GameObject deckParent = GameObject.Find("PlayerDeckHolder");

        startingCard.transform.SetParent(deckParent.transform, false);
        startingCard.SetActive(false);
        // REMOVE ME

        if (planetSpawnerScript == null)
        {
            planetSpawnerScript = planetSpawner.GetComponent <PlanetSpawner>();
        }

        approachPanel.SetActive(false);
        fuelBarDefualtBckColor = backGroundFuelBar.color;
        fuelBar.value          = PlayerInfoStatic.CurrentShipFuel;
        fuelBarText.text       = PlayerInfoStatic.CurrentShipFuel.ToString();
        powerBar.maxValue      = ShipStatsUpgradesStatic.GetShipPowerCapacity();
        powerBar.value         = PlayerInfoStatic.CurrentShipPower;
        powerBarText.text      = PlayerInfoStatic.CurrentShipPower.ToString();
        shipController         = playerShip.GetComponent <ShipController>();
    }
 private void GetCurrentBarValues(string shipName)
 {
     if (shipName == "Partinili")
     {
         fuelBarValue.text         = PlayerInfoStatic.CurrentShipFuel.ToString() + "/" + ShipStatsUpgradesStatic.GetShipFuelCapacity().ToString();
         powerBarValue.text        = PlayerInfoStatic.CurrentShipPower.ToString() + "/" + ShipStatsUpgradesStatic.GetShipPowerCapacity().ToString();
         unitCapacityBarValue.text = PlayerInfoStatic.CurrentShipCapacity.ToString() + "/" + ShipStatsUpgradesStatic.partiniliUnitMaxCapacityMax;
         fuelBar.value             = PlayerInfoStatic.CurrentShipFuel;
         fuelBar.maxValue          = ShipStatsUpgradesStatic.GetShipFuelCapacity();
         powerBar.value            = PlayerInfoStatic.CurrentShipPower;
         powerBar.maxValue         = ShipStatsUpgradesStatic.GetShipPowerCapacity();
         unitCapacityBar.value     = PlayerInfoStatic.CurrentShipCapacity;
         unitCapacityBar.maxValue  = ShipStatsUpgradesStatic.GetShipUnitCapacityMax();
     }
     if (shipName == "Tugarak")
     {
         fuelBarValue.text         = PlayerInfoStatic.CurrentShipFuel.ToString() + "/" + Tugarak.MaxFuel;
         powerBarValue.text        = PlayerInfoStatic.CurrentShipPower.ToString() + "/" + Tugarak.MaxPower;
         unitCapacityBarValue.text = PlayerInfoStatic.CurrentShipCapacity.ToString() + "/" + Tugarak.MaxUnitCapacity;
     }
     if (shipName == "Shupe")
     {
         fuelBarValue.text         = PlayerInfoStatic.CurrentShipFuel.ToString() + "/" + Shupe.MaxFuel;
         powerBarValue.text        = PlayerInfoStatic.CurrentShipPower.ToString() + "/" + Shupe.MaxPower;
         unitCapacityBarValue.text = PlayerInfoStatic.CurrentShipCapacity.ToString() + "/" + Shupe.MaxUnitCapacity;
     }
 }
Exemplo n.º 4
0
    public void UseScanner()
    {
        transform.localScale = GetScannerRange();
        PlayerInfoStatic.CurrentShipPower -= (50 - ShipStatsUpgradesStatic.GetShipScannerCost());

        // stop the ship
        playerShipController.isMoving = false;
        // make the scanner brighter
        Color alpha = scannerSprite.color;

        alpha.a = 100;
        scannerSprite.enabled = true;
        scannerSprite.color   = alpha;

        foreach (GameObject planet in planetSpawnerScript.spawnedPlanets)
        {
            PlanetInformation planetInfo = planet.GetComponent <PlanetInformation>();
            if (planetInfo.GetComponent <SpriteRenderer>().sprite == planetInfo.unknownPlanetScanSprite)
            {
                planetInfo.isScanned = true;
                if (ShipStatsUpgradesStatic.GetShipScannerLevel() == 0)
                {
                    planetInfo.revealInformationCase = "Scan01";
                    planetInfo.PlanetSpriteStateMachine();
                }
                else if (ShipStatsUpgradesStatic.GetShipScannerLevel() == 1)
                {
                    planetInfo.revealInformationCase = "Scan02";
                    planetInfo.PlanetSpriteStateMachine();
                }
                else if (ShipStatsUpgradesStatic.GetShipScannerLevel() == 2)
                {
                    planetInfo.revealInformationCase = "Scan03";
                    planetInfo.PlanetSpriteStateMachine();
                }
                else if (ShipStatsUpgradesStatic.GetShipScannerLevel() == 4)
                {
                    planetInfo.revealInformationCase = "Scan04";
                    planetInfo.PlanetSpriteStateMachine();
                }
                else if (ShipStatsUpgradesStatic.GetShipScannerLevel() == 5)
                {
                    planetInfo.revealInformationCase = "Scan05";
                    planetInfo.PlanetSpriteStateMachine();
                }
            }
        }

        scannerSprite.enabled = false;
    }
    // Update is called once per frame
    void Update()
    {
        if (pauseSpaceScene == true)
        {
            Time.timeScale          = 0;
            shipController.isMoving = false;
        }
        else if (upgradeMenuClosed)
        {
            upgradeMenuClosed       = false;
            Time.timeScale          = 1;
            shipController.isMoving = false;
        }

        creditsPlayerText.text = PlayerInfoStatic.CurrentCredits.ToString();
        xpPlayerText.text      = PlayerInfoStatic.CurrentXP.ToString();

        if (Input.GetMouseButtonDown(0))
        {
            GetClickedPlanetInfo();
        }

        fuelBar.maxValue  = ShipStatsUpgradesStatic.GetShipFuelCapacity();
        powerBarText.text = PlayerInfoStatic.CurrentShipPower.ToString();
        powerBar.value    = PlayerInfoStatic.CurrentShipPower;

        if (shipController.isMoving)
        {
            PlayerInfoStatic.CurrentShipFuel -= 3.3f * Time.deltaTime;
            PlayerInfoStatic.CurrentShipFuel  = (float)System.Math.Round(PlayerInfoStatic.CurrentShipFuel, 2);
            fuelBar.value    = PlayerInfoStatic.CurrentShipFuel;
            fuelBarText.text = PlayerInfoStatic.CurrentShipFuel.ToString();
        }
        else
        {
            fuelBar.value    = PlayerInfoStatic.CurrentShipFuel;
            fuelBarText.text = PlayerInfoStatic.CurrentShipFuel.ToString();
        }

        if (fuelBar.value < 50)
        {
            lerpColor = Color.Lerp(Color.black, Color.red, Mathf.PingPong(Time.time, 0.6f));
            backGroundFuelBar.color = lerpColor;
        }
        else
        {
            backGroundFuelBar.color = fuelBarDefualtBckColor;
        }
    }
    private void MoveShip()
    {
        engine1.enableEmission = true;
        engine2.enableEmission = true;
        var newRotation = Quaternion.LookRotation(transform.position - targetPosition, Vector3.forward);

        newRotation.x = 0.0f;
        newRotation.y = 0.0f;

        transform.rotation = Quaternion.Slerp(transform.rotation, newRotation, Time.deltaTime * 8);
        transform.position = Vector3.MoveTowards(transform.position, targetPosition, ShipStatsUpgradesStatic.GetShipSpeed() * Time.deltaTime);

        float distance = Vector3.Distance(transform.position, targetPosition);

        if (distance <= 0.5f)
        {
            engine1.enableEmission = false;
            engine2.enableEmission = false;
            isMoving = false;
        }
    }
Exemplo n.º 7
0
 // Update is called once per frame
 void Update()
 {
     UpdateResourceMeters();
     playerUnityCapacityText.text = playerBattleManagerScript.spawnedUnitsCapacityCount.ToString() + " / " + ShipStatsUpgradesStatic.GetShipUnitCapacity().ToString();
 }
 private void DisableOrEnableButton()
 {
     if (playerResourceAmountMyResource >= myUnitCost && playerBattleManagerScript.spawnPodCount >= 1 && playerBattleManagerScript.spawnedUnitsCapacityCount < ShipStatsUpgradesStatic.GetShipUnitCapacity())
     {
         myButton.interactable = true;
     }
     else
     {
         myButton.interactable = false;
     }
 }
Exemplo n.º 9
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;
                    }
                }
            }
        }
    }
Exemplo n.º 10
0
 // Update is called once per frame
 void Update()
 {
     scannerCostText.text = (50 - ShipStatsUpgradesStatic.GetShipScannerCost()).ToString();
     scannerCost          = (50 - ShipStatsUpgradesStatic.GetShipScannerCost());
     EnableDisableScannerButton();
 }