Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
four
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
31
Issues
31
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
gadig
four
Commits
2cbc0619
Commit
2cbc0619
authored
Oct 11, 2016
by
Cody A Burchett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
-m
parent
67992c6c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
Assets/scene/cburchetTesting.unity
Assets/scene/cburchetTesting.unity
+0
-0
Assets/script/FlameCrab.cs
Assets/script/FlameCrab.cs
+8
-2
No files found.
Assets/scene/cburchetTesting.unity
View file @
2cbc0619
No preview for this file type
Assets/script/FlameCrab.cs
View file @
2cbc0619
...
...
@@ -3,9 +3,15 @@ using System.Collections;
public
class
FlameCrab
:
MonoBehaviour
{
//update once grid is ready
//array of positions to move to once grid is ready
//Vector3 [] positions;
public
float
moveDelay
=
5f
;
public
float
speed
=
5f
;
public
float
health
=
10f
;
public
int
moveDistance
=
5
;
float
nextMove
=
0f
;
Vector3
targetLocation
=
-
Vector3
.
up
;
...
...
@@ -22,7 +28,7 @@ public class FlameCrab : MonoBehaviour {
{
if
(
targetLocation
!=
-
Vector3
.
up
)
{
if
((
transform
.
position
-
targetLocation
).
sqrMagnitude
>
.
1
5f
)
if
((
transform
.
position
-
targetLocation
).
sqrMagnitude
>
.
5f
)
{
Move
();
}
...
...
@@ -35,7 +41,7 @@ public class FlameCrab : MonoBehaviour {
else
{
//find new target location to right or left of enemy
int
spacesToMove
=
Random
.
Range
(-
5
,
6
);
int
spacesToMove
=
Random
.
Range
(-
moveDistance
,
moveDistance
+
1
);
RaycastHit2D
hit
=
Physics2D
.
Raycast
(
transform
.
position
,
transform
.
right
,
spacesToMove
,
1
);
if
(
hit
.
collider
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment