private void GenerateSkydomeLights(QualityDomeLighting quality) { _qualityDomeLights = quality; switch (quality) { case QualityDomeLighting.LOW: { _domeLights = Instantiate(_lowResDirLights, this.transform); _nbrDomeLights = 16; _skyVisibilityCoefficient = 1.565f; break; } case QualityDomeLighting.MEDIUM: { _domeLights = Instantiate(_mediumResDirLights, this.transform); _nbrDomeLights = 71; _skyVisibilityCoefficient = 1.745f; break; } case QualityDomeLighting.HIGH: { _domeLights = Instantiate(_highResDirLights, this.transform); _nbrDomeLights = 301; _skyVisibilityCoefficient = 2.0f; break; } } #if !UNITY_EDITOR _lightingManager.SetNbrLightsSkyDome(_nbrDomeLights); _lightingManager.SetSkyVisibilityMultiplier(_skyVisibilityCoefficient); #else SetMaterialProperties aGameObjectSetMaterialProperties = FindObjectOfType <SetMaterialProperties>(); if (aGameObjectSetMaterialProperties != null) { _lightingManager.SetNbrLightsSkyDome(_nbrDomeLights, aGameObjectSetMaterialProperties.gameObject); switch (quality) { case QualityDomeLighting.LOW: { _lightingManager.SetSkyVisibilityMultiplier(1.565f, aGameObjectSetMaterialProperties.gameObject); break; } case QualityDomeLighting.MEDIUM: { _lightingManager.SetSkyVisibilityMultiplier(1.745f, aGameObjectSetMaterialProperties.gameObject); break; } case QualityDomeLighting.HIGH: { _lightingManager.SetSkyVisibilityMultiplier(2.0f, aGameObjectSetMaterialProperties.gameObject); break; } } } #endif }
void Awake() { health = GetComponentInChildren <Health>(); setMaterialProperties = GetComponent <SetMaterialProperties>(); uiController = UIController.Instance; health.Died += OnDied; Team = StartingTeam; }
void Awake() { capturable = GetComponentInChildren <Capturable>(); setMaterialProperties = GetComponent <SetMaterialProperties>(); uiController = UIController.Instance; if (!StartCaptured) { Team = 2; } capturable.Captured += OnCaptured; }
void Awake() { health = GetComponentInChildren <Health>(); setMaterialProperties = GetComponent <SetMaterialProperties>(); shipMove = GetComponentInChildren <ShipMove>(); spriteRenderer = GetComponent <SpriteRenderer>(); targetAcquisition = GetComponentInChildren <TargetAcquisition>(); trailRenderer = GetComponent <TrailRenderer>(); health.Damaged += OnDamaged; health.Died += OnDied; shipMove.FollowComplete += OnFollowComplete; targetAcquisition.TargetAcquired += OnTargetAcquired; targetAcquisition.TargetLost += OnTargetLost; }
void Awake() { im = this; //weapons = weapons.LoadAssets("equipment/weapons"); // When building the final product, replace Resources.LoadAll calls with LoadAssets calls weapons = Resources.LoadAll <Weapon>("Inventory/Weapons"); headgear = Resources.LoadAll <Headgear>("Inventory/Headgear"); chestgear = Resources.LoadAll <Chestgear>("Inventory/Chestgear"); armgear = Resources.LoadAll <Armgear>("Inventory/Armgear"); consumables = Resources.LoadAll <Consumable>("Inventory/Consumables"); leggear = Resources.LoadAll <Leggear>("Inventory/Leggear"); lightsources = Resources.LoadAll <Lightsource>("Inventory/Lightsources"); ammo = Resources.LoadAll <Ammo>("Inventory/Ammo"); foreach (var a in weapons) { SetMaterialProperties smp = a.obj.GetComponent <SetMaterialProperties>(); smp?.SetProps(); } foreach (var a in headgear) { SetMaterialProperties smp = a.obj.GetComponent <SetMaterialProperties>(); smp?.SetProps(); } foreach (var a in chestgear) { SetMaterialProperties smp = a.obj.GetComponent <SetMaterialProperties>(); smp?.SetProps(); } foreach (var a in armgear) { SetMaterialProperties smp = a.obj.GetComponent <SetMaterialProperties>(); smp?.SetProps(); } foreach (var a in consumables) { SetMaterialProperties smp = a.obj.GetComponent <SetMaterialProperties>(); smp?.SetProps(); } foreach (var a in leggear) { SetMaterialProperties smp = a.obj.GetComponent <SetMaterialProperties>(); smp?.SetProps(); } foreach (var a in lightsources) { SetMaterialProperties smp = a.obj.GetComponent <SetMaterialProperties>(); smp?.SetProps(); } }
public void UpdateContents(List <Inventory> content, TreasureChest chest) { bindedChest = chest; currentContent = content; for (int i = 0; i < items.Length; i++) { if (i < content.Count) { items[i].text.text = content[i].item.name; items[i].icon.sprite = content[i].item.icon == null ? content[i].item.obj.GetComponent <SpriteRenderer>().sprite : content[i].item.icon; if (content[i].item.modifiedMat != null) { items[i].icon.material = content[i].item.modifiedMat; } else if (content[i].item.material != null && content[i].item.modifiedMat == null) { SetMaterialProperties custom = content[i].item.obj.GetComponent <SetMaterialProperties>(); if (custom != null) { Material mat = new Material(content[i].item.material); custom.SetProps(); mat.SetUIPropertyBlock(content[i].item.obj.GetComponent <Renderer>()); content[i].item.modifiedMat = mat; items[i].icon.material = mat; } else { content[i].item.modifiedMat = content[i].item.material; items[i].icon.material = content[i].item.material; } } else { items[i].icon.material = null; } if (content[i].amount > 1) { items[i].text.text += $" x{content[i].amount}"; } } else { items[i].text.text = ""; items[i].icon.enabled = false; } items[i].img.enabled = false; } }
void Awake() { capturable = GetComponentInChildren <Capturable>(); setMaterialProperties = GetComponent <SetMaterialProperties>(); selectable = GetComponentInChildren <Selectable>(); uiController = UIController.Instance; CurrentShip = ShipDataset[0]; if (!StartCaptured) { Team = 2; } if (Team == 2) { selectable.gameObject.SetActive(false); } capturable.Captured += OnCaptured; uiController.StoreUpdated += OnStoreUpdated; }