Pull request #10: Soulaha
Merge in CEGJ/creative-jam-20 from Soulaha to main * commit '8d9f3f61b9034de4b93dc316dd36037160aba940': Added btn w/ new canvas Added dmg and fire rate upgrades w/ btns
This commit is contained in:
commit
255e08eab2
File diff suppressed because it is too large
Load Diff
@ -80,8 +80,8 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 44fc4a66977bce94dbaccf9ae1d06e2b, type: 3}
|
m_Script: {fileID: 11500000, guid: 44fc4a66977bce94dbaccf9ae1d06e2b, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
points: 0
|
points: 150
|
||||||
cannon: {fileID: 0}
|
cannon: {fileID: 1832045534445164820}
|
||||||
--- !u!114 &6969840675499469968
|
--- !u!114 &6969840675499469968
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -183,6 +183,22 @@ MonoBehaviour:
|
|||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_ActionId: 61ddf11f-3478-4887-ab86-0ead8dde336f
|
m_ActionId: 61ddf11f-3478-4887-ab86-0ead8dde336f
|
||||||
m_ActionName: UI/TrackedDeviceOrientation
|
m_ActionName: UI/TrackedDeviceOrientation
|
||||||
|
- m_PersistentCalls:
|
||||||
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 3117915759359451286}
|
||||||
|
m_TargetAssemblyTypeName: PlayerController, Assembly-CSharp
|
||||||
|
m_MethodName: OnUpgrade
|
||||||
|
m_Mode: 1
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
|
m_ActionId: dbe4eda4-74d0-47d3-b2d1-c8292faa8b62
|
||||||
|
m_ActionName: Player/UpgradeTest[/Keyboard/r]
|
||||||
m_NeverAutoSwitchControlSchemes: 0
|
m_NeverAutoSwitchControlSchemes: 0
|
||||||
m_DefaultControlScheme:
|
m_DefaultControlScheme:
|
||||||
m_DefaultActionMap: Player
|
m_DefaultActionMap: Player
|
||||||
|
|||||||
@ -123,6 +123,258 @@ NavMeshSettings:
|
|||||||
debug:
|
debug:
|
||||||
m_Flags: 0
|
m_Flags: 0
|
||||||
m_NavMeshData: {fileID: 0}
|
m_NavMeshData: {fileID: 0}
|
||||||
|
--- !u!114 &1407792871 stripped
|
||||||
|
MonoBehaviour:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 3117915759359451286, guid: 486166ffed264a842ab4bc0affec38c4, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 6969840674995165991}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 44fc4a66977bce94dbaccf9ae1d06e2b, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!1001 &1822990540
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 297948476404860644, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 297948476404860644, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 297948476404860644, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 297948476404860644, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 430403745636601587, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: player
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 1407792871}
|
||||||
|
- target: {fileID: 3203615922723506192, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: player
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 1407792871}
|
||||||
|
- target: {fileID: 3290620518113273233, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3290620518113273233, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3290620518113273233, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3290620518113273233, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3502347552248570395, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_IsActive
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3868787890645716629, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3868787890645716629, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3868787890645716629, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3868787890645716629, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4088869081495123135, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: player
|
||||||
|
value:
|
||||||
|
objectReference: {fileID: 1407792871}
|
||||||
|
- target: {fileID: 4637900801277279150, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4637900801277279150, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4637900801277279150, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4637900801277279150, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4864102413907297127, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4864102413907297127, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4864102413907297127, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4864102413907297127, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6310781014458571912, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6310781014458571912, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6310781014458571912, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6310781014458571912, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6508712462537823371, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6508712462537823371, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6508712462537823371, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6508712462537823371, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_Pivot.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_Pivot.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 2
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_SizeDelta.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7226858076299792830, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Canvas_UI
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8145377689690508936, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMax.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8145377689690508936, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchorMin.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8145377689690508936, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8145377689690508936, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
|
propertyPath: m_AnchoredPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
|
||||||
--- !u!1 &1966667440
|
--- !u!1 &1966667440
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@ -2,6 +2,7 @@ using System.Collections;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
|
|
||||||
public class CannonScript : MonoBehaviour
|
public class CannonScript : MonoBehaviour
|
||||||
{
|
{
|
||||||
@ -12,6 +13,8 @@ public class CannonScript : MonoBehaviour
|
|||||||
[SerializeField] private float fireRate = 0.5f;
|
[SerializeField] private float fireRate = 0.5f;
|
||||||
[SerializeField]private float fireTimer;
|
[SerializeField]private float fireTimer;
|
||||||
private bool firing = false;
|
private bool firing = false;
|
||||||
|
|
||||||
|
[SerializeField]private float damage = 1f;
|
||||||
private Vector3 lookDir;
|
private Vector3 lookDir;
|
||||||
|
|
||||||
|
|
||||||
@ -24,10 +27,11 @@ public class CannonScript : MonoBehaviour
|
|||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if(firing){
|
if(firing && !EventSystem.current.IsPointerOverGameObject()){
|
||||||
fireTimer += Time.deltaTime;
|
fireTimer += Time.deltaTime;
|
||||||
if(fireTimer >= fireRate){
|
if(fireTimer >= fireRate){
|
||||||
GameObject proj = Instantiate(projectile, transform.position, cannon.transform.rotation);
|
GameObject proj = Instantiate(projectile, transform.position, cannon.transform.rotation);
|
||||||
|
proj.GetComponent<Projectile>().SetDamage(damage);
|
||||||
proj.GetComponent<Rigidbody>().AddForce(cannonForce * lookDir, ForceMode.Impulse);
|
proj.GetComponent<Rigidbody>().AddForce(cannonForce * lookDir, ForceMode.Impulse);
|
||||||
fireTimer = 0;
|
fireTimer = 0;
|
||||||
|
|
||||||
@ -75,4 +79,20 @@ public class CannonScript : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetFireRate(float nFireRate){
|
||||||
|
this.fireRate = nFireRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float GetFireRate(){
|
||||||
|
return fireRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetDamage(float dmg){
|
||||||
|
this.damage = dmg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float GetDamage(){
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,10 +7,11 @@ public class PlayerController : MonoBehaviour
|
|||||||
|
|
||||||
[SerializeField] private float points;
|
[SerializeField] private float points;
|
||||||
[SerializeField] private CannonScript cannon;
|
[SerializeField] private CannonScript cannon;
|
||||||
|
//private FireRateUpgrade fireRateUpgrade;
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
points = 0;
|
//fireRateUpgrade = new FireRateUpgrade("Fire rate 1", 10, 0.4f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
@ -19,22 +20,37 @@ public class PlayerController : MonoBehaviour
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool OnUpgrade(Upgrade selectedUpgrade){
|
||||||
|
if(points >= selectedUpgrade.GetCost()){
|
||||||
|
points = points - selectedUpgrade.GetCost();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public float getPoints(){
|
public void UpgradeFireRate(FireRateUpgrade upgrade){
|
||||||
|
cannon.SetFireRate(upgrade.GetFireRate());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpgradeDamage(DamageUpgrade upgrade){
|
||||||
|
cannon.SetDamage(upgrade.GetDamage());
|
||||||
|
}
|
||||||
|
|
||||||
|
public float GetPoints(){
|
||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPoints(float nPoints){
|
public void SetPoints(float nPoints){
|
||||||
points = nPoints;
|
points = nPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void spendPoints(float amount){
|
public void SpendPoints(float amount){
|
||||||
if(amount <= points){
|
if(amount <= points){
|
||||||
points = points - amount;
|
points = points - amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void gainPoints(float amount){
|
public void GainPoints(float amount){
|
||||||
points += amount;
|
points += amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ using UnityEngine;
|
|||||||
public class Projectile : MonoBehaviour
|
public class Projectile : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField]private float lifeTime = 1f;
|
[SerializeField]private float lifeTime = 1f;
|
||||||
|
private float damage;
|
||||||
private float timer;
|
private float timer;
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
@ -20,4 +21,12 @@ public class Projectile : MonoBehaviour
|
|||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetDamage(float dmg){
|
||||||
|
this.damage = dmg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float GetDamage(){
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
21
Assets/Scripts/UIController.cs
Normal file
21
Assets/Scripts/UIController.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
|
public class UIController : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField]private PlayerController player;
|
||||||
|
[SerializeField]private TMP_Text pointsTxt;
|
||||||
|
// Start is called before the first frame update
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
pointsTxt.text = player.GetPoints().ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/UIController.cs.meta
Normal file
11
Assets/Scripts/UIController.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 79b7d4d08379c4a4b9c0c4a91499fb6d
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
8
Assets/Scripts/Upgrades.meta
Normal file
8
Assets/Scripts/Upgrades.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8184956e2effd90469ec36a8afb35c01
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
27
Assets/Scripts/Upgrades/DamageUpgrade.cs
Normal file
27
Assets/Scripts/Upgrades/DamageUpgrade.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class DamageUpgrade : Upgrade
|
||||||
|
{
|
||||||
|
[SerializeField]private float[] damages;
|
||||||
|
public DamageUpgrade(string name, float[] cost, float[] damages){
|
||||||
|
this.cost = cost;
|
||||||
|
this.upgradeName = name;
|
||||||
|
this.damages = damages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetDamages(float[] nDamages){
|
||||||
|
this.damages = nDamages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float GetDamage(){
|
||||||
|
return damages[lvlUnlocked-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Activate(){
|
||||||
|
if(base.UpgradeAttempt()){
|
||||||
|
player.UpgradeDamage(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Upgrades/DamageUpgrade.cs.meta
Normal file
11
Assets/Scripts/Upgrades/DamageUpgrade.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e451d9c5ec4b6cc418e19f732d9bf472
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
27
Assets/Scripts/Upgrades/FireRateUpgrade.cs
Normal file
27
Assets/Scripts/Upgrades/FireRateUpgrade.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class FireRateUpgrade : Upgrade
|
||||||
|
{
|
||||||
|
[SerializeField]private float[] fireRates;
|
||||||
|
public FireRateUpgrade(string name, float[] cost, float[] fireRate){
|
||||||
|
this.cost = cost;
|
||||||
|
this.upgradeName = name;
|
||||||
|
this.fireRates = fireRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetFireRates(float[] nFireRate){
|
||||||
|
this.fireRates = nFireRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float GetFireRate(){
|
||||||
|
return fireRates[lvlUnlocked-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Activate(){
|
||||||
|
if(base.UpgradeAttempt()){
|
||||||
|
player.UpgradeFireRate(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Upgrades/FireRateUpgrade.cs.meta
Normal file
11
Assets/Scripts/Upgrades/FireRateUpgrade.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 272a63f263546a14580438687ba5ada9
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
55
Assets/Scripts/Upgrades/Upgrade.cs
Normal file
55
Assets/Scripts/Upgrades/Upgrade.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
|
public abstract class Upgrade : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField]protected float[] cost;
|
||||||
|
[SerializeField]protected TMP_Text costTxt;
|
||||||
|
[SerializeField]protected string upgradeName;
|
||||||
|
protected int lvlUnlocked;
|
||||||
|
[SerializeField]protected Sprite unlockedSprite;
|
||||||
|
[SerializeField]protected GameObject hoverObj;
|
||||||
|
[SerializeField]protected Image[] imgs;
|
||||||
|
[SerializeField]protected PlayerController player;
|
||||||
|
|
||||||
|
private void Start() {
|
||||||
|
lvlUnlocked = 0;
|
||||||
|
costTxt.text = cost[lvlUnlocked].ToString();
|
||||||
|
}
|
||||||
|
private void Update() {
|
||||||
|
// if(EventSystem.current.IsPointerOverGameObject()){
|
||||||
|
// hoverObj.SetActive(true);
|
||||||
|
// }else{
|
||||||
|
// hoverObj.SetActive(false);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
public float GetCost(){
|
||||||
|
return cost[lvlUnlocked];
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetName(){
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Activate(){
|
||||||
|
UpgradeAttempt();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected bool UpgradeAttempt(){
|
||||||
|
if(lvlUnlocked < imgs.Length && player.OnUpgrade(this)){
|
||||||
|
imgs[lvlUnlocked].sprite = unlockedSprite;
|
||||||
|
lvlUnlocked++;
|
||||||
|
if(lvlUnlocked < imgs.Length){
|
||||||
|
costTxt.text = cost[lvlUnlocked].ToString();
|
||||||
|
}else{
|
||||||
|
costTxt.text = "--";
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/Scripts/Upgrades/Upgrade.cs.meta
Normal file
11
Assets/Scripts/Upgrades/Upgrade.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 29f3d10a8fe203044bf3d91ecd51cb9f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Loading…
x
Reference in New Issue
Block a user