private void Start() { if (Hub == null) { if (HubShip.S) { Hub = HubShip.S.gameObject; } else if (transform.root.gameObject.scene.buildIndex == 1) { Transform spawn = transform; Vector3 pos = spawn.position; spawn.position = new Vector3(pos.x, pos.y, 0); Hub = Instantiate <GameObject>(hubPrefab, spawn.position, Quaternion.identity); Hub.transform.SetParent(PLAYERS, true); HubShip hubScript = Hub.GetComponent <HubShip>(); hubScript.ResetWeapons(); for (int i = 0; i < hubScript.weapons.Length; i++) { hubScript.weapons[i].type = WeaponType.blaster; } } } if (Hero == null) { if (HeroShip.S) { Hero = HeroShip.S.gameObject; } else if (transform.root.gameObject.scene.buildIndex == 1) { Transform spawn = transform; Vector3 pos = spawn.position; spawn.position = new Vector3(pos.x, pos.y, 0); Hero = Instantiate <GameObject>(heroPrefab, spawn.position, Quaternion.identity); Hero.transform.SetParent(PLAYERS, true); HeroShip heroScript = Hero.GetComponent <HeroShip>(); heroScript.ResetWeapons(); heroScript.weapons[0].type = WeaponType.spread; /*for (int i = 0; i < heroScript.weapons.Length; i++) * { * heroScript.weapons[i].type = WeaponType.blaster; * }*/ } } //Spawn Asteroids for (int point = 0; point < Spawner.spawnPoints.Length; point++) { Instantiate(prefabAsteroid, Spawner.spawnPoints[point].position, Quaternion.identity); } //Invoke("SpawnEnemy", 1f / enemySpawnPerSecond); }
void Start() { heroAge = Time.time; heroShip = gameObject.GetComponent <HeroShip> (); heroMovement = gameObject.GetComponent <HeroMovement> (); system = MasterScript.RefreshCurrentSystem(heroLocation); movementSpeed = 1; currentHealth = 100; }
protected override void LoadContent() { ///Singleton _assetHandler = AssetHandler.GetInstance(); ///Monogame Loading Content _spriteBatch = new SpriteBatch(GraphicsDevice); ///Game Assets _background = new Background(this, "Images/back", 800, 480); _heroShip = new HeroShip(this, "Images/white_ship", 50, 50, 400, 400, 100, 100, 8); //créer une fabrique _enemyShip = new EnemyShip(this, "Images/enemy_ship", 50, 50, 400, 50, 50, 0, 5); }
void Start() { S = this; Hub = Main.S.Hub; if (transform.root.gameObject.scene.name == "_Scene_0") { ResetWeapons(); } rb = GetComponent <Rigidbody>(); if (Hub) { transform.position = Hub.transform.position + transform.right * distFromHub; } }
public void HeroEndTurnFunctions(TurnInfo thisPlayer) { heroShip = gameObject.GetComponent <HeroShip> (); heroShip.ShipAbilities(thisPlayer); if (thisPlayer.isPlayer == false) { AIHeroFunctions(); } if (thisPlayer == MasterScript.playerTurnScript) { if (isInvading == true) { MasterScript.systemInvasion.hero = this; if (currentHealth < 0f) { currentHealth = 0f; } if (currentHealth > maxHealth) { currentHealth = maxHealth; } } if (isInvading == false && currentHealth != maxHealth) { currentHealth += maxHealth * 0.02f; if (currentHealth > maxHealth) { currentHealth = maxHealth; } } } }