public void ChangeLevel() { y = y + 1; Vector2 pos = gameObject.transform.position; Quaternion quar = gameObject.transform.rotation; tal.CheckPlayer(); if (y < 6) { Debug.Log(y); Debug.Log(LevelGoes[y]); ps.CreateHero(LevelGoes[y], pos, quar, y, Level, bonusHealth, bonusDamage, BonusHealthRegen, bonusExp, bonusThirst, move.bonusSpeed, move.bonusRotateSpeed, shoot.bonusFireRate, chanceAvoid, Exp, Health / MaxHealth, bonusBlidam); Debug.Log(Health / MaxHealth); } Destroy(gameObject); }
public void CreateHero(GameObject curSship, Vector2 pos, Quaternion rotation, int yPrev, int lvl, float healt, float damage, float regen, float bonusexp, float thirts, float speed, float rotate, float firerate, int chanceAv, float exp, float proc, float blidam) { if (isfirst) { curShip = Instantiate(ship[gameObject.GetComponent <Menu>().id - 1], Vector2.zero, new Quaternion(0, 0, 0, 0)); play = curShip.AddComponent <Player>(); play.LevelGoes = curShip.GetComponent <LevelUpdate>().Level; } else { curShip = Instantiate(curSship, pos, rotation); play = curShip.AddComponent <Player>(); play.LevelGoes = curShip.GetComponent <LevelUpdate>().Level; for (int i = 0; i < spawnmobs.mobs.Count; i++) { spawnmobs.mobs[i].GetComponent <Enemy>().player1 = play; spawnmobs.mobs[i].GetComponent <Enemy>().player = curShip.transform; } } GameObject par = Instantiate(particle, curShip.transform.position, particle.transform.rotation); par.transform.position = new Vector3(par.transform.position.x, par.transform.position.y, -1); play.y = yPrev; play.Level = lvl; isfirst = false; tal.enabled = true; play.MaxHealth = curShip.GetComponent <BlastPoint>().HealthHero; play.Damage = curShip.GetComponent <BlastPoint>().DamageHero; play.MaxHealth += healt; play.Health = play.MaxHealth * proc; Debug.Log(proc); play.Damage += damage; play.chanceAvoid = chanceAv; play.bonusExpi += bonusexp; play.thirtst += thirts; play.bonusHealth += healt; play.blidam += blidam; play.bonusBlidam += blidam; play.bonusDamage += damage; play.HealthRegen = curShip.GetComponent <BlastPoint>().healthRegen; play.HealthRegen += regen; play.BonusHealthRegen += regen; play.bonusExp += bonusexp; play.bonusThirst += thirts; play.Exp = exp; if (curShip.GetComponent <BlastPoint>().ultiActivateLeft != null) { play.ultiActivateLeft = curShip.GetComponent <BlastPoint>().ultiActivateLeft; } if (curShip.GetComponent <BlastPoint>().ultiActivateRight != null) { play.ultiActivateRight = curShip.GetComponent <BlastPoint>().ultiActivateRight; } play.ultiAuraLeft = curShip.GetComponent <BlastPoint>().ultiAuraLeft; play.ultiAuraRight = curShip.GetComponent <BlastPoint>().ultiAuraRight; play.blidam = curShip.GetComponent <BlastPoint>().BliDamage; Shooting shoot = curShip.AddComponent <Shooting>(); shoot.fireRate = curShip.GetComponent <BlastPoint>().fireRate; shoot.firePoint = curShip.GetComponent <BlastPoint>().blastPoint; shoot.fireRate += firerate; shoot.bonusFireRate += firerate; shoot.LaserPrefab = laser; if (tal.isRight) { play.curAura = curShip.GetComponent <BlastPoint>().ultiAuraRight; if (curShip.GetComponent <BlastPoint>().ultiActivateRight != null) { play.ultiActivateRight = curShip.GetComponent <BlastPoint>().ultiActivateRight; } } if (tal.isLeft) { play.curAura = curShip.GetComponent <BlastPoint>().ultiAuraLeft; if (curShip.GetComponent <BlastPoint>().ultiActivateRight != null) { play.ultiActivateRight = curShip.GetComponent <BlastPoint>().ultiActivateLeft; } } Moving move = curShip.AddComponent <Moving>(); move.speed = curShip.GetComponent <BlastPoint>().speedHero; move.rotateSpeed = curShip.GetComponent <BlastPoint>().rotateSpeedHero; move.speed += speed; move.rotateSpeed += rotate; move.bonusSpeed += speed; move.bonusRotateSpeed += rotate; curShip.tag = "Player"; tal.CheckPlayer(); cf.target = curShip.transform; }