public void initPlayerShip(ShipData shipData, StarSystem starSystem) { this.shipData = shipData; this.name = "Player ship"; initInner(); jumpController = GetComponent <GalaxyJumpController>(); setHullType(shipData.hullType); health = shipData.getCurrentHealth(); fullHealth = shipData.hullType.getMaxHealth(); shield = fullShield = shipData.getShield(); armor = shipData.getArmor(); radarRange = shipData.getRadarRange(); initEngine(); initWeapons(); initShield(); initRepair(); jumpController.initJumper(starSystem); controller.init(); }
public GalaxyMap init(GalaxyJumpController jumper) { this.jumper = jumper; galaxy = transform.Find("Galaxy"); galaxy.gameObject.SetActive(true); pos = galaxy.localPosition; Transform bg = galaxy.Find("Background"); Vector3 size = bg.GetComponent <SpriteRenderer>().sprite.bounds.size; scrWidth = Camera.main.ScreenToWorldPoint(new Vector2(Screen.width, Screen.height)).x; scrHeight = Camera.main.ScreenToWorldPoint(new Vector2(Screen.width, Screen.height)).y; diffX = (size.x - scrWidth * 2f) / 2f; diffY = (size.y - scrHeight * 2f) / 2f; aluriaBtn = galaxy.Find("Aluria").GetComponent <Button>().initWithHolder(this); critaBtn = galaxy.Find("Crita").GetComponent <Button>().initWithHolder(this); gameObject.SetActive(false); return(this); }