1
0

made the main character "better" by implementing the code that i've worked on.

This commit is contained in:
Valtorix5 2016-01-30 19:24:40 -05:00
parent d599262b83
commit e264e14cbb
26 changed files with 264 additions and 81 deletions

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: b8bd620c56d8a7d429cd41f9866067af
guid: ce596df701a44b34299f8c062c342bc9
folderAsset: yes
timeCreated: 1454180533
timeCreated: 1454187697
licenseType: Free
DefaultImporter:
userData:

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -0,0 +1,57 @@
fileFormatVersion: 2
guid: 96fc4e397a3ff194dab5afcd8493b287
timeCreated: 1454188080
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 32
textureSettings:
filterMode: 0
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 78, y: 76, z: 113, w: 34}
spritePixelsToUnits: 32
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -10,9 +10,9 @@ public class CharacterMovement : MonoBehaviour {
public bool changeBox = false;
public bool isStarted = false;
float timeRemainingTransparency = 5;
float timeRemainingTransfer = 5;
float checkTimeRemaining = 5;
private float timeRemainingTransparency = 5;
private float timeRemainingTransfer = 5;
private float checkTimeRemaining = 5;
public Transform sightStart, sightEnd;
@ -35,7 +35,7 @@ public class CharacterMovement : MonoBehaviour {
// Update is called once per frame
void Update ()
{
Movement();
//Movement();
powerTransparency();
powerTransfer();
@ -46,26 +46,31 @@ public class CharacterMovement : MonoBehaviour {
// print("IS starting: " + isStarted);
}
void Movement()
public void Movement()
{
//Is going to handle all the character movement
if(Input.GetKey(KeyCode.D))
{
transform.Translate(Vector2.right * 4f * Time.deltaTime); //Makes it to where the player can travel to the right
transform.eulerAngles = new Vector2(0,0); //this allows the "rotation" of the sprite, facing right / left
}
//if(Input.GetKey(KeyCode.D))
//{
// transform.Translate(Vector2.right * 4f * Time.deltaTime); //Makes it to where the player can travel to the right
// transform.eulerAngles = new Vector2(0,0); //this allows the "rotation" of the sprite, facing right / left
//}
if (Input.GetKey(KeyCode.A))
{
transform.Translate(Vector2.left * -4f * Time.deltaTime); //Makes it to where the player can travel to the left
transform.eulerAngles = new Vector2(0, 180);
}
//if (Input.GetKey(KeyCode.A))
//{
// transform.Translate(Vector2.left * -4f * Time.deltaTime); //Makes it to where the player can travel to the left
// transform.eulerAngles = new Vector2(0, 180);
//}
if (Input.GetKeyDown(KeyCode.T))
{
print("Got teleport key.");
powerTeleport();
}
if (Input.GetKeyDown(KeyCode.F))
{
print("got shit");
if (canPass == true)
canPass = false;
else
@ -75,21 +80,19 @@ public class CharacterMovement : MonoBehaviour {
if (Input.GetKeyDown(KeyCode.G))
{
print("got nodda");
if (changeBox == true)
changeBox = false;
else
changeBox = true;
}
}
void powerTransfer()
public void powerTransfer()
{
//Transfer (enabling the player to "transfer" thier "hit" box behind them)
print("got transfer");
if (changeBox == true && timeRemainingTransfer >= 0.0 )
{
GetComponent<BoxCollider2D>().offset = new Vector2(secondBoxX, secondBoxY);
@ -106,12 +109,13 @@ public class CharacterMovement : MonoBehaviour {
}
void powerTransparency()
{
public void powerTransparency()
{
//Transparency (enabling the player to "glitch" through certain boundaries.)
print("got transparency");
if (canPass == true && timeRemainingTransparency >= 0.0)
{
Physics2D.IgnoreLayerCollision(8, 10, true);
Physics2D.IgnoreLayerCollision(8, 10, true); //Make sure that the "barriers" that the player needs to "phase" through are part of the barrier layer.
timeRemainingTransparency -= Time.deltaTime;
}
else
@ -123,7 +127,7 @@ public class CharacterMovement : MonoBehaviour {
//still need to work on "re increasing" the time remaining variable.
}
void powerTeleport()
public void powerTeleport()
{
//Teleportation (enabling teh player to teleport to a location ahead of him.)
Debug.DrawLine(sightStart.position, sightEnd.position, Color.red);

View File

@ -1,6 +0,0 @@
fileFormatVersion: 2
guid: acf5e119c54034bd8bfbd5f21cc246db
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:

View File

@ -1,10 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!62 &6200000
PhysicsMaterial2D:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: BouncyBox
friction: .400000006
bounciness: .400000006

View File

@ -1,5 +0,0 @@
fileFormatVersion: 2
guid: 8be6341e1ce3f4cec9902bc34f72d20a
NativeFormatImporter:
userData:
assetBundleName:

View File

@ -1,10 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!62 &6200000
PhysicsMaterial2D:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Slippery
friction: 0
bounciness: 0

View File

@ -1,5 +0,0 @@
fileFormatVersion: 2
guid: 3626fe8e008014f6bbd19bb72937b311
NativeFormatImporter:
userData:
assetBundleName:

View File

@ -1,10 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!62 &6200000
PhysicsMaterial2D:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Sticky
friction: 1
bounciness: 0

View File

@ -1,5 +0,0 @@
fileFormatVersion: 2
guid: 0cb77231a430b454fb792ff7ffcc3943
NativeFormatImporter:
userData:
assetBundleName:

View File

@ -5,11 +5,12 @@ using UnityStandardAssets.CrossPlatformInput;
namespace UnityStandardAssets._2D
{
[RequireComponent(typeof (PlatformerCharacter2D))]
public class Platformer2DUserControl : MonoBehaviour
public class Platformer2DUserControl : CharacterMovement
{
private PlatformerCharacter2D m_Character;
private bool m_Jump;
public bool canMove;
private void Awake()
{
@ -19,11 +20,17 @@ namespace UnityStandardAssets._2D
private void Update()
{
// calling stuff in from the Character Movement class
Movement();
powerTransparency();
powerTransfer();
if (!m_Jump)
{
// Read the jump input in Update so button presses aren't missed.
m_Jump = CrossPlatformInputManager.GetButtonDown("Jump");
}
}

View File

@ -20,6 +20,8 @@ namespace UnityStandardAssets._2D
private Rigidbody2D m_Rigidbody2D;
private bool m_FacingRight = true; // For determining which way the player is currently facing.
private void Awake()
{
// Setting up references.
@ -51,6 +53,8 @@ namespace UnityStandardAssets._2D
public void Move(float move, bool crouch, bool jump)
{
// If crouching, check to see if the character can stand up
if (!crouch && m_Anim.GetBool("Crouch"))
{

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 046e2c14dbc44814e91a3f104505dac1
folderAsset: yes
timeCreated: 1454187690
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,6 @@
Hey There!
Who are you?
Oh, the strong silent type huh?
That's okay I guess....

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2658e6216aeaa58468c6f11c2fbe3569
timeCreated: 1454192267
licenseType: Free
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
This is a test.
You're a punk ass bitch.
Who lives in the ditch.
Duhhhhhh.
Even more...

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5490bae2cff395e44ba830b866dd5aec
timeCreated: 1454187731
licenseType: Free
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,75 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class TextBoxManager : MonoBehaviour {
public GameObject textBox;
public Text theText;
public TextAsset textfile;
public string[] textLines;
public int currentLine;
public int endAtLine;
public PlayerCharacter player;
public bool isActive;
public bool stopPlayerMovement;
// Use this for initialization
void Start()
{
player = FindObjectOfType<PlayerCharacter>();
if (textfile != null)
{
textLines = (textfile.text.Split('\n'));
}
if (endAtLine == 0)
{
endAtLine = textLines.Length - 1;
}
if(isActive)
{
EnableTextBox();
}
else
{
DisableTextBox();
}
}
void Update()
{
if (!isActive)
return;
theText.text = textLines[currentLine];
if (Input.GetKeyDown(KeyCode.Space))
currentLine++;
if (currentLine > endAtLine)
DisableTextBox();
}
public void EnableTextBox()
{
textBox.SetActive(true);
if (stopPlayerMovement)
player.canMove = false;
}
public void DisableTextBox()
{
textBox.SetActive(false); //Once we get to the end of the "lines" we turn off the text block.
player.canMove = true;
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: a5073582953b45b4e9dabca61f96ee90
timeCreated: 1454189542
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,21 @@
using UnityEngine;
using System.Collections;
public class TextImporter : MonoBehaviour {
public TextAsset textfile;
public string[] textLines;
// Use this for initialization
void Start () {
if(textfile != null)
{
textLines = (textfile.text.Split('\n'));
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 0e1637f02d72a3c47b9c2705714b2114
timeCreated: 1454188838
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -14,7 +14,7 @@ public class PlayerCharacter : Controller, ISceneObject {
// TPC Editor Variables
public float surfaceNormalAngleThreshold, jumpMagnitude, chargeSpeedModifier, wallRayCastDistance;
private float distanceToWall;
public bool canMove;
public void Initialize()
{
// Put initialization code here.
@ -30,6 +30,7 @@ public class PlayerCharacter : Controller, ISceneObject {
wallHit = new RaycastHit();
joystickMovement = Vector2.zero;
jumpMovement = Vector2.zero;
}
public void ObjectUpdate()
@ -38,6 +39,9 @@ public class PlayerCharacter : Controller, ISceneObject {
movementVector = GameManager.iManager.movementVector; // Shorthand for the InputManager's movement vector.
movementIntensity = GameManager.iManager.movementIntensity;
if (!canMove)
return;
// Put update code here.
if(movementIntensity > 0.0f)
{

View File

@ -1,2 +1,2 @@
m_EditorVersion: 5.3.1f1
m_EditorVersion: 5.3.2f1
m_StandardAssetsVersion: 0

Binary file not shown.