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
B
Birb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gadig
Birb
Commits
e61bda3f
Commit
e61bda3f
authored
Mar 02, 2017
by
Tanner Grehawick
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.gmu.edu:gadig/Birb
parents
bb345224
1e755e8d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
112 additions
and
22 deletions
+112
-22
Assets/Scripts/Enemy.meta
Assets/Scripts/Enemy.meta
+15
-0
Assets/Scripts/Enemy/ToggleEnemy.cs
Assets/Scripts/Enemy/ToggleEnemy.cs
+4
-2
Assets/Scripts/Player/CameraFollow.cs.meta
Assets/Scripts/Player/CameraFollow.cs.meta
+0
-12
Assets/Scripts/Player/Walk.cs
Assets/Scripts/Player/Walk.cs
+86
-8
Birb
Birb
+1
-0
ProjectSettings/ProjectVersion.txt
ProjectSettings/ProjectVersion.txt
+6
-0
ProjectSettings/TagManager.asset
ProjectSettings/TagManager.asset
+0
-0
No files found.
Assets/Scripts/
Breakable.cs
.meta
→
Assets/Scripts/
Enemy
.meta
View file @
e61bda3f
fileFormatVersion: 2
guid: 5e257b3931afd45bf902bc96e4c29208
timeCreated: 1487900567
<<<<<<< HEAD
guid: 79d075457339b354e831e24223780806
folderAsset: yes
timeCreated: 1487896426
=======
guid: f5015e51666ab3b4e9a750c868d6703b
folderAsset: yes
timeCreated: 1487785551
>>>>>>> origin/master
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/Enemy/ToggleEnemy.cs
View file @
e61bda3f
...
...
@@ -22,8 +22,10 @@ public class ToggleEnemy : MonoBehaviour {
//check if enemy is in view of camera and disable if not
if
(!
GeometryUtility
.
TestPlanesAABB
(
camPlanes
,
enemies
[
i
].
bounds
))
{
// enemies[i].gameObject.GetComponent<BaseEnemy>().enabled = false;
enemies
.
Remove
(
enemies
[
i
]);
// enemies[i].gameObject.GetComponent<BaseEnemy>().enabled = false;
// enemies.Remove(enemies[i]);
}
}
}
...
...
Assets/Scripts/Player/CameraFollow.cs.meta
deleted
100644 → 0
View file @
bb345224
fileFormatVersion: 2
guid: 11ecc39894ce94f60a0a952e704c611f
timeCreated: 1487896949
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/Player/Walk.cs
View file @
e61bda3f
...
...
@@ -3,13 +3,24 @@ using System.Collections.Generic;
using
UnityEngine
;
public
class
Walk
:
AbstractBehavior
{
public
in
t
speed
;
public
floa
t
speed
;
private
float
airSpeed
;
public
float
airAcceleration
;
public
float
friction
;
public
float
wallClingTime
;
//time you will 'stick' to the wall after pressing the opposite direction
private
float
xScale
;
public
float
realSpeed
;
private
int
rightInt
=
0
;
private
int
leftInt
=
0
;
private
float
rightTime
=
0
;
private
float
leftTime
=
0
;
// Use this for initialization
void
Start
()
{
xScale
=
body
.
transform
.
localScale
.
x
;
}
// Update is called once per frame
...
...
@@ -17,8 +28,11 @@ public class Walk : AbstractBehavior {
Buttons
left
=
inputButtons
[
0
];
Buttons
right
=
inputButtons
[
1
];
int
rightInt
=
0
;
int
leftInt
=
0
;
rightInt
=
0
;
leftInt
=
0
;
rightTime
=
inputState
.
GetButtonHoldTime
(
right
);
leftTime
=
inputState
.
GetButtonHoldTime
(
left
);
if
(
inputState
.
GetButtonValue
(
right
))
rightInt
=
1
;
...
...
@@ -30,15 +44,40 @@ public class Walk : AbstractBehavior {
else
leftInt
=
0
;
if
(
collisionState
.
onGround
)
if
(
collisionState
.
onGround
)
//movement on ground
{
body
.
velocity
=
new
Vector2
(
speed
*
(
rightInt
+
leftInt
),
body
.
velocity
.
y
);
}
else
realSpeed
=
body
.
velocity
.
x
;
if
(
inputState
.
GetButtonValue
(
right
)
||
inputState
.
GetButtonValue
(
left
))
{
realSpeed
=
Mathf
.
Clamp
(
realSpeed
+
speed
*
(
rightInt
+
leftInt
),
-
speed
,
speed
);
}
else
{
if
(
realSpeed
!=
0
)
{
realSpeed
+=
(-
1
)
*
Mathf
.
Sign
(
realSpeed
)
*
friction
;
if
(
Mathf
.
Abs
(
realSpeed
)
<
friction
)
realSpeed
=
0
;
}
}
body
.
velocity
=
new
Vector2
(
realSpeed
,
body
.
velocity
.
y
);
}
else
if
(!
collisionState
.
onWall
)
{
airSpeed
=
body
.
velocity
.
x
;
if
(
inputState
.
GetButtonValue
(
right
)
||
inputState
.
GetButtonValue
(
left
))
{
airSpeed
=
Mathf
.
Clamp
(
airSpeed
+
airAcceleration
*
(
rightInt
+
leftInt
),
-
speed
,
speed
);
if
(
Mathf
.
Abs
(
airSpeed
)
<=
speed
)
airSpeed
=
Mathf
.
Clamp
(
airSpeed
+
airAcceleration
*
(
rightInt
+
leftInt
),
-
speed
,
speed
);
else
{
if
(
airSpeed
!=
0
)
{
airSpeed
+=
(-
1
)
*
Mathf
.
Sign
(
airSpeed
)
*
airAcceleration
;
if
(
Mathf
.
Abs
(
airSpeed
)
<
airAcceleration
)
airSpeed
=
0
;
}
}
}
else
{
...
...
@@ -49,6 +88,45 @@ public class Walk : AbstractBehavior {
}
}
body
.
velocity
=
new
Vector2
(
airSpeed
,
body
.
velocity
.
y
);
}
else
//handles on the wall
{
airSpeed
=
body
.
velocity
.
x
;
//only sets a change if the button has been held for a set time
if
(
rightTime
>=
wallClingTime
)
{
airSpeed
=
Mathf
.
Clamp
(
airSpeed
+
airAcceleration
*
(
rightInt
),
-
speed
,
speed
);
}
if
(
leftTime
>=
wallClingTime
)
{
airSpeed
=
Mathf
.
Clamp
(
airSpeed
+
airAcceleration
*
(
leftInt
),
-
speed
,
speed
);
}
//same as if not on wall and not pressing the buttons
if
(!
inputState
.
GetButtonValue
(
right
)
&&
!
inputState
.
GetButtonValue
(
left
))
{
if
(
airSpeed
!=
0
)
{
airSpeed
+=
(-
1
)
*
Mathf
.
Sign
(
airSpeed
)
*
airAcceleration
;
if
(
Mathf
.
Abs
(
airSpeed
)
<
airAcceleration
)
airSpeed
=
0
;
}
}
body
.
velocity
=
new
Vector2
(
airSpeed
,
body
.
velocity
.
y
);
}
//change localScale depending on direction
if
(
inputState
.
GetButtonValue
(
right
)
&&
inputState
.
GetButtonValue
(
left
))
{
}
else
if
(
inputState
.
GetButtonValue
(
right
))
{
inputState
.
direction
=
Directions
.
Right
;
body
.
transform
.
localScale
=
new
Vector3
(
xScale
,
body
.
transform
.
localScale
.
y
,
body
.
transform
.
localScale
.
z
);
}
else
if
(
inputState
.
GetButtonValue
(
left
))
{
inputState
.
direction
=
Directions
.
Left
;
body
.
transform
.
localScale
=
new
Vector3
(-
xScale
,
body
.
transform
.
localScale
.
y
,
body
.
transform
.
localScale
.
z
);
}
}
}
Birb
@
1a6a7e32
Subproject commit 1a6a7e32dc77552677da1f8b3dd483d3ad2fac55
ProjectSettings/ProjectVersion.txt
0 → 100644
View file @
e61bda3f
<<<<<<< HEAD
m_EditorVersion: 5.5.0f3
=======
m_EditorVersion: 5.3.5f1
m_StandardAssetsVersion: 0
>>>>>>> origin/master
ProjectSettings/TagManager.asset
View file @
e61bda3f
No preview for this file type
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