public void Launch() { RocketTrail.SetActive(true); startPos = this.transform.position; endPos = this.transform.position + new Vector3(0, 70f, 0); startTime = Time.time; len = Vector3.Distance(startPos, endPos); activate = true; this.transform.parent = null; float maxDistance = 1000000; foreach (GameObject o in PlayerManager.ins.playersInScene) { if (o.name != whoFired.name) { float d = Vector3.Distance(this.transform.position, o.transform.position); if (d < maxDistance) { maxDistance = d; target = o; } } } }
private void Awake() { rb = GetComponent <Rigidbody>(); rocketTrail = GetComponent <RocketTrail>(); slowMotionController = GetComponent <SlowMotionController>(); progressManager = FindObjectOfType <ProgressManager>(); GameManager.ChangeModeEvent += ChangeMode; rocketT = GetComponent <Transform>(); playerT = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); //Выстраивание рокеты в мировом пространстве rocketSpawner = RocketSpawner.Instatnce; }
// Use this for initialization void Awake() { rocketTrail = transform.Find("RocketTrail").GetComponent<RocketTrail>(); currentFuel = totalFuel; targetTilt = 0; }