public void CmdInit(Faction faction, string source) { owner = faction; ShipSO p_ = ShipSO.shipTypes[source]; health = p_.health; shield = 0; secondaryAmount = p_.maxSecondary; RpcInit(faction, source); target.label = p_.label; target.owner = owner; }
public void RpcInit(Faction faction, string source) { prototype = ShipSO.shipTypes[source]; detail.sprite = prototype.detail; overlay.sprite = prototype.overlay; color.sprite = prototype.color; color.color = GameManager.instance.colorPallete[faction.bgColor]; focus.canFire = prototype.hasWeapon; focus.canSecondary = prototype.secondaryType >= 0; prototype.SpawnEntities(transform, this); entities = GetComponentsInChildren <ShipEntity>(); this.enabled = true; }
public override void OnInspectorGUI() { DrawDefaultInspector(); ShipSO so = (ShipSO)target; if (Application.isPlaying) { if (GUILayout.Button("Spawn at camera")) { so.Spawn(GameManager.instance.player.faction, Vector3.Scale(GameManager.instance.cam.transform.position, new Vector3(1, 1, 0))); } } GUILayout.BeginVertical("box"); GUILayout.Label("Registered ships"); foreach (KeyValuePair <string, ShipSO> kv in shipTypes) { GUILayout.Label("- " + kv.Key); } GUILayout.EndVertical(); }