// Update is called once per frame
    void Update()
    {
        if (rocket == null)
        {
            rocket        = GameObject.FindWithTag("Rocket");
            rocketScript  = rocket.GetComponent <RocketFly>();
            light         = rocketScript.flashlight.GetComponent <Light>();
            commonResTime = rocketScript.flashlightTime * rocketScript.resourceTime;
        }
        else
        {
            fillArea = rocketScript.lightPower;
        }

        image.fillAmount = fillArea;

        if (isActive)
        {
            statusText.text = "on";
        }
        else
        {
            statusText.text = "off";
        }

        if (fillArea <= 1f && fillArea >= 0.25f)
        {
            light.intensity = fillArea;
        }
    }
Esempio n. 2
0
    private void Awake()
    {
        _fly      = GetComponent <RocketFly>();
        _renderer = GetComponent <SpriteRenderer>();

        GameController.Instance.OnPlayerWin += OnPlayerWin;
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        image.fillAmount = fillArea;

        if (rocket == null)
        {
            rocket        = GameObject.FindWithTag("Rocket");
            rocketScript  = rocket.GetComponent <RocketFly>();
            commonResTime = rocketScript.boostTime * rocketScript.resourceTime;
        }

        if (fillArea >= 1f)
        {
            curTime   = 0;
            fillArea -= 1f;
            if (!isActive)
            {
                isActive = true;
                timeImage.gameObject.SetActive(true);
                StartCoroutine("ResourceTimeCoroutine");
            }
            timeImage.GetComponent <Image>().fillAmount = 1;
        }
        else
        {
            countText.text = "";
        }
    }
Esempio n. 4
0
    void LevelTwoFuel(RocketFly rocketScript)
    {
        switch (Random.Range(0, 5))
        {
        case 0:
            rocketScript.Invoke("HyperJump", 0f);
            break;

        case 1:
            rocketScript.Invoke("Shield", 0f);
            break;
        }
    }
Esempio n. 5
0
    // Update is called once per frame
    void Update()
    {
        image.fillAmount = fillArea;

        if (rocket == null)
        {
            rocket        = GameObject.FindWithTag("Rocket");
            rocketScript  = rocket.GetComponent <RocketFly>();
            commonResTime = rocketScript.freezeTime * rocketScript.resourceTime;
        }

        if (fillArea >= 1f)
        {
            countText.text = Mathf.FloorToInt(fillArea).ToString();
        }
        else
        {
            countText.text = "";
        }
    }
Esempio n. 6
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "Rocket")
        {
            RocketFly rocketScript = other.GetComponent <RocketFly>();
            if (rocketScript.fuel + value > 1f)
            {
                StartCoroutine(rocketScript.AddFuel(1 - rocketScript.fuel));
            }
            //rocketScript.fuel = 1f;
            else
            {
                StartCoroutine(rocketScript.AddFuel(value));
            }
            //rocketScript.fuel += value;

            rocketScript.countOfFuel++;
            Destroy(gameObject);
        }
    }
Esempio n. 7
0
    public void SetRocketSettings()
    {
        string path;

#if UNITY_ANDROID && !UNITY_EDITOR
        path = Path.Combine(Application.persistentDataPath, "settings.JSON");
#else
        path = Path.Combine(Application.dataPath, "settings.JSON");
#endif
        TuningSaver ts = new TuningSaver();
        if (File.Exists(path))
        {
            string[] fileLinesArr = File.ReadAllLines(path);
            int      indexCurLine = Array.FindIndex(fileLinesArr, str => str.Contains(rocketName));
            ts = JsonUtility.FromJson <TuningSaver>(fileLinesArr[indexCurLine]);
        }
        RocketFly rocketScript = rocket.GetComponent <RocketFly>();
        rocketScript.speed                = ts.speed;
        rocketScript.control              = ts.control;
        rocketScript.resourceTime         = ts.resourceTime;
        rocketScript.fuelConsumptionSpeed = ts.fuelConsumptionSpeed;
    }
Esempio n. 8
0
 // Start is called before the first frame update
 void Start()
 {
     boostPanel   = GameObject.FindWithTag("BoostPanel");
     rocket       = GameObject.FindWithTag("Rocket");
     rocketScript = rocket.GetComponent <RocketFly>();
 }
Esempio n. 9
0
 // Start is called before the first frame update
 void Start()
 {
     hyperJumpPanel = GameObject.FindWithTag("HyperJumpPanel");
     rocket         = GameObject.FindWithTag("Rocket");
     rocketScript   = rocket.GetComponent <RocketFly>();
 }
Esempio n. 10
0
 // Start is called before the first frame update
 void Start()
 {
     rocket       = GameObject.FindWithTag("Rocket");
     size         = GetComponent <Collider>().bounds.size;
     rocketScript = rocket.GetComponent <RocketFly>();
 }
Esempio n. 11
0
 // Start is called before the first frame update
 void Start()
 {
     rocket       = transform.parent.parent;
     rocketScript = rocket.GetComponent <RocketFly>();
 }