Skip to content

Commit

Permalink
Ajustes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
washingtonwagner committed Jan 4, 2024
1 parent 2c62669 commit 1c0d7cb
Show file tree
Hide file tree
Showing 6 changed files with 1,792 additions and 1,242 deletions.
164 changes: 82 additions & 82 deletions Game/Assets/_Game/Assets/Enemy.prefab
Original file line number Diff line number Diff line change
@@ -1,111 +1,48 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4699562011769824168
--- !u!1 &3676489154619629165
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4699562011769824175}
m_Layer: 2
m_Name: GroundCheck
m_TagString: Untagged
m_Icon: {fileID: -5442936267250999957, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4699562011769824175
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4699562011769824168}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.87, y: -0.3132829, z: -0.14701279}
m_LocalScale: {x: 1.566416, y: 1.566416, z: 1.566416}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4699562012438684383}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &4699562012253491471
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4699562012253491470}
m_Layer: 2
m_Name: Enemy
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4699562012253491470
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4699562012253491471}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -7.85, y: 1.78, z: -0.09385297}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4699562012438684383}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &4699562012438684376
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4699562012438684383}
- component: {fileID: 4699562012438684371}
- component: {fileID: 4699562012438684380}
- component: {fileID: 4699562012438684381}
- component: {fileID: 4699562012438684382}
- component: {fileID: 547902179148770462}
- component: {fileID: 1788757874313468430}
- component: {fileID: 7258489067234534028}
- component: {fileID: 8449307711301877588}
- component: {fileID: 7219948408333643931}
m_Layer: 2
m_Name: Slime
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4699562012438684383
--- !u!4 &547902179148770462
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4699562012438684376}
m_GameObject: {fileID: 3676489154619629165}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 6.79, y: -5.39, z: 0.09385297}
m_LocalScale: {x: 0.6384, y: 0.6384, z: 0.6384}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 4699562011769824175}
m_Father: {fileID: 4699562012253491470}
- {fileID: 4031062799740867407}
m_Father: {fileID: 1881252664091932579}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &4699562012438684371
--- !u!212 &1788757874313468430
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4699562012438684376}
m_GameObject: {fileID: 3676489154619629165}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
Expand Down Expand Up @@ -151,13 +88,13 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!58 &4699562012438684380
--- !u!58 &7258489067234534028
CircleCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4699562012438684376}
m_GameObject: {fileID: 3676489154619629165}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
Expand All @@ -167,14 +104,14 @@ CircleCollider2D:
m_Offset: {x: 0, y: 0}
serializedVersion: 2
m_Radius: 0.5
--- !u!50 &4699562012438684381
--- !u!50 &8449307711301877588
Rigidbody2D:
serializedVersion: 4
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4699562012438684376}
m_GameObject: {fileID: 3676489154619629165}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
Expand All @@ -188,13 +125,13 @@ Rigidbody2D:
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 4
--- !u!114 &4699562012438684382
--- !u!114 &7219948408333643931
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4699562012438684376}
m_GameObject: {fileID: 3676489154619629165}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dce6ecf6fd8309648883898259b0d17e, type: 3}
Expand All @@ -204,10 +141,73 @@ MonoBehaviour:
distance: 1
isRight: 1
seePlayer: 0
groundCheck: {fileID: 4699562011769824175}
groundCheck: {fileID: 4031062799740867407}
player: {fileID: 0}
playerlayer:
serializedVersion: 2
m_Bits: 128
minDistance: 3
rangeVision: {x: 4, y: 1.35}
--- !u!1 &8091989075438182884
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1881252664091932579}
m_Layer: 2
m_Name: Enemy
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1881252664091932579
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8091989075438182884}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -12.97, y: 4.87, z: -0.09385297}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 547902179148770462}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &8439759792422169215
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4031062799740867407}
m_Layer: 2
m_Name: GroundCheck
m_TagString: Untagged
m_Icon: {fileID: -5442936267250999957, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4031062799740867407
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8439759792422169215}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.87, y: -0.3132829, z: -0.14701279}
m_LocalScale: {x: 1.566416, y: 1.566416, z: 1.566416}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 547902179148770462}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
33 changes: 19 additions & 14 deletions Game/Assets/_Game/_Scripts/Enemies/BasicMovement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,25 @@

public class BasicMovement : MonoBehaviour
{
private Rigidbody2D rig;

[Header("Vision")]
[SerializeField] private Vector2 rangeVision = new Vector2(4, 3);
private float distance = 1;

[Header("Movimento")]
[SerializeField] private float speed = 0.03f;
[SerializeField] private float distance = 1;
[SerializeField] private bool isRight = true;
[SerializeField] private bool seePlayer = false;
private bool onBord = false;

[SerializeField] private float atkDistance;

[Header("Components")]
[SerializeField] private Transform groundCheck;
[SerializeField] private Transform player;
[SerializeField] private LayerMask playerlayer;
[SerializeField] private float minDistance;

[SerializeField] private Vector2 rangeVision = new Vector2(4, 3);

private Rigidbody2D rig;

[Header("Tests")]
private bool isRight = true;
private bool seePlayer = false;
private bool onBord = false;

// Start is called before the first frame update
void Start()
Expand All @@ -28,10 +33,10 @@ void Start()

private void FixedUpdate()
{
if (!seePlayer)
Movement();
else
if (seePlayer)
FollowPLayer();
else
Movement();
}

// Update is called once per frame
Expand Down Expand Up @@ -113,7 +118,7 @@ private void FollowPLayer()
Vector2 position = transform.position;

float space = Vector2.Distance(position, playerPosition);
if (space >= minDistance)
if (space >= atkDistance)
{

Vector2 direction = playerPosition - position;
Expand Down
Loading

0 comments on commit 1c0d7cb

Please sign in to comment.