public bool SpawnUserDrone(ResourceSet resourceCost, DroneStatSet droneStats) { if (!CanPrintDrone(resourceCost)) { return(false); } GameMgr.inst.Resources.Iron -= resourceCost.Iron; GameMgr.inst.Resources.Copper -= resourceCost.Copper; GameMgr.inst.Resources.Uranium -= resourceCost.Uranium; Vector3 offset = new Vector3(Random.Range(-10.0f, 10.0f), Random.Range(-10.0f, 10.0f), Random.Range(-10.0f, 10.0f)); Vector3 position = userDroneSpawn.transform.position + offset; GameObject go = Instantiate(userDronePrefab, position, userDroneSpawn.transform.rotation); go.GetComponent <DroneBase>().SetDroneStats(droneStats); go.GetComponent <UserDrone>().SetDroneHome(homeSite); // Drone type 1 is a dedicated Miner if (droneStats.Power == 0.0f) { go.GetComponent <UserDrone>().SetDroneType(DroneType.Miner); } // Drone type 2 is a dedicated Combat Unit if (droneStats.Storage == 0.0f) { go.GetComponent <UserDrone>().SetDroneType(DroneType.Combat); } return(true); }
public void SetDroneStats(DroneStatSet stats) { droneStats.Power = stats.Power; droneStats.Health = stats.Health; droneStats.Storage = stats.Storage; droneStats.Fuel = stats.Fuel; currentStats.Health = stats.Health; currentStats.Power = stats.Power; statsFilled = true; }
private void Start() { GameObject[] parts = Resources.LoadAll <GameObject>("Drone Parts"); partsList = new List <GameObject>(); partsList.AddRange(parts); currentResourceCost = new ResourceSet(); currentDroneStats = new DroneStatSet(); UpdatePage(); UpdateBuildMode(); pageCount = (partsList.Count / partDisplays.Count); pageText.text = "Page " + (page + 1) + " of " + (pageCount + 1); }
// Start is called before the first frame update void Start() { DroneMgr.inst.RaiderDroneSpawned(this); DroneBase drone = GetComponent <DroneBase>(); if (drone != null) { drone.SetOwner(OWNERS.RAIDER); } DroneStatSet droneStats = new DroneStatSet(); droneStats.Health = 100; drone.SetDroneStats(droneStats); }
// Start is called before the first frame update void Start() { if (statsFilled) { return; } statsFilled = true; currentStats = new DroneStatSet(); droneStats = new DroneStatSet(); currentStats.Health = 100; droneStats.Health = 100; currentStats.Power = 150; droneStats.Power = 150; droneStats.Storage = 500; currentStats.Storage = 0; }
public void GetDroneStats(out DroneStatSet current, out DroneStatSet max) { current = droneBase.GetDroneCurrentStats(); max = droneBase.GetDroneMaxStats(); }