resolved merge conflict

This commit is contained in:
louishorlaville 2022-05-14 19:10:15 -04:00
commit b92a798be0
13 changed files with 1905 additions and 264 deletions

BIN
Assets/Art/Materials/mat_trail.mat (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Assets/Art/Materials/mat_trail.mat.meta (Stored with Git LFS) Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -183,22 +183,6 @@ 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
@ -219,9 +203,11 @@ MonoBehaviour:
cannon: {fileID: 6969840675257017922} cannon: {fileID: 6969840675257017922}
projectile: {fileID: 5630905120393344806, guid: 70e77cdd333989d4193d3d85029d8cbe, type: 3} projectile: {fileID: 5630905120393344806, guid: 70e77cdd333989d4193d3d85029d8cbe, type: 3}
lookDepth: 400 lookDepth: 400
cannonForce: 1000 cannonForce: 500
fireRate: 0.5 fireRate: 0.5
fireTimer: 0 fireTimer: 0
damage: 1
bullets: 1
--- !u!1 &6969840675949508920 --- !u!1 &6969840675949508920
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -315,7 +301,7 @@ BoxCollider:
m_GameObject: {fileID: 6969840675949508920} m_GameObject: {fileID: 6969840675949508920}
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 0
m_Enabled: 1 m_Enabled: 0
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1} m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}

View File

@ -14,7 +14,8 @@ GameObject:
- component: {fileID: 8824810498392835647} - component: {fileID: 8824810498392835647}
- component: {fileID: 1596552820235563576} - component: {fileID: 1596552820235563576}
- component: {fileID: -5096460011673770898} - component: {fileID: -5096460011673770898}
m_Layer: 0 - component: {fileID: 8618525506095844415}
m_Layer: 6
m_Name: Projectile m_Name: Projectile
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
@ -128,3 +129,102 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
lifeTime: 1 lifeTime: 1
--- !u!96 &8618525506095844415
TrailRenderer:
serializedVersion: 2
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5630905120393344806}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 0
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: ee1ce0afe992adc458acbbc4cdff6ab2, type: 2}
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: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Time: 0.02
m_Parameters:
serializedVersion: 3
widthMultiplier: 0.25
widthCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
colorGradient:
serializedVersion: 2
key0: {r: 0.740566, g: 0.9948123, b: 1, a: 1}
key1: {r: 1, g: 1, b: 1, a: 1}
key2: {r: 0, g: 0, b: 0, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
key4: {r: 0, g: 0, b: 0, a: 0}
key5: {r: 0, g: 0, b: 0, a: 0}
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 65535
ctime2: 0
ctime3: 0
ctime4: 0
ctime5: 0
ctime6: 0
ctime7: 0
atime0: 0
atime1: 65535
atime2: 0
atime3: 0
atime4: 0
atime5: 0
atime6: 0
atime7: 0
m_Mode: 0
m_NumColorKeys: 2
m_NumAlphaKeys: 2
numCornerVertices: 0
numCapVertices: 0
alignment: 0
textureMode: 0
shadowBias: 0.5
generateLightingData: 1
m_MinVertexDistance: 0.1
m_Autodestruct: 0
m_Emitting: 1

View File

@ -141,22 +141,6 @@ PrefabInstance:
m_Modification: m_Modification:
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: 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} - target: {fileID: 430403745636601587, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
propertyPath: player propertyPath: player
value: value:
@ -165,110 +149,10 @@ PrefabInstance:
propertyPath: player propertyPath: player
value: value:
objectReference: {fileID: 1407792871} 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} - target: {fileID: 4088869081495123135, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
propertyPath: player propertyPath: player
value: value:
objectReference: {fileID: 1407792871} 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} - target: {fileID: 7226858076299792826, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
propertyPath: m_Pivot.x propertyPath: m_Pivot.x
value: 0 value: 0
@ -357,22 +241,10 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: Canvas_UI value: Canvas_UI
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8145377689690508936, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3} - target: {fileID: 7292790684055438790, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
propertyPath: m_AnchorMax.y propertyPath: player
value: 0 value:
objectReference: {fileID: 0} objectReference: {fileID: 1407792871}
- 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_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 1fbf5b38e74bdfe4185768d47372abe2, type: 3}
--- !u!1 &1966667440 --- !u!1 &1966667440

View File

