public void SetShipHead(int val) { switch (val) { case 0: motherShip = eMotherShip.BASIC; break; case 1: motherShip = eMotherShip.FLAMETHROWER; break; case 2: motherShip = eMotherShip.LIGHTNING; break; case 3: motherShip = eMotherShip.HEALING; break; case 4: motherShip = eMotherShip.GUARD_DRONE; break; } PlayerController playerController = GetComponent <PlayerController>(); playerController.SwitchFireMode(motherShip); ShipHeadSprite.sprite = ShipHeadSprites[val]; }
private void LoadData() { motherShip = LoadManager.Instance.saveData.motherShipType; SetShipHead((int)motherShip); headHealth.healthCount = LoadManager.Instance.saveData.PlayerHealth; boostFuelMAX = LoadManager.Instance.saveData.PlayerFuelMax; boostFuel = LoadManager.Instance.saveData.PlayerFuelCurrent; LoadManager.ShipDataSavable[] ships = LoadManager.Instance.saveData.Ships; if (ships != null) { for (int i = 0; i < ships.Length; i++) { if (ships[i].prefabName != null) { GameObject ship = FindBodyPartFromPrefabs(ships[i].prefabName); Turret shipTurret = ship.GetComponent <Turret>(); shipTurret.turretRarity = ships[i].rarity; shipTurret.Initialize(); ship.GetComponent <Health>().healthCount = ships[i].shipHealth; AddBodyPart(ship); } } } foreach (Transform t in bodyPartTransforms) { t.position = LoadManager.Instance.saveData.PlayerPosition.ToVector(); } }