Commit 460b6859 authored by Eby Komenan's avatar Eby Komenan

Merge branch 'master' of https://git.gmu.edu/gadig/Birb into slowHazard

parents 7eb30a45 4b6bd843
fileFormatVersion: 2
guid: e4a9d79f80fd9a446b4290b9f47ece1f
timeCreated: 1490918557
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 662f53d653f63834597b5983de9d8859
timeCreated: 1492125460
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
......@@ -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: 114201504414302498}
- component: {fileID: 114912600304330566}
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
simulationSpeed: 1
speed: 1
looping: 1
prewarm: 0
playOnAwake: 1
......@@ -3801,7 +3729,7 @@ ParticleSystem:
m_GameObject: {fileID: 1560513321517206}
serializedVersion: 5
lengthInSec: 0.1
simulationSpeed: 1
speed: 1
looping: 0
prewarm: 0
playOnAwake: 1
......
......@@ -66,6 +66,7 @@ public class Dash : AbstractBehavior {
distTraveled /= samples;
return (dashDistance / distTraveled);
}
......
......@@ -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;
......
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;
}
}
fileFormatVersion: 2
guid: a27794eaa09b64942a463f5fa9ccac31
timeCreated: 1490917502
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Busing System.Collections;
fileFormatVersion: 2
guid: 017ab18b4c3d0ea43be073a58863ab7a
timeCreated: 1487896683
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
[LocalizedFileNames]
Lunge_Attack.cs=@Lunge_Attack.cs,0
fileFormatVersion: 2
guid: 5b3d6d680ead1a941852d0097afe0f49
timeCreated: 1487901782
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
......@@ -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 (realSpeed != 0)
if (groundSpeed != 0)
{
realSpeed += (-1) * Mathf.Sign(realSpeed) * friction;
if (Mathf.Abs(realSpeed) < friction)
realSpeed = 0;
groundSpeed += (-1) * Mathf.Sign(groundSpeed) * groundAcceleration * speed;
if (Mathf.Abs(groundSpeed) < groundAcceleration * speed)
groundSpeed = 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;
}
}*/
......

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Birb", "Assembly-CSharp.csproj", "{A490B848-188F-485C-9203-EFF824787523}"
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2015
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment