Skip to content
Extraits de code Groupes Projets
Valider a831dea9 rédigé par Pavel Krisys Verbel's avatar Pavel Krisys Verbel
Parcourir les fichiers

Final version, with scoring

parent c5a808fd
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 32 ajouts et 25 suppressions
Fichier supprimé
fileFormatVersion: 2
guid: b7d040d340613724d8fe77aa97d80cfe
timeCreated: 1506415337
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
Fichier supprimé
fileFormatVersion: 2
guid: a0c7da998a25fa04f8465e15b1559371
timeCreated: 1506433459
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
Aucun aperçu pour ce type de fichier
Aucun aperçu pour ce type de fichier
Aucun aperçu pour ce type de fichier
Aucun aperçu pour ce type de fichier
......@@ -25,6 +25,9 @@ public class BaseEnemyManager : MonoBehaviour
[SerializeField]
Renderer renderer;
public EnemyFactory enemyFactory;
public EnemyFactory.EnemyType enemyType = EnemyFactory.EnemyType.normalEnemy;
// Use this for initialization
protected void Start ()
{
......@@ -45,7 +48,8 @@ public class BaseEnemyManager : MonoBehaviour
shooterManager.Shoot(shootDirection);
if (transform.position.x < - UtilityMeasures.ScreenWidthInUnits() / 2f - 1f)
{
Destroy(this.gameObject);
//Destroy(this.gameObject);
enemyFactory.Release(this.gameObject);
}
}
}
......@@ -28,7 +28,7 @@ public class BulletManager : MonoBehaviour
{
GameObject other = collision.gameObject;
if ((bulletType.Equals(BulletFactory.BulletType.playerBullet) && other.CompareTag("Enemy")) ||
(bulletType.Equals(BulletFactory.BulletType.enemyBullet) && other.CompareTag("Player")))
(bulletType.Equals(BulletFactory.BulletType.enemyBullet) && other.CompareTag("Player") && !ImmunityManager.Instance.isImmune))
{
bulletFactory.Release(this.gameObject);
HealthManager otherHealthManager = other.GetComponent<HealthManager>();
......@@ -36,6 +36,10 @@ public class BulletManager : MonoBehaviour
{
otherHealthManager.TakeDamage(damage);
}
if(other.CompareTag("Player"))
{
ImmunityManager.Instance.BecomeImmune();
}
}
}
}
......@@ -30,6 +30,7 @@ public class DashManager : MonoBehaviour
dashStart = Time.time;
dashDirection = direction;
isDashing = true;
ImmunityManager.Instance.BecomeImmune();
}
}
......
......@@ -4,8 +4,11 @@ using UnityEngine;
public class EnemyGenerator : MonoBehaviour {
/*
[SerializeField]
GameObject[] enemyPrefabs;
GameObject[] enemyPrefabs;*/
[SerializeField]
EnemyFactory.EnemyType[] enemyTypes;
float minY = -8;
float maxY = 8;
float X = 10;
......@@ -14,6 +17,8 @@ public class EnemyGenerator : MonoBehaviour {
float lastEnemyTime = float.NegativeInfinity;
[SerializeField]
BulletFactory bulletFactory;
[SerializeField]
EnemyFactory enemyFactory;
// Use this for initialization
void Start ()
......@@ -34,11 +39,11 @@ public class EnemyGenerator : MonoBehaviour {
void Update ()
{
UpdateSizes();
if (enemyPrefabs.Length > 0 && Time.time - lastEnemyTime > timeBetweenEnemies)
if (enemyTypes.Length > 0 && Time.time - lastEnemyTime > timeBetweenEnemies)
{
int selectedEnemy = Random.Range((int)0, (int)enemyPrefabs.Length);
int selectedEnemy = Random.Range((int)0, (int)enemyTypes.Length);
float Y = Random.Range(minY, maxY);
GameObject newEnemy = Instantiate(enemyPrefabs[selectedEnemy]);
GameObject newEnemy = enemyFactory.GetEnemy(enemyTypes[selectedEnemy]);
ShooterManager enemyShooterManager = newEnemy.GetComponent<ShooterManager>();
if(enemyShooterManager)
{
......
......@@ -24,7 +24,6 @@ public class HealthManager : MonoBehaviour
{
deathManager.Die();
}
Destroy(this.gameObject);
}
}
......
......@@ -16,8 +16,7 @@ public class PlayerController : MonoBehaviour {
float movementWidth = 6;
float movementLength = 1;
[SerializeField]
Vector3 basePosition = new Vector3(-9, 0, 0);
Vector3 basePosition;
[SerializeField]
float dashKeyDelay = 0.5f;
......@@ -27,12 +26,14 @@ public class PlayerController : MonoBehaviour {
private void Start()
{
basePosition = new Vector3(-9f * UtilityMeasures.ScreenWidthInUnits() / 20f, 0, 0);
transform.position = basePosition;
UpdateSizes();
}
void UpdateSizes()
{
basePosition = new Vector3(-9f * UtilityMeasures.ScreenWidthInUnits() / 20f, 0, 0);
movementWidth = UtilityMeasures.ScreenHeightInUnits() / 2f;
movementLength = (UtilityMeasures.ScreenWidthInUnits() / 2f) + basePosition.x;
}
......
......@@ -7,6 +7,8 @@ public class PlayerDeathManager : DeathManager
public override void Die()
{
base.Die();
ScoreMemory.Instance.savedScore = ScoreManager.Instance.GetScore();
UnityEngine.SceneManagement.SceneManager.LoadScene("GameOver");
Destroy(this.gameObject);
}
}
Aucun aperçu pour ce type de fichier
......@@ -82,6 +82,8 @@
<Compile Include="Assets\Scripts\Game\BulletManager.cs" />
<Compile Include="Assets\Scripts\Game\DashManager.cs" />
<Compile Include="Assets\Scripts\Game\DeathManager.cs" />
<Compile Include="Assets\Scripts\Game\EnemyDeathManager.cs" />
<Compile Include="Assets\Scripts\Game\EnemyFactory.cs" />
<Compile Include="Assets\Scripts\Game\EnemyGenerator.cs" />
<Compile Include="Assets\Scripts\Game\EnergyManager.cs" />
<Compile Include="Assets\Scripts\Game\EnergySliderManager.cs" />
......@@ -89,10 +91,14 @@
<Compile Include="Assets\Scripts\Game\HealthAndEnergyPrinter.cs" />
<Compile Include="Assets\Scripts\Game\HealthManager.cs" />
<Compile Include="Assets\Scripts\Game\HealthSliderManager.cs" />
<Compile Include="Assets\Scripts\Game\ImmunityManager.cs" />
<Compile Include="Assets\Scripts\Game\MoveableManager.cs" />
<Compile Include="Assets\Scripts\Game\PlayerController.cs" />
<Compile Include="Assets\Scripts\Game\PlayerDeathManager.cs" />
<Compile Include="Assets\Scripts\Game\PlayerShooterManager.cs" />
<Compile Include="Assets\Scripts\Game\ScoreManager.cs" />
<Compile Include="Assets\Scripts\Game\ScoreMemory.cs" />
<Compile Include="Assets\Scripts\Game\ScorePrinter.cs" />
<Compile Include="Assets\Scripts\Game\ShooterManager.cs" />
<Compile Include="Assets\Scripts\Game\UIGunType.cs" />
<Compile Include="Assets\Scripts\Game\UtilityMeasures.cs" />
......@@ -100,6 +106,7 @@
<Compile Include="Assets\Scripts\Game\ZigzagEnemyManager.cs" />
<Compile Include="Assets\Scripts\Menus\ContinueButton.cs" />
<Compile Include="Assets\Scripts\Menus\ExitButton.cs" />
<Compile Include="Assets\Scripts\Menus\GameOverScorePrinter.cs" />
<Compile Include="Assets\Scripts\Menus\PlayButton.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter