Пример #1
0
    // 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;
        }
    }
Пример #2
0
    private void Awake()
    {
        _fly      = GetComponent <RocketFly>();
        _renderer = GetComponent <SpriteRenderer>();

        GameController.Instance.OnPlayerWin += OnPlayerWin;
    }
Пример #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 = "";
        }
    }
Пример #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;
        }
    }
Пример #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 = "";
        }
    }
Пример #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);
        }
    }
Пример #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;
    }
Пример #8
0
 // Start is called before the first frame update
 void Start()
 {
     boostPanel   = GameObject.FindWithTag("BoostPanel");
     rocket       = GameObject.FindWithTag("Rocket");
     rocketScript = rocket.GetComponent <RocketFly>();
 }
Пример #9
0
 // Start is called before the first frame update
 void Start()
 {
     hyperJumpPanel = GameObject.FindWithTag("HyperJumpPanel");
     rocket         = GameObject.FindWithTag("Rocket");
     rocketScript   = rocket.GetComponent <RocketFly>();
 }
Пример #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>();
 }
Пример #11
0
 // Start is called before the first frame update
 void Start()
 {
     rocket       = transform.parent.parent;
     rocketScript = rocket.GetComponent <RocketFly>();
 }