Add test env
This commit is contained in:
parent
eaed21b897
commit
af3de2fc10
15 changed files with 2263 additions and 65 deletions
175
Assets/DevMocks/Resources/DevMocks/DummyEnemy.prefab
Normal file
175
Assets/DevMocks/Resources/DevMocks/DummyEnemy.prefab
Normal file
|
@ -0,0 +1,175 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1538228739935925895
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1538228739935925892}
|
||||
- component: {fileID: 1538228739935925893}
|
||||
- component: {fileID: 1538228739935925894}
|
||||
- component: {fileID: 1538228739935925891}
|
||||
m_Layer: 14
|
||||
m_Name: DummyEnemy
|
||||
m_TagString: Enemy
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1538228739935925892
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1538228739935925895}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 5, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1538228741088485487}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!50 &1538228739935925893
|
||||
Rigidbody2D:
|
||||
serializedVersion: 4
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1538228739935925895}
|
||||
m_BodyType: 0
|
||||
m_Simulated: 1
|
||||
m_UseFullKinematicContacts: 0
|
||||
m_UseAutoMass: 0
|
||||
m_Mass: 1
|
||||
m_LinearDrag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_GravityScale: 0
|
||||
m_Material: {fileID: 6200000, guid: dc8eb6133faaf45f6820487d0d28b47f, type: 2}
|
||||
m_Interpolate: 0
|
||||
m_SleepingMode: 1
|
||||
m_CollisionDetection: 0
|
||||
m_Constraints: 4
|
||||
--- !u!114 &1538228739935925894
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1538228739935925895}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 29972d94a069eef40924fbb80ca2fb24, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
OneDirection: {x: -1, y: 0}
|
||||
--- !u!61 &1538228739935925891
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1538228739935925895}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0.5, y: 0.9}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0, y: 0}
|
||||
oldSize: {x: 0, y: 0}
|
||||
newSize: {x: 0, y: 0}
|
||||
adaptiveTilingThreshold: 0
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 0.5, y: 0.9}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!1 &1538228741088485488
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1538228741088485487}
|
||||
- component: {fileID: 1538228741088485486}
|
||||
m_Layer: 14
|
||||
m_Name: Sprite
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1538228741088485487
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1538228741088485488}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1538228739935925892}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &1538228741088485486
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1538228741088485488}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: 55fee6a02b8d5bc4e993261a717e89cc, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2ab6367571f7bcc45b9dd6cc9ee7f656
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -299,7 +299,7 @@ PrefabInstance:
|
|||
- target: {fileID: 485484359815032853, guid: a977eab75b5324ec4b659c2e2a0e9cfd,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 10.969402
|
||||
value: 7.7734566
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 485484359815032853, guid: a977eab75b5324ec4b659c2e2a0e9cfd,
|
||||
type: 3}
|
||||
|
@ -309,7 +309,7 @@ PrefabInstance:
|
|||
- target: {fileID: 485484359815032853, guid: a977eab75b5324ec4b659c2e2a0e9cfd,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -10
|
||||
value: -2.7893844
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 485484359815032853, guid: a977eab75b5324ec4b659c2e2a0e9cfd,
|
||||
type: 3}
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
using UnityEngine;
|
||||
using src.Helpers;
|
||||
|
||||
public class DumbEnemy : EnemyBase
|
||||
{
|
||||
protected new void Start()
|
||||
{
|
||||
Speed = 4f;
|
||||
base.Start();
|
||||
}
|
||||
|
||||
protected new void FixedUpdate()
|
||||
{
|
||||
if (gameStateManager.IsGamePaused || gameStateManager.IsPlayerMovementForbidden) {return;}
|
||||
if (transform.position.x == Mathf.Floor(transform.position.x) &&
|
||||
transform.position.y == Mathf.Floor(transform.position.y))
|
||||
{
|
||||
if (RandomChange())
|
||||
{
|
||||
HandleChangeDirection();
|
||||
}
|
||||
else
|
||||
{
|
||||
Rigidbody2d.MovePosition(Rigidbody2d.position + Speed * Time.deltaTime * Direction);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Rigidbody2d.MovePosition(Rigidbody2d.position + Speed * Time.deltaTime * Direction);
|
||||
}
|
||||
}
|
||||
|
||||
private bool RandomChange()
|
||||
{
|
||||
var random = new System.Random();
|
||||
var randomNumber = random.Next(0, 100);
|
||||
return randomNumber <= 25;
|
||||
}
|
||||
|
||||
private void HandleChangeDirection()
|
||||
{
|
||||
Direction = ChooseRandomExceptCertainDirection(Direction);
|
||||
MoveToCenterOfTheCell();
|
||||
Rigidbody2d.MovePosition(Rigidbody2d.position + Speed * Time.deltaTime * Direction);
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
public class DumberEnemy : EnemyBase
|
||||
{
|
||||
|
||||
//Momentan lasam asa, o sa difere probabil la animatii and stats, nu stiu sigur
|
||||
protected new void Start()
|
||||
{
|
||||
Speed = 4f;
|
||||
base.Start();
|
||||
}
|
||||
|
||||
protected new void FixedUpdate()
|
||||
{
|
||||
base.FixedUpdate();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f54d1bd14bd3ca042bd867b519fee8cc
|
||||
guid: 738f4be39c8d33d4dbfe91e24b6b1b63
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
27
Assets/Scripts/src/Enemy/Dummy/OneDirectionEnemy.cs
Normal file
27
Assets/Scripts/src/Enemy/Dummy/OneDirectionEnemy.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace Assets.Scripts.src.Enemy.Dummy
|
||||
{
|
||||
//This kind of enemy is used just for testing purposes
|
||||
//This enemy will go just in one direction or stays in place
|
||||
//To make it stay in place, don't assign any direction in OneDirection slot or assign Vector2.zero
|
||||
public class OneDirectionEnemy : EnemyBase
|
||||
{
|
||||
public Vector2 OneDirection = Vector2.zero;
|
||||
|
||||
protected new void Start()
|
||||
{
|
||||
Speed = 4.0f;
|
||||
Rigidbody2d = GetComponent<Rigidbody2D>();
|
||||
}
|
||||
|
||||
protected new void FixedUpdate()
|
||||
{
|
||||
if (OneDirection != Vector2.zero)
|
||||
{
|
||||
if (gameStateManager.IsGamePaused || gameStateManager.IsPlayerMovementForbidden) { return; }
|
||||
Rigidbody2d.MovePosition(Rigidbody2d.position + OneDirection * Speed * Time.deltaTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/src/Enemy/Dummy/OneDirectionEnemy.cs.meta
Normal file
11
Assets/Scripts/src/Enemy/Dummy/OneDirectionEnemy.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 29972d94a069eef40924fbb80ca2fb24
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,19 @@
|
|||
namespace Assets.Scripts.src.Enemy
|
||||
{
|
||||
public class EnemyThatChangeDirectionOnlyOnCollision : EnemyBase
|
||||
{
|
||||
|
||||
//Momentan lasam asa, o sa difere probabil la animatii and stats, nu stiu sigur
|
||||
protected new void Start()
|
||||
{
|
||||
Speed = 4f;
|
||||
base.Start();
|
||||
}
|
||||
|
||||
protected new void FixedUpdate()
|
||||
{
|
||||
base.FixedUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
48
Assets/Scripts/src/Enemy/EnemyThatRandomChangeDirection.cs
Normal file
48
Assets/Scripts/src/Enemy/EnemyThatRandomChangeDirection.cs
Normal file
|
@ -0,0 +1,48 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace Assets.Scripts.src.Enemy
|
||||
{
|
||||
public class EnemyThatRandomChangeDirection : EnemyBase
|
||||
{
|
||||
protected new void Start()
|
||||
{
|
||||
Speed = 4f;
|
||||
base.Start();
|
||||
}
|
||||
|
||||
protected new void FixedUpdate()
|
||||
{
|
||||
if (gameStateManager.IsGamePaused || gameStateManager.IsPlayerMovementForbidden) { return; }
|
||||
if (transform.position.x == Mathf.Floor(transform.position.x) &&
|
||||
transform.position.y == Mathf.Floor(transform.position.y))
|
||||
{
|
||||
if (RandomChange())
|
||||
{
|
||||
HandleChangeDirection();
|
||||
}
|
||||
else
|
||||
{
|
||||
Rigidbody2d.MovePosition(Rigidbody2d.position + Speed * Time.deltaTime * Direction);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Rigidbody2d.MovePosition(Rigidbody2d.position + Speed * Time.deltaTime * Direction);
|
||||
}
|
||||
}
|
||||
|
||||
private bool RandomChange()
|
||||
{
|
||||
var random = new System.Random();
|
||||
var randomNumber = random.Next(0, 100);
|
||||
return randomNumber <= 25;
|
||||
}
|
||||
|
||||
private void HandleChangeDirection()
|
||||
{
|
||||
Direction = ChooseRandomExceptCertainDirection(Direction);
|
||||
MoveToCenterOfTheCell();
|
||||
Rigidbody2d.MovePosition(Rigidbody2d.position + Speed * Time.deltaTime * Direction);
|
||||
}
|
||||
}
|
||||
}
|
8
Assets/TestScenes.meta
Normal file
8
Assets/TestScenes.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f10ffcf9c33d380498a0580416c232d6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
1958
Assets/TestScenes/TestSceneNoWalls.unity
Normal file
1958
Assets/TestScenes/TestSceneNoWalls.unity
Normal file
File diff suppressed because it is too large
Load diff
7
Assets/TestScenes/TestSceneNoWalls.unity.meta
Normal file
7
Assets/TestScenes/TestSceneNoWalls.unity.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7de2b522bb32ea84a9a474de611dd137
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in a new issue