// 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; } }
private void Awake() { _fly = GetComponent <RocketFly>(); _renderer = GetComponent <SpriteRenderer>(); GameController.Instance.OnPlayerWin += OnPlayerWin; }
// 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 = ""; } }
void LevelTwoFuel(RocketFly rocketScript) { switch (Random.Range(0, 5)) { case 0: rocketScript.Invoke("HyperJump", 0f); break; case 1: rocketScript.Invoke("Shield", 0f); break; } }
// 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 = ""; } }
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); } }
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; }
// Start is called before the first frame update void Start() { boostPanel = GameObject.FindWithTag("BoostPanel"); rocket = GameObject.FindWithTag("Rocket"); rocketScript = rocket.GetComponent <RocketFly>(); }
// Start is called before the first frame update void Start() { hyperJumpPanel = GameObject.FindWithTag("HyperJumpPanel"); rocket = GameObject.FindWithTag("Rocket"); rocketScript = rocket.GetComponent <RocketFly>(); }
// Start is called before the first frame update void Start() { rocket = GameObject.FindWithTag("Rocket"); size = GetComponent <Collider>().bounds.size; rocketScript = rocket.GetComponent <RocketFly>(); }
// Start is called before the first frame update void Start() { rocket = transform.parent.parent; rocketScript = rocket.GetComponent <RocketFly>(); }