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
460b6859
Commit
460b6859
authored
Apr 20, 2017
by
Eby Komenan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://git.gmu.edu/gadig/Birb
into slowHazard
parents
7eb30a45
4b6bd843
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
184 additions
and
131 deletions
+184
-131
Assets/Prefabs/Enemy/JumpEnemy.prefab
Assets/Prefabs/Enemy/JumpEnemy.prefab
+0
-0
Assets/Prefabs/Enemy/JumpEnemy.prefab.meta
Assets/Prefabs/Enemy/JumpEnemy.prefab.meta
+8
-0
Assets/Prefabs/Lunge Enemy.prefab
Assets/Prefabs/Lunge Enemy.prefab
+0
-0
Assets/Prefabs/Lunge Enemy.prefab.meta
Assets/Prefabs/Lunge Enemy.prefab.meta
+8
-0
Assets/Prefabs/Player.prefab
Assets/Prefabs/Player.prefab
+26
-98
Assets/Scenes/jumptest.unity
Assets/Scenes/jumptest.unity
+0
-0
Assets/Scripts/Birb/Dash.cs
Assets/Scripts/Birb/Dash.cs
+1
-0
Assets/Scripts/Enemy/BaseEnemy.cs
Assets/Scripts/Enemy/BaseEnemy.cs
+2
-1
Assets/Scripts/Enemy/JumpEnemy.cs
Assets/Scripts/Enemy/JumpEnemy.cs
+62
-0
Assets/Scripts/Enemy/JumpEnemy.cs.meta
Assets/Scripts/Enemy/JumpEnemy.cs.meta
+12
-0
Assets/Scripts/Enemy/Lunge_Attack.cs
Assets/Scripts/Enemy/Lunge_Attack.cs
+0
-0
Assets/Scripts/Enemy/Lunge_Attack.cs.meta
Assets/Scripts/Enemy/Lunge_Attack.cs.meta
+12
-0
Assets/Scripts/Enemy/desktop.ini
Assets/Scripts/Enemy/desktop.ini
+2
-0
Assets/Scripts/Enemy/desktop.ini.meta
Assets/Scripts/Enemy/desktop.ini.meta
+8
-0
Assets/Scripts/Player/Walk.cs
Assets/Scripts/Player/Walk.cs
+36
-22
birb.sln
birb.sln
+7
-10
No files found.
Assets/Prefabs/Enemy/JumpEnemy.prefab
0 → 100644
View file @
460b6859
File added
Assets/Prefabs/Enemy/JumpEnemy.prefab.meta
0 → 100644
View file @
460b6859
fileFormatVersion: 2
guid: e4a9d79f80fd9a446b4290b9f47ece1f
timeCreated: 1490918557
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
Assets/Prefabs/Lunge Enemy.prefab
0 → 100644
View file @
460b6859
File added
Assets/Prefabs/Lunge Enemy.prefab.meta
0 → 100644
View file @
460b6859
fileFormatVersion: 2
guid: 662f53d653f63834597b5983de9d8859
timeCreated: 1492125460
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
Assets/Prefabs/Player.prefab
View file @
460b6859
...
...
@@ -41,22 +41,6 @@ GameObject:
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!1
&1239394936941194
GameObject
:
m_ObjectHideFlags
:
0
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
serializedVersion
:
5
m_Component
:
-
component
:
{
fileID
:
4610411104157988
}
-
component
:
{
fileID
:
114119099780513746
}
m_Layer
:
0
m_Name
:
InputManager
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!1
&1292833923080258
GameObject
:
m_ObjectHideFlags
:
1
...
...
@@ -296,7 +280,7 @@ GameObject:
-
component
:
{
fileID
:
114296284101528218
}
-
component
:
{
fileID
:
114496983445290320
}
-
component
:
{
fileID
:
114468523229820794
}
-
component
:
{
fileID
:
114
201504414302498
}
-
component
:
{
fileID
:
114
912600304330566
}
m_Layer
:
8
m_Name
:
Player
m_TagString
:
Player
...
...
@@ -536,19 +520,6 @@ Transform:
m_Father
:
{
fileID
:
4857202340971982
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!4
&4610411104157988
Transform
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1239394936941194
}
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
:
4766587421979404
}
m_RootOrder
:
1
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!4
&4653745076668720
Transform
:
m_ObjectHideFlags
:
1
...
...
@@ -582,12 +553,11 @@ Transform:
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1784255690954616
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
1
.2
,
y
:
2.77
,
z
:
0
}
m_LocalRotation
:
{
x
:
-0
,
y
:
-0
,
z
:
-
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
1
,
y
:
1
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
-
{
fileID
:
4838104525842692
}
-
{
fileID
:
4610411104157988
}
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
...
...
@@ -915,51 +885,6 @@ Animator:
m_WarningMessage
:
m_HasTransformHierarchy
:
1
m_AllowConstantClipSamplingOptimization
:
1
---
!u!114
&114119099780513746
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1239394936941194
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
5a7bd8d106353a247bd436ee1baa2061
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
inputs
:
-
axisName
:
Horizontal
offValue
:
0
buttons
:
1
condition
:
1
-
axisName
:
Horizontal
offValue
:
0
buttons
:
0
condition
:
0
-
axisName
:
A
offValue
:
0
buttons
:
4
condition
:
0
-
axisName
:
B
offValue
:
0
buttons
:
5
condition
:
0
inputState
:
{
fileID
:
114343537035820548
}
---
!u!114
&114201504414302498
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1784255690954616
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
0cad1638cf0899c4584bad64f0af5112
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
smoothSpeed
:
1
UpBuffer
:
5
DownBuffer
:
5
RightBuffer
:
5
LeftBuffer
:
5
---
!u!114
&114296284101528218
MonoBehaviour
:
m_ObjectHideFlags
:
1
...
...
@@ -975,23 +900,11 @@ MonoBehaviour:
disableScripts
:
[]
dashVelocityCurve
:
serializedVersion
:
2
m_Curve
:
-
serializedVersion
:
2
time
:
0
value
:
1
inSlope
:
0
outSlope
:
0
tangentMode
:
0
-
serializedVersion
:
2
time
:
1
value
:
0.48125005
inSlope
:
0
outSlope
:
0
tangentMode
:
0
m_Curve
:
[]
m_PreInfinity
:
2
m_PostInfinity
:
2
m_RotationOrder
:
0
dashDistance
:
1
m_RotationOrder
:
4
dashDistance
:
0
coolDown
:
1
holdTime
:
1
---
!u!114
&114343537035820548
...
...
@@ -1019,11 +932,10 @@ MonoBehaviour:
inputButtons
:
0100000000000000
disableScripts
:
[]
speed
:
5
airAcceleration
:
0.
5
friction
:
0.5
airAcceleration
:
0.
07
groundAcceleration
:
1
wallClingTime
:
0.25
clingSpeed
:
0.25
realSpeed
:
0
isWallSliding
:
0
---
!u!114
&114496983445290320
MonoBehaviour
:
...
...
@@ -1062,6 +974,22 @@ MonoBehaviour:
m_Bits
:
1
skinWidth
:
0
groundCheckDistance
:
0.1
---
!u!114
&114912600304330566
MonoBehaviour
:
m_ObjectHideFlags
:
1
m_PrefabParentObject
:
{
fileID
:
0
}
m_PrefabInternal
:
{
fileID
:
100100000
}
m_GameObject
:
{
fileID
:
1784255690954616
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
0cad1638cf0899c4584bad64f0af5112
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
smoothSpeed
:
1
UpBuffer
:
5
DownBuffer
:
5
RightBuffer
:
5
LeftBuffer
:
5
---
!u!137
&137216855547286664
SkinnedMeshRenderer
:
m_ObjectHideFlags
:
1
...
...
@@ -1164,7 +1092,7 @@ ParticleSystem:
m_GameObject
:
{
fileID
:
1812230161422426
}
serializedVersion
:
5
lengthInSec
:
0.1
s
imulationS
peed
:
1
speed
:
1
looping
:
1
prewarm
:
0
playOnAwake
:
1
...
...
@@ -3801,7 +3729,7 @@ ParticleSystem:
m_GameObject
:
{
fileID
:
1560513321517206
}
serializedVersion
:
5
lengthInSec
:
0.1
s
imulationS
peed
:
1
speed
:
1
looping
:
0
prewarm
:
0
playOnAwake
:
1
...
...
Assets/Scenes/jumptest.unity
View file @
460b6859
No preview for this file type
Assets/Scripts/Birb/Dash.cs
View file @
460b6859
...
...
@@ -66,6 +66,7 @@ public class Dash : AbstractBehavior {
distTraveled
/=
samples
;
return
(
dashDistance
/
distTraveled
);
}
...
...
Assets/Scripts/Enemy/BaseEnemy.cs
View file @
460b6859
...
...
@@ -8,7 +8,8 @@ public class BaseEnemy : MonoBehaviour {
public
float
speed
=
2f
;
public
float
maxMoveDistance
=
5f
;
protected
float
moveDistanceLeft
;
Rigidbody2D
body
;
public
Rigidbody2D
body
;
protected
SpriteRenderer
sr
;
protected
float
startMoveTime
;
public
Transform
rightCollisionPos
;
...
...
Assets/Scripts/Enemy/JumpEnemy.cs
0 → 100644
View file @
460b6859
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
public
class
JumpEnemy
:
BaseEnemy
{
public
float
jumpHeight
=
5f
;
private
Vector2
gravity
;
public
bool
onGround
=
false
;
public
bool
isJumping
=
false
;
public
float
jumpIntervalTime
=
5f
;
//Time it takes after enemy lands and before it jumps again
// Use this for initialization
void
Start
()
{
// rightCollisionPos = body.transform;
body
=
GetComponent
<
Rigidbody2D
>();
gravity
=
Physics2D
.
gravity
;
}
// Update is called once per frame
void
Update
()
{
if
(
onGround
&&
!
isJumping
)
{
isJumping
=
true
;
StartCoroutine
(
"Jump"
);
}
}
IEnumerator
Jump
()
{
yield
return
new
WaitForSeconds
(
jumpIntervalTime
);
float
verticalVelocity
;
verticalVelocity
=
Mathf
.
Sqrt
(
2
*
-
gravity
.
y
*
jumpHeight
);
if
(
onGround
)
body
.
velocity
=
new
Vector2
(
body
.
velocity
.
x
,
verticalVelocity
);
yield
return
new
WaitForSeconds
(
0.1f
);
isJumping
=
false
;
}
void
OnCollisionStay2D
(
Collision2D
collision
)
{
onGround
=
false
;
foreach
(
ContactPoint2D
contact
in
collision
.
contacts
)
{
Vector2
normal
=
contact
.
normal
;
if
(
normal
==
Vector2
.
up
)
{
onGround
=
true
;
}
}
}
void
OnCollisionExit2D
()
{
onGround
=
false
;
}
}
Assets/Scripts/Enemy/JumpEnemy.cs.meta
0 → 100644
View file @
460b6859
fileFormatVersion: 2
guid: a27794eaa09b64942a463f5fa9ccac31
timeCreated: 1490917502
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/Enemy/Lunge_Attack.cs
0 → 100644
View file @
460b6859
B
using
System.Collections
;
Assets/Scripts/Enemy/Lunge_Attack.cs.meta
0 → 100644
View file @
460b6859
fileFormatVersion: 2
guid: 017ab18b4c3d0ea43be073a58863ab7a
timeCreated: 1487896683
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/Enemy/desktop.ini
0 → 100644
View file @
460b6859
[LocalizedFileNames]
Lunge_Attack.cs
=
@Lunge_Attack.cs,0
Assets/Scripts/Enemy/desktop.ini.meta
0 → 100644
View file @
460b6859
fileFormatVersion: 2
guid: 5b3d6d680ead1a941852d0097afe0f49
timeCreated: 1487901782
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/Player/Walk.cs
View file @
460b6859
...
...
@@ -5,12 +5,15 @@ using UnityEngine;
public
class
Walk
:
AbstractBehavior
{
public
float
speed
;
private
float
airSpeed
;
public
float
airAcceleration
;
public
float
friction
;
public
float
wallClingTime
;
//time you will 'stick' to the wall after releasing slide button
private
float
groundSpeed
;
public
float
airAcceleration
;
//float from 0.0 to 1.0
public
float
groundAcceleration
;
//float from 0.0 to 1.0
public
float
wallClingTime
;
//time you will 'stick' to the wall after pressing the opposite direction
public
float
clingSpeed
=
0.1f
;
public
float
realSpeed
;
//
public float realSpeed;
public
bool
isWallSliding
=
false
;
private
int
rightInt
=
0
;
...
...
@@ -49,23 +52,34 @@ public class Walk : AbstractBehavior {
if
(
collisionState
.
onGround
)
//movement on ground
{
realSpeed
=
body
.
velocity
.
x
;
if
(
inputState
.
GetButtonValue
(
right
)
||
inputState
.
GetButtonValue
(
left
))
{
realSpeed
=
Mathf
.
Clamp
(
realSpeed
+
speed
*
(
rightInt
+
leftInt
),
-
speed
,
speed
);
}
else
groundSpeed
=
body
.
velocity
.
x
;
if
(
inputState
.
GetButtonValue
(
right
)
||
inputState
.
GetButtonValue
(
left
))
{
if
(
Mathf
.
Abs
(
groundSpeed
)
<=
speed
)
groundSpeed
=
Mathf
.
Clamp
(
groundSpeed
+
groundAcceleration
*
speed
*
(
rightInt
+
leftInt
),
-
speed
,
speed
);
else
{
if
(
groundSpeed
!=
0
)
{
groundSpeed
+=
(-
1
)
*
Mathf
.
Sign
(
groundSpeed
)
*
groundAcceleration
*
speed
;
if
(
Mathf
.
Abs
(
groundSpeed
)
<
groundAcceleration
*
speed
)
groundSpeed
=
0
;
}
}
}
else
// ground deceleration while pressing nothing
{
if
(
real
Speed
!=
0
)
if
(
ground
Speed
!=
0
)
{
realSpeed
+=
(-
1
)
*
Mathf
.
Sign
(
realSpeed
)
*
friction
;
if
(
Mathf
.
Abs
(
realSpeed
)
<
friction
)
real
Speed
=
0
;
groundSpeed
+=
(-
1
)
*
Mathf
.
Sign
(
groundSpeed
)
*
groundAcceleration
*
speed
;
if
(
Mathf
.
Abs
(
groundSpeed
)
<
groundAcceleration
*
speed
)
ground
Speed
=
0
;
}
}
body
.
velocity
=
new
Vector2
(
realSpeed
,
body
.
velocity
.
y
);
}
body
.
velocity
=
new
Vector2
(
groundSpeed
,
body
.
velocity
.
y
);
}
//in air and not sliding
else
if
(!
collisionState
.
onWall
||
body
.
velocity
.
y
>
0
)
{
...
...
@@ -75,13 +89,13 @@ public class Walk : AbstractBehavior {
if
(
inputState
.
GetButtonValue
(
right
)
||
inputState
.
GetButtonValue
(
left
))
{
if
(
Mathf
.
Abs
(
airSpeed
)
<=
speed
)
airSpeed
=
Mathf
.
Clamp
(
airSpeed
+
airAcceleration
*
(
rightInt
+
leftInt
),
-
speed
,
speed
);
airSpeed
=
Mathf
.
Clamp
(
airSpeed
+
airAcceleration
*
speed
*
(
rightInt
+
leftInt
),
-
speed
,
speed
);
else
{
if
(
airSpeed
!=
0
)
{
airSpeed
+=
(-
1
)
*
Mathf
.
Sign
(
airSpeed
)
*
airAcceleration
;
if
(
Mathf
.
Abs
(
airSpeed
)
<
airAcceleration
)
airSpeed
+=
(-
1
)
*
Mathf
.
Sign
(
airSpeed
)
*
airAcceleration
*
speed
;
if
(
Mathf
.
Abs
(
airSpeed
)
<
airAcceleration
*
speed
)
airSpeed
=
0
;
}
}
...
...
@@ -90,8 +104,8 @@ public class Walk : AbstractBehavior {
{
if (airSpeed != 0)
{
airSpeed += (-1) * Mathf.Sign(airSpeed) * airAcceleration;
if (Mathf.Abs(airSpeed) < airAcceleration)
airSpeed += (-1) * Mathf.Sign(airSpeed) * airAcceleration
* speed
;
if (Mathf.Abs(airSpeed) < airAcceleration
* speed
)
airSpeed = 0;
}
}*/
...
...
birb.sln
View file @
460b6859
Microsoft Visual Studio Solution File, Format Version 1
1
.00
# Visual Studio 201
0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Birb", "
Assembly-CSharp.csproj", "{A490B848-188F-485C-9203-EFF824787523
}"
Microsoft Visual Studio Solution File, Format Version 1
2
.00
# Visual Studio 201
5
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Birb", "
Birb.csproj", "{0E1C9E80-2222-A473-1DED-289BBAAF06DC
}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
...
...
@@ -9,15 +9,12 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{
A490B848-188F-485C-9203-EFF824787523
}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{
A490B848-188F-485C-9203-EFF824787523
}.Debug|Any CPU.Build.0 = Debug|Any CPU
{
A490B848-188F-485C-9203-EFF824787523
}.Release|Any CPU.ActiveCfg = Release|Any CPU
{
A490B848-188F-485C-9203-EFF824787523
}.Release|Any CPU.Build.0 = Release|Any CPU
{
0E1C9E80-2222-A473-1DED-289BBAAF06DC
}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{
0E1C9E80-2222-A473-1DED-289BBAAF06DC
}.Debug|Any CPU.Build.0 = Debug|Any CPU
{
0E1C9E80-2222-A473-1DED-289BBAAF06DC
}.Release|Any CPU.ActiveCfg = Release|Any CPU
{
0E1C9E80-2222-A473-1DED-289BBAAF06DC
}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Assembly-CSharp.csproj
EndGlobalSection
EndGlobal
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