mirror of
https://github.com/ConjureETS/PixelSphinx.git
synced 2026-03-25 19:10:58 +00:00
Started implementing and animating the character
This commit is contained in:
parent
578963f0a6
commit
616594cab8
BIN
Assets/Art/T_Char_02.png
Normal file
BIN
Assets/Art/T_Char_02.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 104 KiB |
57
Assets/Art/T_Char_02.png.meta
Normal file
57
Assets/Art/T_Char_02.png.meta
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 028cce0260747214d81db557ec6f37c4
|
||||||
|
timeCreated: 1460100052
|
||||||
|
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: -1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
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: 0, y: 0, z: 0, w: 0}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
textureType: 8
|
||||||
|
buildTargetSettings: []
|
||||||
|
spriteSheet:
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Art/T_Char_Dash_02.png
Normal file
BIN
Assets/Art/T_Char_Dash_02.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
57
Assets/Art/T_Char_Dash_02.png.meta
Normal file
57
Assets/Art/T_Char_Dash_02.png.meta
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 877352de2811c3e46b8b58e2475e07b3
|
||||||
|
timeCreated: 1460100053
|
||||||
|
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: -1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
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: 0, y: 0, z: 0, w: 0}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
textureType: 8
|
||||||
|
buildTargetSettings: []
|
||||||
|
spriteSheet:
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Art/T_Planet_Center.png
Normal file
BIN
Assets/Art/T_Planet_Center.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
57
Assets/Art/T_Planet_Center.png.meta
Normal file
57
Assets/Art/T_Planet_Center.png.meta
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 545c8c8845e75b44087e8546737ac074
|
||||||
|
timeCreated: 1460102042
|
||||||
|
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: -1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
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: 0, y: 0, z: 0, w: 0}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
textureType: 8
|
||||||
|
buildTargetSettings: []
|
||||||
|
spriteSheet:
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Art/T_Satelite_01.png
Normal file
BIN
Assets/Art/T_Satelite_01.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
57
Assets/Art/T_Satelite_01.png.meta
Normal file
57
Assets/Art/T_Satelite_01.png.meta
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: adc5fe6c93bdded4bb5dc5e25191dbfc
|
||||||
|
timeCreated: 1460100053
|
||||||
|
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: -1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
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: 0, y: 0, z: 0, w: 0}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
textureType: 8
|
||||||
|
buildTargetSettings: []
|
||||||
|
spriteSheet:
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Prefabs/Astronaut.prefab
Normal file
BIN
Assets/Prefabs/Astronaut.prefab
Normal file
Binary file not shown.
8
Assets/Prefabs/Astronaut.prefab.meta
Normal file
8
Assets/Prefabs/Astronaut.prefab.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: acd71c7b2f995984d9033c9dc4e257dc
|
||||||
|
timeCreated: 1460102262
|
||||||
|
licenseType: Free
|
||||||
|
NativeFormatImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1 +0,0 @@
|
|||||||
tst
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: afc3ba2bd5b70194e9fb05d80712eecb
|
|
||||||
timeCreated: 1460091048
|
|
||||||
licenseType: Pro
|
|
||||||
TextScriptImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
142
Assets/Scripts/Astronaut.cs
Normal file
142
Assets/Scripts/Astronaut.cs
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
|
||||||
|
public class Astronaut : MonoBehaviour {
|
||||||
|
|
||||||
|
private enum AstronautState
|
||||||
|
{
|
||||||
|
Idle, Walking, Jumping, Dashing, Ejecting, Dead
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameObject Rotator;
|
||||||
|
public GameObject SpriteWalk;
|
||||||
|
public GameObject SpriteDash;
|
||||||
|
|
||||||
|
public float StepTime;
|
||||||
|
public float JumpSpeed;
|
||||||
|
|
||||||
|
private AstronautState _state;
|
||||||
|
private AstronautState State
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _state;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
AstronautState oldState = _state;
|
||||||
|
_state = value;
|
||||||
|
|
||||||
|
if (oldState == _state) return;
|
||||||
|
|
||||||
|
if (oldState == AstronautState.Dashing)
|
||||||
|
{
|
||||||
|
SpriteWalk.SetActive(false);
|
||||||
|
SpriteDash.SetActive(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SpriteWalk.SetActive(true);
|
||||||
|
SpriteDash.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_state == AstronautState.Walking)
|
||||||
|
{
|
||||||
|
StartCoroutine(WalkingStance());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private float vSpeed = 0;
|
||||||
|
private float height = 0;
|
||||||
|
private float angle = 0;
|
||||||
|
private float walkTime = 0;
|
||||||
|
|
||||||
|
private int nextStep = 1;
|
||||||
|
|
||||||
|
// Use this for initialization
|
||||||
|
void Start () {
|
||||||
|
State = AstronautState.Idle;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update () {
|
||||||
|
|
||||||
|
/*
|
||||||
|
switch (State)
|
||||||
|
{
|
||||||
|
case AstronautState.Dashing:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case AstronautState.Ejecting:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case AstronautState.Idle:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case AstronautState.Jumping:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case AstronautState.Walking:
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Move(float x, float y)
|
||||||
|
{
|
||||||
|
if (State >= AstronautState.Ejecting )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (State < AstronautState.Jumping)
|
||||||
|
{
|
||||||
|
if (Mathf.Approximately(x, 0))
|
||||||
|
{
|
||||||
|
State = AstronautState.Idle;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Log("walking");
|
||||||
|
State = AstronautState.Walking;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Jump()
|
||||||
|
{
|
||||||
|
if (_state >= AstronautState.Ejecting)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dash()
|
||||||
|
{
|
||||||
|
if (_state >= AstronautState.Ejecting)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnGUI()
|
||||||
|
{
|
||||||
|
if (GUI.Button(new Rect(10, 10, 150, 50), State.ToString()))
|
||||||
|
Debug.Log("Clicked the button with an image");
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerator WalkingStance()
|
||||||
|
{
|
||||||
|
Debug.Log("walking stance");
|
||||||
|
walkTime += Time.deltaTime / StepTime;
|
||||||
|
while (State <= AstronautState.Walking && walkTime <= 1f)
|
||||||
|
{
|
||||||
|
Vector3 rotation = transform.rotation.eulerAngles;
|
||||||
|
rotation.z = Mathf.Sin(walkTime*Mathf.PI);
|
||||||
|
transform.rotation = Quaternion.Euler(rotation);
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*walkTime = 0f;
|
||||||
|
if(State == AstronautState.Walking)
|
||||||
|
{
|
||||||
|
StartCoroutine("WalkingStance");
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Assets/Scripts/Astronaut.cs.meta
Normal file
12
Assets/Scripts/Astronaut.cs.meta
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8c32c40e0b8e5eb47bb7a91068af09ca
|
||||||
|
timeCreated: 1460098199
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
69
Assets/Scripts/AstronautController.cs
Normal file
69
Assets/Scripts/AstronautController.cs
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
using InputHandler;
|
||||||
|
|
||||||
|
[RequireComponent(typeof(Astronaut))]
|
||||||
|
public class AstronautController : MonoBehaviour {
|
||||||
|
|
||||||
|
private Astronaut _astronaut;
|
||||||
|
|
||||||
|
public int PlayerNumber;
|
||||||
|
|
||||||
|
// Use this for initialization
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
InputManager.Instance.PushActiveContext("Gameplay", PlayerNumber);
|
||||||
|
InputManager.Instance.AddCallback(PlayerNumber, HandlePlayerAxis);
|
||||||
|
InputManager.Instance.AddCallback(PlayerNumber, HandlePlayerButtons);
|
||||||
|
|
||||||
|
_astronaut = GetComponent<Astronaut>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandlePlayerAxis(MappedInput input)
|
||||||
|
{
|
||||||
|
if (this == null) return;
|
||||||
|
|
||||||
|
// movement
|
||||||
|
|
||||||
|
float xValue = 0f;
|
||||||
|
|
||||||
|
if (input.Ranges.ContainsKey("MoveLeft"))
|
||||||
|
{
|
||||||
|
xValue = -input.Ranges["MoveLeft"];
|
||||||
|
}
|
||||||
|
else if (input.Ranges.ContainsKey("MoveRight"))
|
||||||
|
{
|
||||||
|
xValue = input.Ranges["MoveRight"];
|
||||||
|
}
|
||||||
|
|
||||||
|
float yValue = 0f;
|
||||||
|
|
||||||
|
if (input.Ranges.ContainsKey("MoveUp"))
|
||||||
|
{
|
||||||
|
yValue = input.Ranges["MoveUp"];
|
||||||
|
}
|
||||||
|
else if (input.Ranges.ContainsKey("MoveDown"))
|
||||||
|
{
|
||||||
|
yValue = -input.Ranges["MoveDown"];
|
||||||
|
}
|
||||||
|
|
||||||
|
_astronaut.Move(xValue, yValue);
|
||||||
|
|
||||||
|
if (input.Ranges.ContainsKey("Dash"))
|
||||||
|
{
|
||||||
|
if(input.Ranges["Dash"] > 0.8f)
|
||||||
|
_astronaut.Dash();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandlePlayerButtons(MappedInput input)
|
||||||
|
{
|
||||||
|
if (this == null) return;
|
||||||
|
|
||||||
|
if (input.Actions.Contains("Jump"))
|
||||||
|
{
|
||||||
|
_astronaut.Jump();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
12
Assets/Scripts/AstronautController.cs.meta
Normal file
12
Assets/Scripts/AstronautController.cs.meta
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ab270b0cb2475114ab8eb45661af0df1
|
||||||
|
timeCreated: 1460097909
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1 +0,0 @@
|
|||||||
tst
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 6681384214c3a3e4a90c112542387b03
|
|
||||||
timeCreated: 1460091047
|
|
||||||
licenseType: Pro
|
|
||||||
TextScriptImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
BIN
Assets/Test/FloorTest.mat
Normal file
BIN
Assets/Test/FloorTest.mat
Normal file
Binary file not shown.
8
Assets/Test/FloorTest.mat.meta
Normal file
8
Assets/Test/FloorTest.mat.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 48b3602a683827541bcc7e6753cd9aa8
|
||||||
|
timeCreated: 1460102495
|
||||||
|
licenseType: Free
|
||||||
|
NativeFormatImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user