private void FixedUpdate() { if (isAttracted && shipScr.numMinerals < 3) { Vector3 direction = target.position - transform.position; rb.velocity = direction * speed; distance = Vector3.Distance(target.position, transform.position); if (distance <= distanceToTake) { Instantiate(getMineralParticlesPrefab, target); shipScr.numMinerals += 1; shipScr.reactorForce -= reactorModifier; shipScr.vuelta = true; UIScr.SetUIEggs(shipScr.numMinerals); Destroy(gameObject); } } /*if (isAttracted && shipScr.numMinerals >= 3) * { * transform.position = Random.insideUnitCircle * 2; * }*/ }
private void Update() { if (playerLanded && shipScr.vuelta) { uiScr.modify_fuel(.003f); delayToDeployEgg -= Time.deltaTime; if (delayToDeployEgg <= 0 && shipScr.numMinerals > 0) { shipScr.numMinerals -= 1; uiScr.SetUIEggs(shipScr.numMinerals); uiScr.modify_score(1); delayToDeployEgg = oldDelay; } if (shipScr.numMinerals == 0) { animSemaforo.SetBool("Enabled", true); semaforoCounter -= Time.deltaTime; if (semaforoCounter <= 0) { shipScr.enabled = false; ship.parent = destination; anim.SetBool("PlatformUp", true); StartCoroutine(LoadLevel("Lvl_Iteracion")); } } } }