@ -13,19 +13,18 @@ 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; [SerializeField]private float damage = 1f;
private Vector3 lookDir; private Vector3 lookDir;
private Vector3[] offsets;
[SerializeField]private int bullets;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
lookDir = Vector3.zero; lookDir = Vector3.zero;
if(EventSystem.current == null) offsets = new Vector3[] { new Vector3(-0.1f, 0), new Vector3(0.1f, 0), new Vector3(0, -0.1f), new Vector3(0, 0.1f) };
{ bullets = 1;
Debug.LogWarning("No Event System");
}
} }
// Update is called once per frame // Update is called once per frame
@ -36,9 +35,7 @@ public class CannonScript : MonoBehaviour
if (firing && !EventSystem.current.IsPointerOverGameObject()){ 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); Fire();
proj.GetComponent<Projectile>().SetDamage(damage);
proj.GetComponent<Rigidbody>().AddForce(cannonForce * lookDir, ForceMode.Impulse);
fireTimer = 0; fireTimer = 0;
RaycastHit hit; RaycastHit hit;
@ -62,6 +59,21 @@ public class CannonScript : MonoBehaviour
} }
} }
void Fire(){
GameObject proj = Instantiate(projectile, cannon.transform.position, cannon.transform.rotation);
proj.GetComponent<Projectile>().SetDamage(damage);
proj.GetComponent<Rigidbody>().AddForce(cannonForce * lookDir, ForceMode.Impulse);
if(bullets > 1){
//Pick random offset from lookDir
for (int i = 0; i < bullets-1; i++)
{
proj = Instantiate(projectile, cannon.transform.position, cannon.transform.rotation);
proj.GetComponent<Projectile>().SetDamage(damage);
proj.GetComponent<Rigidbody>().AddForce(cannonForce * (lookDir+offsets[i]), ForceMode.Impulse);
}
}
}
private Vector3 GetMouseWorldPosition(){ private Vector3 GetMouseWorldPosition(){
Vector3 screenPos = Mouse.current.position.ReadValue(); Vector3 screenPos = Mouse.current.position.ReadValue();
screenPos.z = lookDepth; screenPos.z = lookDepth;
@ -102,4 +114,12 @@ public class CannonScript : MonoBehaviour
return damage; return damage;
} }
public void SetBullets(int nBullets){
this.bullets = nBullets;
}
public int GetBullets(){
return bullets;
}
} }

View File

@ -36,6 +36,10 @@ public class PlayerController : MonoBehaviour
cannon.SetDamage(upgrade.GetDamage()); cannon.SetDamage(upgrade.GetDamage());
} }
public void UpgradeBullets(BulletsAmountUpgrade upgrade){
cannon.SetBullets(upgrade.GetBullets());
}
public float GetPoints(){ public float GetPoints(){
return points; return points;
} }

View File

@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BulletsAmountUpgrade : Upgrade
{
[SerializeField]private int[] amounts;
public BulletsAmountUpgrade(string name, float[] cost, int[] amounts){
this.cost = cost;
this.upgradeName = name;
this.amounts = amounts;
}
public void SetBullets(int[] nAmounts){
this.amounts = nAmounts;
}
public int GetBullets(){
return amounts[lvlUnlocked-1];
}
public override void Activate(){
if(base.UpgradeAttempt()){
player.UpgradeBullets(this);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fb3bb30d2ff91fd48b3e6b3a8dfaab05
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -21,11 +21,16 @@ public abstract class Upgrade : MonoBehaviour
costTxt.text = cost[lvlUnlocked].ToString(); costTxt.text = cost[lvlUnlocked].ToString();
} }
private void Update() { private void Update() {
// if(EventSystem.current.IsPointerOverGameObject()){ }
// hoverObj.SetActive(true);
// }else{ public void OnPointerEnter(){
// hoverObj.SetActive(false); if(lvlUnlocked < imgs.Length){
// } hoverObj.SetActive(true);
}
}
public void OnPointerExit(){
hoverObj.SetActive(false);
} }
public float GetCost(){ public float GetCost(){
return cost[lvlUnlocked]; return cost[lvlUnlocked];

View File

@ -7,6 +7,7 @@ PhysicsManager:
m_Gravity: {x: 0, y: -9.81, z: 0} m_Gravity: {x: 0, y: -9.81, z: 0}
m_DefaultMaterial: {fileID: 0} m_DefaultMaterial: {fileID: 0}
m_BounceThreshold: 2 m_BounceThreshold: 2
m_DefaultMaxDepenetrationVelocity: 10
m_SleepThreshold: 0.005 m_SleepThreshold: 0.005
m_DefaultContactOffset: 0.01 m_DefaultContactOffset: 0.01
m_DefaultSolverIterations: 6 m_DefaultSolverIterations: 6
@ -17,7 +18,7 @@ PhysicsManager:
m_ClothInterCollisionDistance: 0.1 m_ClothInterCollisionDistance: 0.1
m_ClothInterCollisionStiffness: 0.2 m_ClothInterCollisionStiffness: 0.2
m_ContactsGeneration: 1 m_ContactsGeneration: 1
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffbfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation: 1 m_AutoSimulation: 1
m_AutoSyncTransforms: 0 m_AutoSyncTransforms: 0
m_ReuseCollisionCallbacks: 1 m_ReuseCollisionCallbacks: 1
@ -32,5 +33,6 @@ PhysicsManager:
m_FrictionType: 0 m_FrictionType: 0
m_EnableEnhancedDeterminism: 0 m_EnableEnhancedDeterminism: 0
m_EnableUnifiedHeightmaps: 1 m_EnableUnifiedHeightmaps: 1
m_ImprovedPatchFriction: 0
m_SolverType: 0 m_SolverType: 0
m_DefaultMaxAngularSpeed: 50 m_DefaultMaxAngularSpeed: 50

View File

@ -12,7 +12,7 @@ TagManager:
- -
- Water - Water
- UI - UI
- - Projectile
- -
- -
- -