Compare commits
4 Commits
54576cb420
...
93f83c121c
Author | SHA1 | Date |
---|---|---|
|
93f83c121c | |
|
0969be4955 | |
|
13fcafa4fc | |
|
bed0fabc4e |
|
@ -1 +1 @@
|
||||||
Subproject commit cf3cf65b068d861d5bd65db2fbbb53a55f5bbf4d
|
Subproject commit ea2119913ae05cb512b9e5bc3b28b88e50ade9af
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 35a6473e8e64e19c69b5a2aa7cf193d3
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"name": "Turret",
|
||||||
|
"rootNamespace": "",
|
||||||
|
"references": [
|
||||||
|
"UnityEngine.TestRunner",
|
||||||
|
"UnityEditor.TestRunner",
|
||||||
|
"Entities"
|
||||||
|
],
|
||||||
|
"includePlatforms": [],
|
||||||
|
"excludePlatforms": [],
|
||||||
|
"allowUnsafeCode": false,
|
||||||
|
"overrideReferences": true,
|
||||||
|
"precompiledReferences": [
|
||||||
|
"nunit.framework.dll"
|
||||||
|
],
|
||||||
|
"autoReferenced": false,
|
||||||
|
"defineConstraints": [
|
||||||
|
"UNITY_INCLUDE_TESTS"
|
||||||
|
],
|
||||||
|
"versionDefines": [],
|
||||||
|
"noEngineReferences": false
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3ab67724d349675b1a6a9081eb70e62a
|
||||||
|
AssemblyDefinitionImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f6189f795d25322fa93a6fcde3bd4b2a
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,70 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using AsteroidGame.Entities;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using UnityEditor.SceneManagement;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
using UnityEngine.Serialization;
|
||||||
|
using UnityEngine.TestTools;
|
||||||
|
using Assert = UnityEngine.Assertions.Assert;
|
||||||
|
|
||||||
|
public class TurretTestScript : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] private List<Turret> _turrets;
|
||||||
|
[SerializeField] private EnemyBase _enemy;
|
||||||
|
|
||||||
|
[UnitySetUp]
|
||||||
|
public IEnumerator LoadScene()
|
||||||
|
{
|
||||||
|
// Load the scene asynchronously and wait until it's fully loaded
|
||||||
|
var asyncLoad = SceneManager.LoadSceneAsync("TurretTestScene");
|
||||||
|
while (!asyncLoad.isDone)
|
||||||
|
{
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
_turrets = new();
|
||||||
|
_turrets = FindObjectsOfType<Turret>().ToList();
|
||||||
|
|
||||||
|
_enemy = new();
|
||||||
|
_enemy = FindObjectOfType<EnemyBase>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// // A Test behaves as an ordinary method
|
||||||
|
// [Test]
|
||||||
|
// public void NewTestScriptSimplePasses()
|
||||||
|
// {
|
||||||
|
// // Use the Assert class to test conditions
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // A UnityTest behaves like a coroutine in Play Mode. In Edit Mode you can use
|
||||||
|
// // `yield return null;` to skip a frame.
|
||||||
|
// [UnityTest]
|
||||||
|
// public IEnumerator NewTestScriptWithEnumeratorPasses()
|
||||||
|
// {
|
||||||
|
// // Use the Assert class to test conditions.
|
||||||
|
// // Use yield to skip a frame.
|
||||||
|
// yield return null;
|
||||||
|
// }
|
||||||
|
|
||||||
|
[UnityTest]
|
||||||
|
public IEnumerator OnlyOneTurretGetsTheKill()
|
||||||
|
{
|
||||||
|
var totalKillCount = 0;
|
||||||
|
if (_enemy != null)
|
||||||
|
{
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var turret in _turrets)
|
||||||
|
{
|
||||||
|
totalKillCount += turret.Kills;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.IsTrue(totalKillCount == 1);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 565b0512bfe5540aebdda54c45668c3c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -12,9 +12,9 @@ namespace AsteroidGame.Entities
|
||||||
[SerializeField] private float _projectileSpeed = 5;
|
[SerializeField] private float _projectileSpeed = 5;
|
||||||
|
|
||||||
[field: Header("Stats")]
|
[field: Header("Stats")]
|
||||||
[field: SerializeField] public float Kills { get; set; }
|
[field: SerializeField] public int Kills { get; set; }
|
||||||
|
|
||||||
[field: SerializeField] public float DamageDealt { get; set; }
|
[field: SerializeField] public int DamageDealt { get; set; }
|
||||||
|
|
||||||
[field: Header("Weapon")]
|
[field: Header("Weapon")]
|
||||||
[field: SerializeField] public List<Weapon> Weapons { get; set; }
|
[field: SerializeField] public List<Weapon> Weapons { get; set; }
|
||||||
|
@ -73,7 +73,7 @@ namespace AsteroidGame.Entities
|
||||||
|
|
||||||
private void TurnOffWeapons()
|
private void TurnOffWeapons()
|
||||||
{
|
{
|
||||||
//powerSystem.SetCurrentPower(0);
|
powerSystem.SetCurrentPower(0);
|
||||||
foreach (var weapon in Weapons)
|
foreach (var weapon in Weapons)
|
||||||
{
|
{
|
||||||
weapon.FireWeapon = false;
|
weapon.FireWeapon = false;
|
||||||
|
|
Loading…
Reference in New Issue