mirror of
https://github.com/zoriya/Switching-Personalities.git
synced 2026-05-31 00:55:20 +00:00
Adding sound, sacrifice and many things.
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
@@ -0,0 +1,88 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d9e94f12cddd2d0449ae9d97b7ed4ad1
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 7
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: a6145c4f6b69eaf4fa2e2ea266aa4000
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,114 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 1963317689336446}
|
||||
m_IsPrefabAsset: 1
|
||||
--- !u!1 &1963317689336446
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4607566256570114}
|
||||
- component: {fileID: 212321071820534398}
|
||||
- component: {fileID: 61887489293636534}
|
||||
m_Layer: 8
|
||||
m_Name: Checkpoint
|
||||
m_TagString: CheckPoint
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4607566256570114
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1963317689336446}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 11, y: 7.5, z: 0}
|
||||
m_LocalScale: {x: 0.323, y: 0.323, z: 0.323}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!61 &61887489293636534
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1963317689336446}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 1
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 4.36, y: 4.98}
|
||||
newSize: {x: 4.36, y: 4.98}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 4.36, y: 4.98}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!212 &212321071820534398
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1963317689336446}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RenderingLayerMask: 4294967295
|
||||
m_Materials:
|
||||
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 0
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: d9e94f12cddd2d0449ae9d97b7ed4ad1, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 4.36, y: 4.98}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d4cd711f7b043c34fac92fcb54b23602
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 100100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -24,7 +24,7 @@ GameObject:
|
||||
- component: {fileID: 61265863616950446}
|
||||
m_Layer: 10
|
||||
m_Name: SlowProjectile
|
||||
m_TagString: Untagged
|
||||
m_TagString: Projectile
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
|
||||
+2062
-585
File diff suppressed because it is too large
Load Diff
+229
-54
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
[RequireComponent(typeof(Rigidbody2D))]
|
||||
public class PlayerMovement : MonoBehaviour
|
||||
@@ -19,6 +20,16 @@ public class PlayerMovement : MonoBehaviour
|
||||
public new SpriteRenderer renderer;
|
||||
public Animator animator;
|
||||
|
||||
[Space]
|
||||
[Header("Audio")]
|
||||
public AudioSource effectSource;
|
||||
public AudioClip dmgClip;
|
||||
public AudioClip checkpointClip;
|
||||
public AudioClip deathClip;
|
||||
public AudioClip selectClip;
|
||||
public AudioClip tpClip;
|
||||
|
||||
[Space]
|
||||
[Space]
|
||||
[Header("Double Jump")]
|
||||
public float doubleJumpForce = 8;
|
||||
@@ -60,10 +71,14 @@ public class PlayerMovement : MonoBehaviour
|
||||
public GameObject healer;
|
||||
public GameObject parry;
|
||||
public GameObject hook;
|
||||
public SpriteRenderer PersonalityRenderer;
|
||||
public Sprite[] PersonalitySprites;
|
||||
public GameObject DeathScreen;
|
||||
public GameObject[] HealPoints;
|
||||
public TextMeshProUGUI Info;
|
||||
public GameObject Dialog;
|
||||
public GameObject KeyInventory;
|
||||
public GameObject SacrificeDialog;
|
||||
private Personalty switchingTo;
|
||||
|
||||
private Personalty personalty;
|
||||
@@ -73,25 +88,20 @@ public class PlayerMovement : MonoBehaviour
|
||||
private int flip = 1;
|
||||
private bool switching = false;
|
||||
private bool parrying = false;
|
||||
public bool useController = false;
|
||||
private bool useController = false;
|
||||
private bool teleporting = false;
|
||||
private bool sacrifice = false;
|
||||
private List<Item> items = new List<Item>();
|
||||
private List<Personalty> sacrified = new List<Personalty>();
|
||||
private Interactable interactable;
|
||||
private Rigidbody2D rb;
|
||||
private new BoxCollider2D collider;
|
||||
|
||||
private async void Start()
|
||||
private void Start()
|
||||
{
|
||||
rb = GetComponent<Rigidbody2D>();
|
||||
collider = GetComponentInChildren<BoxCollider2D>();
|
||||
checkPoint = transform.position;
|
||||
|
||||
if (Input.GetJoystickNames().Length > 0)
|
||||
{
|
||||
useController = true;
|
||||
Info.text = "Gamepad detected, setting keybind for the gamepad. Don't want to use the gamepad ? Press Escape to switch back to the keyboard.";
|
||||
Info.gameObject.SetActive(true);
|
||||
await Task.Delay(5000);
|
||||
Info.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsGrounded
|
||||
@@ -134,47 +144,46 @@ public class PlayerMovement : MonoBehaviour
|
||||
|
||||
private void Update ()
|
||||
{
|
||||
if(Time.timeScale == 0)
|
||||
if (sacrifice)
|
||||
{
|
||||
if (Input.anyKeyDown)
|
||||
if (Input.GetButtonDown("Interact"))
|
||||
{
|
||||
transform.position = checkPoint;
|
||||
renderer.enabled = true;
|
||||
|
||||
HealPoint = 5;
|
||||
foreach (GameObject hp in HealPoints)
|
||||
hp.SetActive(true);
|
||||
|
||||
sacrifice = false;
|
||||
Time.timeScale = 1;
|
||||
DeathScreen.SetActive(false);
|
||||
SacrificeDialog.SetActive(false);
|
||||
switchMenu.SetActive(false);
|
||||
none.SetActive(true);
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//Switch from keyboard to controller and vice versa
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
if (useController)
|
||||
else if (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.JoystickButton0))
|
||||
{
|
||||
useController = false;
|
||||
SwitchToKeyboard();
|
||||
}
|
||||
else
|
||||
{
|
||||
useController = true;
|
||||
SwitchToController();
|
||||
sacrifice = false;
|
||||
Time.timeScale = 1;
|
||||
SacrificeDialog.SetActive(false);
|
||||
switchMenu.SetActive(false);
|
||||
none.SetActive(true);
|
||||
sacrified.Add(switchingTo);
|
||||
if (switchingTo == Personalty.DoubleJump)
|
||||
doubleJump.SetActive(false);
|
||||
else if (switchingTo == Personalty.Heal)
|
||||
healer.SetActive(false);
|
||||
else if (switchingTo == Personalty.Hook)
|
||||
hook.SetActive(false);
|
||||
else if (switchingTo == Personalty.Parry)
|
||||
parry.SetActive(false);
|
||||
else if (switchingTo == Personalty.Run)
|
||||
run.SetActive(false);
|
||||
else if (switchingTo == Personalty.SlowProj)
|
||||
slowProj.SetActive(false);
|
||||
|
||||
switchingTo = Personalty.Normal;
|
||||
|
||||
personalty = Personalty.Normal;
|
||||
PersonalityRenderer.sprite = PersonalitySprites[(int)Personalty.Normal];
|
||||
}
|
||||
}
|
||||
|
||||
//Personality Switch
|
||||
if (Input.GetButtonDown("SwitchMenu"))
|
||||
{
|
||||
switchMenu.SetActive(true);
|
||||
Time.timeScale = 0.05f;
|
||||
switching = true;
|
||||
}
|
||||
else if (switching)
|
||||
if(sacrifice || switching)
|
||||
{
|
||||
Vector3 direction = GetDirection(false);
|
||||
if (direction == new Vector3(0, 0, 0))
|
||||
@@ -197,7 +206,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
angle = 360 - angle;
|
||||
|
||||
|
||||
|
||||
if (angle >= 0 && angle < 60)
|
||||
{
|
||||
run.transform.localScale = new Vector3(1.6f, 1.6f, 1.6f);
|
||||
@@ -271,15 +279,72 @@ public class PlayerMovement : MonoBehaviour
|
||||
none.transform.localScale = new Vector3(1, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(Time.timeScale == 0)
|
||||
{
|
||||
if (Input.anyKeyDown)
|
||||
{
|
||||
transform.position = checkPoint;
|
||||
renderer.enabled = true;
|
||||
|
||||
HealPoint = 5;
|
||||
foreach (GameObject hp in HealPoints)
|
||||
hp.SetActive(true);
|
||||
|
||||
Time.timeScale = 1;
|
||||
DeathScreen.SetActive(false);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//Switch from keyboard to controller and vice versa
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
if (useController)
|
||||
{
|
||||
useController = false;
|
||||
SwitchToKeyboard();
|
||||
}
|
||||
else
|
||||
{
|
||||
useController = true;
|
||||
SwitchToController();
|
||||
}
|
||||
}
|
||||
|
||||
//Personality Switch
|
||||
if (Input.GetButtonDown("SwitchMenu"))
|
||||
{
|
||||
switchMenu.SetActive(true);
|
||||
Time.timeScale = 0.05f;
|
||||
switching = true;
|
||||
}
|
||||
else if (switching)
|
||||
{
|
||||
if (Input.GetButtonUp("SwitchMenu"))
|
||||
{
|
||||
//Change skin
|
||||
if (sacrified.Contains(switchingTo))
|
||||
switchingTo = Personalty.Normal;
|
||||
|
||||
PersonalityRenderer.sprite = PersonalitySprites[(int)switchingTo];
|
||||
if (switchingTo == Personalty.DoubleJump || switchingTo == Personalty.Hook || switchingTo == Personalty.Normal)
|
||||
PersonalityRenderer.transform.localScale = new Vector2(.01f * 2f, .01f * 2f);
|
||||
else if (switchingTo == Personalty.SlowProj)
|
||||
PersonalityRenderer.transform.localScale = new Vector2(.01f * 0.5f, .01f * 0.5f);
|
||||
else
|
||||
PersonalityRenderer.transform.localScale = new Vector2(.01f, .01f);
|
||||
|
||||
personalty = switchingTo;
|
||||
switchingTo = Personalty.Normal;
|
||||
switchMenu.SetActive(false);
|
||||
Time.timeScale = 1;
|
||||
switching = false;
|
||||
|
||||
effectSource.clip = selectClip;
|
||||
effectSource.Play();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,10 +422,23 @@ public class PlayerMovement : MonoBehaviour
|
||||
{
|
||||
if (interactable.index + 1 < interactable.dialog.Length)
|
||||
{
|
||||
Info.gameObject.SetActive(false);
|
||||
Dialog.SetActive(true);
|
||||
Dialog.GetComponentInChildren<TextMeshProUGUI>().text = interactable.dialog[interactable.index + 1];
|
||||
interactable.index++;
|
||||
if(interactable.dialog[interactable.index + 1] == "**SACRIFIEC**")
|
||||
{
|
||||
Time.timeScale = 0;
|
||||
sacrifice = true;
|
||||
Dialog.SetActive(false);
|
||||
SacrificeDialog.SetActive(true);
|
||||
switchMenu.SetActive(true);
|
||||
none.SetActive(false);
|
||||
sacrifice = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info.gameObject.SetActive(false);
|
||||
Dialog.SetActive(true);
|
||||
Dialog.GetComponentInChildren<TextMeshProUGUI>().text = interactable.dialog[interactable.index + 1];
|
||||
interactable.index++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -369,7 +447,11 @@ public class PlayerMovement : MonoBehaviour
|
||||
Info.gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Controller detection
|
||||
if(!useController)
|
||||
DetectController();
|
||||
}
|
||||
|
||||
private async void CalculateHook()
|
||||
{
|
||||
@@ -474,13 +556,38 @@ public class PlayerMovement : MonoBehaviour
|
||||
}
|
||||
else if (collision.gameObject.tag == "DeathZone")
|
||||
Death();
|
||||
else if(collision.gameObject.tag == "Door")
|
||||
{
|
||||
if (items.Contains(Item.Key))
|
||||
{
|
||||
Destroy(collision.gameObject);
|
||||
items.Remove(Item.Key);
|
||||
KeyInventory.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Info.text = "Door: You need a key to open the door.";
|
||||
Info.gameObject.SetActive(true);
|
||||
AwaitInfo();
|
||||
}
|
||||
}
|
||||
|
||||
if (HealPoint <= 0)
|
||||
Death();
|
||||
}
|
||||
|
||||
private async void AwaitInfo()
|
||||
{
|
||||
await Task.Delay(5000);
|
||||
Info.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void Damage(int dmg)
|
||||
{
|
||||
for(int i = 0; i < dmg; i++)
|
||||
effectSource.clip = dmgClip;
|
||||
effectSource.Play();
|
||||
|
||||
for (int i = 0; i < dmg; i++)
|
||||
{
|
||||
HealPoints[HealPoint - 1].SetActive(false);
|
||||
HealPoint--;
|
||||
@@ -489,11 +596,18 @@ public class PlayerMovement : MonoBehaviour
|
||||
|
||||
private void Death()
|
||||
{
|
||||
effectSource.clip = deathClip;
|
||||
effectSource.Play();
|
||||
|
||||
DeathScreen.SetActive(true);
|
||||
renderer.enabled = false;
|
||||
Time.timeScale = 0;
|
||||
foreach (GameObject hp in HealPoints)
|
||||
hp.SetActive(false);
|
||||
|
||||
distanceJoint.enabled = false;
|
||||
hookRenderer.enabled = false;
|
||||
hooked = false;
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
@@ -501,7 +615,8 @@ public class PlayerMovement : MonoBehaviour
|
||||
if (collision.tag == "CheckPoint")
|
||||
{
|
||||
checkPoint = transform.position;
|
||||
//Play a sound
|
||||
effectSource.clip = checkpointClip;
|
||||
effectSource.Play();
|
||||
}
|
||||
else if (collision.tag == "Sign")
|
||||
{
|
||||
@@ -509,6 +624,25 @@ public class PlayerMovement : MonoBehaviour
|
||||
Info.text = "Sign: Press B or enter to read.";
|
||||
Info.gameObject.SetActive(true);
|
||||
}
|
||||
else if(collision.tag == "Teleporter")
|
||||
{
|
||||
effectSource.clip = tpClip;
|
||||
effectSource.Play();
|
||||
|
||||
if (teleporting)
|
||||
teleporting = false;
|
||||
else
|
||||
{
|
||||
transform.position = collision.GetComponent<Teleporter>().destination.transform.position;
|
||||
teleporting = true;
|
||||
}
|
||||
}
|
||||
else if (collision.tag == "Key")
|
||||
{
|
||||
Destroy(collision.gameObject);
|
||||
items.Add(Item.Key);
|
||||
KeyInventory.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerExit2D(Collider2D collision)
|
||||
@@ -546,7 +680,6 @@ public class PlayerMovement : MonoBehaviour
|
||||
|
||||
if (Mathf.Abs(direction.y) < Screen.height / 10 && Mathf.Abs(direction.x) < Screen.width / 10)
|
||||
{
|
||||
print(Mathf.Abs(direction.y) + " " + Screen.height / 10);
|
||||
return new Vector3(0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -559,6 +692,48 @@ public class PlayerMovement : MonoBehaviour
|
||||
return direction.normalized;
|
||||
}
|
||||
}
|
||||
|
||||
private async void DetectController()
|
||||
{
|
||||
if (IsController())
|
||||
{
|
||||
useController = true;
|
||||
Info.text = "Gamepad detected, setting keybind for the gamepad. Don't want to use the gamepad ? Press Escape to switch back to the keyboard.";
|
||||
Info.gameObject.SetActive(true);
|
||||
await Task.Delay(5000);
|
||||
Info.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsController()
|
||||
{
|
||||
if (Input.GetKey(KeyCode.JoystickButton0) ||
|
||||
Input.GetKey(KeyCode.JoystickButton1) ||
|
||||
Input.GetKey(KeyCode.JoystickButton2) ||
|
||||
Input.GetKey(KeyCode.JoystickButton3) ||
|
||||
Input.GetKey(KeyCode.JoystickButton4) ||
|
||||
Input.GetKey(KeyCode.JoystickButton5) ||
|
||||
Input.GetKey(KeyCode.JoystickButton6) ||
|
||||
Input.GetKey(KeyCode.JoystickButton7) ||
|
||||
Input.GetKey(KeyCode.JoystickButton8) ||
|
||||
Input.GetKey(KeyCode.JoystickButton9) ||
|
||||
Input.GetKey(KeyCode.JoystickButton10) ||
|
||||
Input.GetKey(KeyCode.JoystickButton11) ||
|
||||
Input.GetKey(KeyCode.JoystickButton12) ||
|
||||
Input.GetKey(KeyCode.JoystickButton13) ||
|
||||
Input.GetKey(KeyCode.JoystickButton14) ||
|
||||
Input.GetKey(KeyCode.JoystickButton15) ||
|
||||
Input.GetKey(KeyCode.JoystickButton16) ||
|
||||
Input.GetKey(KeyCode.JoystickButton17) ||
|
||||
Input.GetKey(KeyCode.JoystickButton18) ||
|
||||
Input.GetKey(KeyCode.JoystickButton19))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public enum Personalty { Normal, DoubleJump, Run, Hook, Parry, Heal, SlowProj }
|
||||
public enum Item { Key }
|
||||
|
||||
@@ -20,4 +20,13 @@ public class Slime : MonoBehaviour
|
||||
nextJump = Random.Range(1, 5);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCollisionEnter2D(Collision2D collision)
|
||||
{
|
||||
if (collision.gameObject.tag == "Projectile")
|
||||
{
|
||||
Destroy(collision.gameObject);
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Teleporter : MonoBehaviour
|
||||
{
|
||||
public Teleporter destination;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00a9d1cbc15b952478f37829f27ce0db
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f79a6b7a8791d45478e5397434b8f351
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 552e3725c307ec24e9692584275ce7d5
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99aa37ddfc49308429cd0f5bcc6468e6
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 01dd8a593d5458a489f516cf9edcb69d
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0914bbd562aa3fd44ae94b790e18d605
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b80d5cfe10047c642b2f4ebf608eee26
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d8e9ac8b8410c4b4fad84fd001931ff6
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.9 KiB |
@@ -0,0 +1,88 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 420b9720849182f43afb127bb2d3a81c
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 7
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: 92ba83a7a4c86604f93471cfe1bf96c8
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
@@ -0,0 +1,88 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e293a80c884f72a4fb0c2956f0740363
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
externalObjects: {}
|
||||
serializedVersion: 7
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 8
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 2
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID: ba23c936c47443a489209bd9d2fc0c37
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -122,7 +122,7 @@ InputManager:
|
||||
descriptiveName:
|
||||
descriptiveNegativeName:
|
||||
negativeButton:
|
||||
positiveButton: enter
|
||||
positiveButton: return
|
||||
altNegativeButton:
|
||||
altPositiveButton: joystick button 1
|
||||
gravity: 1000
|
||||
|
||||
@@ -8,6 +8,11 @@ TagManager:
|
||||
- DeathZone
|
||||
- HealPoint
|
||||
- Sign
|
||||
- CheckPoint
|
||||
- Teleporter
|
||||
- Door
|
||||
- Key
|
||||
- Projectile
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
|
||||
Reference in New Issue
Block a user