private ShipState makeState(Ship ship, Transform transform, Fleet fleet, Vector3 position) { var positionState = new State.AppearablePositionState( appearTransform: transform, position: position, star: fleet.state.positionState.starAt ); var id = GameManager.idMaker.newId(ship); return(new ShipState() { fleetShipIsIn = fleet, icon = AssetSingleton.getBundledDirectory <Sprite>(AssetSingleton.bundleNames.sprites, "star")[0], id = id, stamp = new FactoryStamp(shipTypes.fighter), namedState = new State.NamedState("ship"), positionState = positionState, factionOwnedState = fleet.state.factionOwnedState, stateActionState = new ControlledStateActionState(fleet), destructableState = new State.DestructableState() { hp = 100, onDestroy = () => onDestroy(id, ship, fleet) }, shieldedState = new State.ShieldedState(), weapons = new weapon.Weapon[1] { new weapon.SimpleLaser().init(positionState, new weapon.WeaponDescription() { damage = 10, fireRate = .5f, accuracy = 90, maxDistance = 1000, }) } }); }
public Faction createFaction(string name, long id = -1) { if (!gotSprites) { gotSprites = true; factionSprites = AssetSingleton.getBundledDirectory <Sprite>(AssetSingleton.bundleNames.sprites, "faction"); } var factionHolder = new GameObject(name); factionHolder.transform.SetParent(this.transform); var faction = factionHolder.AddComponent <Faction>(); var factionState = new FactionState() { factionName = name, icon = factionSprites[(factionsI++) % factionSprites.Length] }; faction.init(factionState); factions[faction.name] = faction; if (id == -1) { var maker = GameManager.idMaker; faction.state.id = GameManager.idMaker.newId(faction); } else { faction.state.id = GameManager.idMaker.insertObject(faction, id); } return(faction); }
public void hydrateState(ShipState state, Transform transform, Fleet fleet, Ship ship) { state.icon = AssetSingleton.getBundledDirectory <Sprite>(AssetSingleton.bundleNames.sprites, "star")[0]; state.positionState.appearTransform = transform; state.weapons[0].init(state.positionState, state.weapons[0].weaponDescription); state.destructableState.onDestroy = () => onDestroy(state.id, ship, fleet); }
public void init(FactionState state) { this.state = state; fleetSprite = AssetSingleton.getBundledDirectory <Sprite>(AssetSingleton.bundleNames.sprites, "ui")[1]; finDetailsSprite = AssetSingleton.getBundledDirectory <Sprite>(AssetSingleton.bundleNames.sprites, "ui")[0]; starDetailsSprite = AssetSingleton.getBundledDirectory <Sprite>(AssetSingleton.bundleNames.sprites, "star")[0]; fleetFactory = gameObject.AddComponent <FleetFactory>(); }
public void Start() { starIconSprites = AssetSingleton.getBundledDirectory <Sprite>(AssetSingleton.bundleNames.sprites, "star"); if (starIconSprites == null) { Debug.LogError("failed to load StarIcon Sprites"); } }
public void Awake() { shipPrefabs = AssetSingleton.getBundledDirectory <GameObject>(AssetSingleton.bundleNames.prefabs, "ship"); if (shipPrefabs == null) { Debug.LogError("ship factory ship prefab not found"); } shipIcons = new Sprite[] { AssetSingleton.getBundledDirectory <Sprite>(AssetSingleton.bundleNames.sprites, "fleet")[0] }; if (shipIcons[0] == null) { Debug.LogWarning("ship factory did not find icon"); } }
public void Awake() { shipFactory = gameObject.AddComponent <ShipFactory>(); icon = AssetSingleton.getBundledDirectory <Sprite>(AssetSingleton.bundleNames.sprites, "fleet")[0]; if (icon == null) { Debug.LogWarning("fleet factory did not find icon"); } sceneToPrefab[3] = AssetSingleton.getAsset <GameObject>(AssetSingleton.bundleNames.prefabs, "fleetGO");//.getBundledDirectory<GameObject>(AssetSingleton.bundleNames.prefabs,"ui") if (sceneToPrefab[3] == null) { Debug.LogWarning("fleet factory did not find fleet prefab"); } }
public Faction createFaction(FactionState state) { if (!gotSprites) { gotSprites = true; factionSprites = AssetSingleton.getBundledDirectory <Sprite>(AssetSingleton.bundleNames.sprites, "faction"); } if (state.GetType() == typeof(AIFactionState)) { return(createAIFaction(state.factionName, state.id)); } else { return(createFaction(state.factionName, state.id)); } }
public void Start() { popSprites = AssetSingleton.getBundledDirectory <Sprite>(AssetSingleton.bundleNames.sprites, "pop"); buildingSprites = AssetSingleton.getBundledDirectory <Sprite>(AssetSingleton.bundleNames.sprites, "building"); tileSprites = AssetSingleton.getBundledDirectory <Sprite>(AssetSingleton.bundleNames.sprites, "tile"); }
public void Start() { planetSprites = AssetSingleton.getBundledDirectory <Sprite>(AssetSingleton.bundleNames.sprites, "planet"); }