void Awake() { fireArrival = 0; player = GameObject.FindGameObjectWithTag(TagManager.PLAYER); respawn = GameObject.FindGameObjectWithTag(TagManager.GAME_CONTROLLER).GetComponent<Respawn>(); gameMenu = GameObject.FindGameObjectWithTag(TagManager.GAME_CONTROLLER).GetComponent<GameMenu>(); }
void Awake() { wasPlayed = false; player = GameObject.FindGameObjectWithTag(TagManager.PLAYER); respawn = GameObject.FindGameObjectWithTag(TagManager.GAME_CONTROLLER).GetComponent<Respawn>(); gameMenu = GameObject.FindGameObjectWithTag(TagManager.GAME_CONTROLLER).GetComponent<GameMenu>(); }
void Start() { spikeSpawn = FindObjectOfType<SpikeSpawn>(); respawn = FindObjectOfType<Respawn> (); currentHealth = maxHealth; InvokeRepeating("decreseHealth", 1f, 1f); }
public override void Start () { GameObject respawnPoint = GameObject.FindGameObjectWithTag("Respawn"); respawn = respawnPoint.GetComponent<Respawn> (); base.Start (); collisions.facingDir = 1; }
void Awake () { _spriteRenderers = GetComponentsInChildren<SpriteRenderer> (); _rigidbody2D = GetComponent<Rigidbody2D> (); _transform = transform; _respawn = GetComponent<Respawn> (); _movement = GetComponent<BasicPlayerMovementScript> (); }
public void Setup() { movement = instance.GetComponent <Movement>(); shooting = instance.GetComponent <Shoot>(); respawn = instance.GetComponent <Respawn>(); movement.playerNum = playerNum; shooting.playerNum = playerNum; respawn.spawnPoint = spawnPoint; }
void Start() { respawn = GetComponent <Respawn>(); MovementStart(); backWheel.ConfigureVehicleSubsteps(1, 12, 15); frontWheel.ConfigureVehicleSubsteps(1, 12, 15); rb.centerOfMass = centerOfMass; IdleMode = true; }
private static IEnumerator RespawnCoroutine(Respawn respawn) { float timePassed = (float)DayNightCycle.main.timePassed; float waitTime = (float)System.Math.Round(respawn.spawnTime - timePassed); yield return(new WaitForSecondsRealtime(waitTime)); respawn.Spawn(); UnityEngine.Object.Destroy(respawn.gameObject); }
void Start() { respawn = GameObject.FindWithTag("Player").GetComponent <Respawn>(); deathScore = GameObject.FindWithTag("ScoreText").GetComponent <TMPro.TextMeshProUGUI>(); odometer = GameObject.FindWithTag("ScoreCanvas").GetComponent <Odometer>(); PlayerPrefs.SetFloat("HighScore", 0f); }
public void Damage(int damageCount) { hp -= damageCount; if (hp <= 0) { Respawn res = gameObject.GetComponent <Respawn>(); res.dead(); } }
private void Start() { characterController = GetComponent <CharacterController>(); respawn = GetComponent <Respawn>(); pauseCanvas.enabled = false; Time.timeScale = 1.0f; isLoading = false; Cursor.visible = false; }
private void RespawnAllCars() { for (int carIndex = 0; carIndex < popSize; carIndex++) { GameObject carS = carSpecies[carIndex]; Respawn r = carS.GetComponent <Respawn>(); Car2DController c2Dc = carS.GetComponent <Car2DController>(); //float distanceFitness = Mathf.Pow(1.1f, c2Dc.TravelledDistance) + Mathf.Pow(1.1f, Vector2.Distance(rbCar[carIndex].position, r.respawnPoint.position)); float distanceFitness = c2Dc.TravelledDistance + Vector2.Distance(rbCar[carIndex].position, r.respawnPoint.position); population.Members[carIndex].Fitness += distanceFitness; if (!r.isAlive && level.penalizeDeath) { //double timeFactor = c2Dc.TimeAlive / (1.05 * level.MaxTime); //population.Members[carIndex].Fitness *= timeFactor; //double timeFactor = Functions.Map(c2Dc.TimeAlive, 0, level.MaxTime, 0.9, 0.95); //population.Members[carIndex].Fitness *= timeFactor; //double linearCoefficientOfTime = Functions.Line(c2Dc.TimeAlive, 10.0 / level.MaxTime, -5.0); //double constraintlinearCoefficientOfTime = Functions.Logistic(linearCoefficientOfTime); //population.Members[carIndex].Fitness *= constraintlinearCoefficientOfTime; population.Members[carIndex].Fitness *= TimeEffectWithRespectToCurrentGeneration(c2Dc.TimeAlive, population.CurrentGeneration, level.MaxTime, level.thresholdGeneration, level.timeMattersAtTheBeginning, level.lessTimeIsBetter); //Currently works! //double sensorCoefficient = 1 / c2Dc.CumulativeSensoryData; } //Debug.Log(population.Members[carIndex].Fitness + " of car #" + carIndex.ToString()); carS.GetComponent <SpriteRenderer>().color = new Color32(255, 255, 255, 255); r.RespawnCar(); } bestCar.GetComponent <Respawn>().RespawnCar(); bestCar.GetComponent <SpriteRenderer>().color = new Color32(0, 255, 0, 255); carsHaveRespawned = true; population.SortSpeciesByFitness(); population.NormalizeFitness(); population.FilterByPerformance(); double bestFitness = population.ToBreed(); // make mutation rate dynamic guiManager.startTime = Time.time; guiManager.numOfGenerations = population.CurrentGeneration; guiManager.bestFitness = bestFitness; elapsedTime = 0.0f; AssignBrains(); //Every 50 generation saves progress if (level.ToggleFileIO) { if (population.CurrentGeneration % 50 == 0) { SaveBestBrain("bestBrain.txt", population.BestMember); SavePopulationToFile("population.bin"); } Debug.Log(bestFitness); } }
void Awake() { respawn = GameObject.FindGameObjectWithTag(TagManager.GAME_CONTROLLER).GetComponent<Respawn>(); dying = false; respawning = false; currentColor = Color.black; screenRect = new Rect(0f, 0f, Screen.width, Screen.height); player = GameObject.FindGameObjectWithTag(TagManager.PLAYER); money = player.GetComponent<MoneyManagement>(); loadGame = GameObject.FindGameObjectWithTag(TagManager.GAME_CONTROLLER).GetComponent<LoadGameSettings>(); }
public void Reset() { Level.Rotation = Vector3.Zero; Translation = Level.GetNode <Spatial>("SpawnPoint").GlobalTransform.origin; ShouldKill = false; velocity = Vector3.Zero; Respawn?.Invoke(); RotationDir = 1; Visible = true; CalibrateCamera?.Invoke(); }
public override void OnInspectorGUI() { DrawDefaultInspector(); Respawn respawnScript = (Respawn)target; if (GUILayout.Button("Respawn player")) { respawnScript.RespawnPlayer(); } }
void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.tag == "Bala") { vidaE -= bala; if (vidaE <= 0) { Freno(); Destroy(gameObject, 4f); if (spa == 1) { spa = 0; fueg.SetActive(true); yorb.isKinematic = true; SpawnCenter discon = GameObject.FindGameObjectWithTag("Spawn").GetComponent <SpawnCenter> (); discon.enmMax += 1; discon.enmRest -= 1; GameObject.FindGameObjectWithTag("Spawn").SendMessage("Spawn"); Respawn ben = GameObject.FindGameObjectWithTag("Spawn").GetComponent <Respawn> (); ben.puntaje += beneficio; GameObject.FindGameObjectWithTag("Spawn").SendMessage("Puntos"); } } } else if (other.gameObject.tag == "Player") { } else if (other.gameObject.tag == "Explosivo" || other.gameObject.tag == "ExploEnm") { vidaE -= explo; if (vidaE <= 0) { Freno(); Destroy(gameObject, 4f); if (spa == 1) { spa = 0; fueg.SetActive(true); yorb.isKinematic = true; SpawnCenter discon = GameObject.FindGameObjectWithTag("Spawn").GetComponent <SpawnCenter> (); discon.enmMax += 1; discon.enmRest -= 1; GameObject.FindGameObjectWithTag("Spawn").SendMessage("Spawn"); Respawn ben = GameObject.FindGameObjectWithTag("Spawn").GetComponent <Respawn> (); ben.puntaje += beneficio; GameObject.FindGameObjectWithTag("Spawn").SendMessage("Puntos"); } } } else { ranDireccion(); } }
private void Start() { instance = this; if (isLocalPlayer) { spawnPoints = FindObjectsOfType <NetworkStartPosition>(); } spawnPointIndex = Random.Range(0, spawnPoints.Length - 1); }
// Start is called before the first frame update void Start() { //Calls on the component RigidBody rb = GetComponent <Rigidbody2D>(); bc = GetComponent <BoxCollider2D>(); facingRight = true; nextdashtime = 0; AudioObj = GameObject.FindObjectOfType <PlayerAudio>(); RespawnObj = GameObject.FindObjectOfType <Respawn>(); EnemyHealthObj = GameObject.FindObjectOfType <EnemyHealth>(); }
void RespawnPlayer() { player.ResetPlayer(); Respawn playerRespawn = player.GetComponent <Respawn>(); if (playerRespawn) { playerRespawn.RespawnObject(); Debug.Log("Respawning player!"); } }
void Start () { controller = GetComponent<P2Controller2D>(); GameObject respawnPoint = GameObject.FindGameObjectWithTag("Respawn"); respawn = respawnPoint.GetComponent<Respawn> (); gravity = -(2 * JumpHeight) / Mathf.Pow (timeToJumpApex, 2); jumpVelocity = Mathf.Abs (gravity) * timeToJumpApex; gameObject.name = "Player2"; }
private void OnTriggerEnter2D(Collider2D other) { //if (other.tag == "Player") { //Destroy(other.gameObject); //} // Respawn.respawn(); Transform respTrasform = FindObjectOfType <Respawn>().transform; // other.gameObject.transform.position = respTrasform.position; Respawn.respawn(other.gameObject.transform, respTrasform); }
private void Start() { playerS = FindObjectOfType <PlayerMove>(); player = GameObject.FindGameObjectWithTag("Player").transform; anim = GetComponent <Animator>(); nav = GetComponent <NavMeshAgent>(); resetEnemys = FindObjectOfType <Respawn>(); Ndis = GameObject.Find("Ndistancia").GetComponent <Text>(); colliderS = GetComponent <SphereCollider>(); numEnemigos = FindObjectOfType <SpawnEnemigos>(); }
void Start() { if (!(respawn = GetComponent <Respawn>())) { Debug.LogError("Unable to set up respawn script"); } if (!(health = GetComponent <Health>())) { Debug.LogError("Unable to get health script"); } }
internal static void PostFix(Respawn __instance) { if (DayNightCycle.main.timePassed >= (double)__instance.spawnTime) // if this is true respawn would have already happened in method { return; } if (Settings.instance.leviathansRespawn && !__instance.techType.IsLeviathan()) { CoroutineHost.StartCoroutine(RespawnCoroutine(__instance)); } }
// Start is called before the first frame update void Start() { myRb = GetComponent <Rigidbody>(); myController = GetComponent <AdvancedWalkerController>(); myCollider = GetComponent <CapsuleCollider>(); myRespawnPoint = GetComponent <Respawn>(); myCollider.height = 1.5f; myCollider.center = centerCaps; }
void ResetPlayerPosition() { float x = (game.World.Width / 2) + 0.5f; float z = (game.World.Length / 2) + 0.5f; Vector3 spawn = Respawn.FindSpawnPosition(game, x, z, game.LocalPlayer.Size); LocationUpdate update = LocationUpdate.MakePosAndOri(spawn, 0, 0, false); game.LocalPlayer.SetLocation(update, false); game.LocalPlayer.Spawn = spawn; game.CurrentCameraPos = game.Camera.GetPosition(0); }
private void OnTriggerEnter(Collider other) { if (other.tag == "ball") { scoresManager.UpdateScore(pad); Respawn ball = other.GetComponent <Respawn>(); if (ball != null) { ball.ResetBall(); } } }
static void Prefix(Respawn __instance, ref bool ____canPress) { if (Main.enabled && Main.settings.respawnNearBail && ____canPress) { Coroutine doBailTmpCoroutine = __instance.GetExtensionComponent().DoBailTmpCoroutine; if (doBailTmpCoroutine != null) { ((MonoBehaviour)PlayerController.Instance).StopCoroutine(doBailTmpCoroutine); } } }
// Use this for initialization void Start() { respawn = GetComponent <Respawn>(); gameManager = FindObjectOfType <GameManager>(); spriteRenderer = GetComponent <SpriteRenderer>(); gameManager.addEnemy(this); StartCoroutine(Fire()); defaultColor = spriteRenderer.material.color; }
void InitialiseRespawn() { const int defaultRespawnNode = -1; respawn = GetComponent <Respawn>();; waypointNodeID = defaultRespawnNode; respawn.AddLastToRespawnAction(() => { Go(0); }); respawn.AddLastToRespawnAction(() => { Stop(breakForce); }); respawn.AddLastToRespawnAction(pid.ResetValues); respawn.AddLastToRespawnAction(() => { respawn.respawnNode = waypointNodeID - 1; }); respawn.AddLastToRespawnAction(() => { timeAlive = 0; StartCoroutine(SetIdleOnATimer(2f)); }); respawn.AddLastToRespawnAction(() => { respawn.RespawnObject(GetNextWayPoint(0), (GetNextWayPoint(0 + 1) - GetNextWayPoint(0)).normalized); }); }
private void Start() { Respawn respawnScript = FindObjectOfType <Respawn>(); if (respawnScript) { respawnScript.respawns.Add(this); } else { Destroy(this); } }
// Start is called before the first frame update void Start() { player = GameObject.Find("Player"); isGrounded = GetComponent <IsGrounded>(); respawn = player.GetComponent <Respawn>(); progress = player.GetComponent <Progress>(); logger = GameObject.Find("Telemetry").GetComponent <Logger>(); sfx = GameObject.Find("SFX").GetComponent <SFXScript>(); hud = GameObject.Find("HUD"); }
private void Start() { numEnemigos = FindObjectOfType <SpawnEnemigos>(); playerS = FindObjectOfType <PlayerMove>(); player = GameObject.FindGameObjectWithTag("Player").transform; anim = GetComponent <Animator>(); colliderS = GetComponent <SphereCollider>(); nav = GetComponent <NavMeshAgent>(); healthBar = FindObjectOfType <HealthBar>(); resetEnemys = FindObjectOfType <Respawn>(); Nmele = GameObject.Find("Nmele").GetComponent <Text>(); aguaM = FindObjectOfType <AguaMagica>(); }
private void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.tag == "Player") { SpriteRenderer sr = other.gameObject.GetComponent <SpriteRenderer>(); if (sr.color != ColorsManager.Instance.colors[color]) { Transform respTrasform = FindObjectOfType <Respawn>().transform; Respawn.respawn(other.gameObject.transform, respTrasform); //Debug.Log(color + " " + sr.color); } } }
void OnTriggerEnter(Collider other) { if (other.gameObject.name.Contains("Skater")) { Respawn r = PlayerController.Instance.respawn; // Break the pointer reference Vector3 playerOffset = r.getSpawn[0].position - r.getSpawn[1].position - new Vector3(0.0f, 0.08f, 0.0f); this._pinPos = new Vector3(r.pin.position.x, r.pin.position.y, r.pin.position.z); this._pinQuat = new Quaternion(r.pin.rotation.x, r.pin.rotation.y, r.pin.rotation.z, r.pin.rotation.w); r.SetSpawnPos(this._destination.position - playerOffset, this._destination.rotation); r.DoRespawn(); r.SetSpawnPos(this._pinPos - playerOffset, this._pinQuat); } }
void Start() { SFX = GetComponent <AudioSource> (); spawner = GetComponent <Respawn> (); rb = GetComponent <Rigidbody>(); hp = GetComponent <HealthHandler>(); ray = GetComponent <RayCast>(); facingRight = true; facingLeft = false; canMove = true; //canJump = isGrounded(); speed = 10f + PlayerPrefs.GetInt("dex"); wantsJump = false; }
private void Update() { isRespawning = false; movement.z = Input.GetAxis(Axes.Vertical) * forceSpeed.z; movement.x = Input.GetAxis(Axes.Horizontal) * forceSpeed.x; if (Input.GetButton(Axes.Jump)) { doJump = true; } if (Input.GetKeyDown(KeyCode.R)) { Respawn.DoRespawn(respawn); } }
private void findPlayers() { GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); if (players.Length > 0) { player1 = players[0].GetComponent<Respawn>(); if (players.Length > 1) player2 = players[1].GetComponent<Respawn>(); playersFound = true; return; } /*GameObject p = GameObject.FindGameObjectWithTag("Player"); if (playersFound != null) { player1 = players[0].GetComponent<Respawn>(); return; }*/ Debug.Log("No GO with tag \"Player\""); playersFound = false; }
public void Respawn(Respawn rpc) { hp = hpMax; SwitchWorld("Town"); }