added trumpet visual

This commit is contained in:
Sam 2023-05-03 13:16:44 -07:00
parent 8d230a5a71
commit 3108c31489
3 changed files with 86 additions and 5 deletions

View File

@ -10,6 +10,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 5260309551442468847} - component: {fileID: 5260309551442468847}
- component: {fileID: 4810862233826936571} - component: {fileID: 4810862233826936571}
- component: {fileID: 6243080859493935262}
m_Layer: 2 m_Layer: 2
m_Name: Trumpet m_Name: Trumpet
m_TagString: Untagged m_TagString: Untagged
@ -24,14 +25,14 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2460619873126572304} m_GameObject: {fileID: 2460619873126572304}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: -0.38268343, w: 0.92387956}
m_LocalPosition: {x: 0, y: -0.227, z: 0} m_LocalPosition: {x: 0.149, y: -0.138, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 0.33, y: 0.33, z: 0.33}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 5885597207104481986} m_Father: {fileID: 5885597207104481986}
m_RootOrder: -1 m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: -45}
--- !u!82 &4810862233826936571 --- !u!82 &4810862233826936571
AudioSource: AudioSource:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -128,6 +129,58 @@ AudioSource:
m_PreInfinity: 2 m_PreInfinity: 2
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
--- !u!212 &6243080859493935262
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2460619873126572304}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
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_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
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: 2fc7c6c786dc74f23a25d37c648e9b6d, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 1
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 0.64, y: 0.64}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &5885597207104481991 --- !u!1 &5885597207104481991
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -365,6 +418,11 @@ MonoBehaviour:
playerInput: {fileID: 1407172087} playerInput: {fileID: 1407172087}
launcher: {fileID: 6559806128767475056} launcher: {fileID: 6559806128767475056}
hasTambourine: 1 hasTambourine: 1
maxDashTime: 3
dashStopSpeed: 0.1
moveDirection: {x: 0, y: 0, z: 0}
dashDistance: 0.2
isDash: 0
grapplingGun: {fileID: 3465910379319867675} grapplingGun: {fileID: 3465910379319867675}
grapplingRope: {fileID: 7648135587659148198} grapplingRope: {fileID: 7648135587659148198}
playerController: {fileID: 5559747613460074786} playerController: {fileID: 5559747613460074786}
@ -388,6 +446,7 @@ MonoBehaviour:
trumpet: 0 trumpet: 0
in_range: 0 in_range: 0
enemy: {fileID: 0} enemy: {fileID: 0}
trumpetSprite: {fileID: 6243080859493935262}
_groundCheckSize: {x: 0.22, y: 0.62} _groundCheckSize: {x: 0.22, y: 0.62}
_groundCheckOffset: 0.29 _groundCheckOffset: 0.29
_wallCheckSize: {x: 0, y: 0} _wallCheckSize: {x: 0, y: 0}

View File

@ -37,5 +37,6 @@ public class DebugSceneSwitcher : MonoBehaviour
public void ChangeScene(int index) { public void ChangeScene(int index) {
// print(index); // print(index);
GameObject.FindGameObjectWithTag("SceneManager").GetComponent<SceneController>().LoadChosenScene(index); GameObject.FindGameObjectWithTag("SceneManager").GetComponent<SceneController>().LoadChosenScene(index);
this.gameObject.SetActive(false);
} }
} }

View File

@ -30,9 +30,14 @@ public class PlayerMovement : MonoBehaviour
public float LastOnWallRightTime { get; private set; } public float LastOnWallRightTime { get; private set; }
public float LastOnWallLeftTime { get; private set; } public float LastOnWallLeftTime { get; private set; }
// trumpet
public int trumpet = 0; public int trumpet = 0;
public bool in_range = false; public bool in_range = false;
public GameObject enemy; public GameObject enemy;
bool unlockedTrumpet;
[SerializeField] SpriteRenderer trumpetSprite;
bool trumpetActive = false;
//Jump //Jump
private bool _isJumpCut; private bool _isJumpCut;
@ -48,7 +53,6 @@ public class PlayerMovement : MonoBehaviour
Tutorial_GrapplingRope grapplingRope; Tutorial_GrapplingRope grapplingRope;
bool wasGrappling = false; bool wasGrappling = false;
bool unlockedTrumpet;
//Set all of these up in the inspector //Set all of these up in the inspector
[Header("Checks")] [Header("Checks")]
@ -78,6 +82,7 @@ public class PlayerMovement : MonoBehaviour
stateController = GameObject.FindGameObjectWithTag("StateController").GetComponent<StateController>(); stateController = GameObject.FindGameObjectWithTag("StateController").GetComponent<StateController>();
audioSource = GetComponent<AudioSource>(); audioSource = GetComponent<AudioSource>();
gameUI = GameObject.FindGameObjectWithTag("GameUICanvas").GetComponent<GameUIController>(); gameUI = GameObject.FindGameObjectWithTag("GameUICanvas").GetComponent<GameUIController>();
trumpetSprite.enabled = false;
} }
private void Start() private void Start()
@ -204,8 +209,10 @@ public class PlayerMovement : MonoBehaviour
_isJumpFalling = false; _isJumpFalling = false;
Jump(); Jump();
// determine if trumpet jump
if (!IsGrounded() && in_range && trumpet > 0) if (!IsGrounded() && in_range && trumpet > 0)
{ {
StartCoroutine(ActivateTrumpetSprite());
gameObject.transform.Find("Trumpet").GetComponent<AudioSource>().Play(); gameObject.transform.Find("Trumpet").GetComponent<AudioSource>().Play();
enemy.GetComponent<EnemyPatrol>().DefeatEnemy(); enemy.GetComponent<EnemyPatrol>().DefeatEnemy();
enemy = null; enemy = null;
@ -217,6 +224,7 @@ public class PlayerMovement : MonoBehaviour
} }
// check if double jump, play sound // check if double jump, play sound
if (trumpet == 0) { if (trumpet == 0) {
StartCoroutine(ActivateTrumpetSprite());
gameObject.transform.Find("Trumpet").GetComponent<AudioSource>().Play(); gameObject.transform.Find("Trumpet").GetComponent<AudioSource>().Play();
} }
} }
@ -537,4 +545,17 @@ public class PlayerMovement : MonoBehaviour
Gizmos.DrawWireCube(this.transform.position, _wallCheckSize); Gizmos.DrawWireCube(this.transform.position, _wallCheckSize);
} }
#endregion #endregion
#region ADDITIONAL TRUMPET METHODS
IEnumerator ActivateTrumpetSprite() {
if (!trumpetActive) {
trumpetActive = true;
trumpetSprite.enabled = true;
yield return new WaitForSeconds(.5f);
trumpetSprite.enabled = false;
trumpetActive = false;
}
}
#endregion
} }