Fixed Corrupted Factory Speed Issue
Fixed the issue where the Production Speed didn't apply to the Corrupted Factory.
This commit is contained in:
parent
4acb02fb33
commit
bb82c4e068
8
Assets/Animations/Monsters/SkitteringHusk.meta
Normal file
8
Assets/Animations/Monsters/SkitteringHusk.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c600d43f63096264391f008ee593ad11
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Animations/Sticks/Spearman.meta
Normal file
8
Assets/Animations/Sticks/Spearman.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8e522bd1638e1d41b54f58896041ee0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Art/Sprites/entities/sticks/Spearman.meta
Normal file
8
Assets/Art/Sprites/entities/sticks/Spearman.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2109b1496efd35c4cb299c29b223480d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Audio/@AudioTemplates/PlacingUnits.meta
Normal file
8
Assets/Audio/@AudioTemplates/PlacingUnits.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e63d811db9104443a2e9b77be80c6d7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Audio/Building.meta
Normal file
8
Assets/Audio/Building.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 16476b5ee9ff78f4984ef8fffb24d601
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Audio/UltimateSoundFXBundle/Steps.meta
Normal file
8
Assets/Audio/UltimateSoundFXBundle/Steps.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57bf5ff10983291468c87e714b50672d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Audio/UltimateSoundFXBundle/Steps/Dirt.meta
Normal file
8
Assets/Audio/UltimateSoundFXBundle/Steps/Dirt.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2708064ba72d3ae48b25c7955dec3128
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Audio/UltimateSoundFXBundle/Steps/Grass.meta
Normal file
8
Assets/Audio/UltimateSoundFXBundle/Steps/Grass.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73178500426f29c44847ab2a50e529e2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Design/UnitCards/Gatherers.meta
Normal file
8
Assets/Design/UnitCards/Gatherers.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d01228fd516e86641a1cf536c2577cd9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Design/UnitUpgrades/Gatherers.meta
Normal file
8
Assets/Design/UnitUpgrades/Gatherers.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 183f7ea9c6b90dd4390a6b8852d11590
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -104,7 +104,7 @@ MonoBehaviour:
|
||||
_enemy: {fileID: 0}
|
||||
rangeOutline: {fileID: 0}
|
||||
_range: 0
|
||||
_multiplier: 0
|
||||
_multiplier: 1.15
|
||||
_yieldPrefabs:
|
||||
- {fileID: 6962989255644195630, guid: a2dc5d9672c10074fa9c35c12f6339c1, type: 3}
|
||||
- {fileID: 6962989255644195630, guid: 484f0eca1c74ae34694692de56a36739, type: 3}
|
||||
|
||||
@ -105,7 +105,7 @@ MonoBehaviour:
|
||||
_enemy: {fileID: 0}
|
||||
rangeOutline: {fileID: 4877144423808268021}
|
||||
_range: 1
|
||||
_multiplier: 10
|
||||
_multiplier: 100000
|
||||
--- !u!114 &5887580710472258969
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -3,7 +3,7 @@ using UnityEngine;
|
||||
|
||||
public class CorruptedFactory : ProductionBuilding
|
||||
{
|
||||
//TODO: Si ceci détermine la resource produite, modifier pour que ce soit un tableau des trois différent types de resources.
|
||||
//Détermine le type de resources dont la production sera boosté.
|
||||
protected override Enum.ResourceNodeType[] RessourceNodeType { get { return new Enum.ResourceNodeType [] { Enum.ResourceNodeType.Forest, Enum.ResourceNodeType.Rock, Enum.ResourceNodeType.BerryBush, Enum.ResourceNodeType.Farm}; } }
|
||||
|
||||
/**
|
||||
@ -21,11 +21,27 @@ public class CorruptedFactory : ProductionBuilding
|
||||
private int _yieldAmountPerResource = 1;
|
||||
private float _yieldCounter = 0;
|
||||
|
||||
private float _yieldSpeedMultiplier = 1.0f;
|
||||
private ResourceTile tile;
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
base.Start();
|
||||
for (int i = -_range; i <= _range; i++)
|
||||
{
|
||||
for (int j = -_range; j <= _range; j++)
|
||||
{
|
||||
Vector3 checkPosition = new Vector3(Mathf.Floor(_position.x) + i, Mathf.Floor(_position.y) + j, 0.0f);
|
||||
this.tile = LevelManager.Instance.Get<ResourceTile>(t => t.Position == checkPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void LevelStart()
|
||||
{
|
||||
base.LevelStart();
|
||||
|
||||
|
||||
|
||||
ResetYieldDuration();
|
||||
}
|
||||
public override void Update()
|
||||
@ -34,8 +50,6 @@ public class CorruptedFactory : ProductionBuilding
|
||||
_yieldCounter -= Time.deltaTime;
|
||||
if (_yieldCounter > 0) return;
|
||||
|
||||
ResetYieldDuration();
|
||||
|
||||
if (_yieldPrefabs.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < _yieldPrefabs.Count; i++)
|
||||
@ -45,6 +59,7 @@ public class CorruptedFactory : ProductionBuilding
|
||||
YieldResource(_yieldPrefabs[i]);
|
||||
}
|
||||
}
|
||||
ResetYieldDuration();
|
||||
}
|
||||
}
|
||||
private void YieldResource(GameObject yield)
|
||||
@ -54,8 +69,9 @@ public class CorruptedFactory : ProductionBuilding
|
||||
var yielded = Instantiate(yield, yieldPosition, Quaternion.identity);
|
||||
yielded.transform.SetParent(LevelManager.Instance.LevelTransform);
|
||||
}
|
||||
|
||||
private void ResetYieldDuration()
|
||||
{
|
||||
_yieldCounter = _harvestDuration / _yieldSpeedMultiplier;
|
||||
_yieldCounter = _harvestDuration / this.tile.YieldSpeedMultiplier;
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@
|
||||
public abstract class ProductionBuilding : House
|
||||
{
|
||||
[SerializeField]
|
||||
private int _range;
|
||||
protected int _range;
|
||||
[SerializeField]
|
||||
private float _multiplier;
|
||||
|
||||
@ -11,7 +11,7 @@ public abstract class ProductionBuilding : House
|
||||
protected abstract Enum.ResourceNodeType[] RessourceNodeType { get; }
|
||||
public int Range { get => _range; set => _range = value; }
|
||||
|
||||
private Vector3 _position;
|
||||
protected Vector3 _position;
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
@ -27,7 +27,7 @@ public abstract class ProductionBuilding : House
|
||||
|
||||
public override void LevelDestroy()
|
||||
{
|
||||
ApplyMultiplier(1 / _multiplier);
|
||||
ApplyMultiplier(_multiplier);
|
||||
base.LevelDestroy();
|
||||
}
|
||||
|
||||
@ -39,10 +39,11 @@ public abstract class ProductionBuilding : House
|
||||
{
|
||||
Vector3 checkPosition = new Vector3(Mathf.Floor(_position.x) + i, Mathf.Floor(_position.y) + j, 0.0f);
|
||||
var tile = LevelManager.Instance.Get<ResourceTile>(t => t.Position == checkPosition);
|
||||
|
||||
if (tile == default) continue;
|
||||
|
||||
var checkResourceType = tile.ResourceNodeType;
|
||||
if (!isValidResourceType(tile.ResourceNodeType)) continue;
|
||||
if (!isValidResourceType(checkResourceType)) continue;
|
||||
|
||||
tile.YieldSpeedMultiplier *= multiplier;
|
||||
}
|
||||
@ -51,6 +52,7 @@ public abstract class ProductionBuilding : House
|
||||
|
||||
private bool isValidResourceType (Enum.ResourceNodeType tileRessourceType)
|
||||
{
|
||||
|
||||
for(int i = 0; i < RessourceNodeType.Length; i++)
|
||||
{
|
||||
if (tileRessourceType == RessourceNodeType[i]) return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user