improve enemy collision, slidies, difficulty curve

This commit is contained in:
Cat Flynn 2021-01-11 11:46:46 +00:00
parent 3b0e143787
commit d8fd4b5a0a
17 changed files with 160 additions and 35 deletions

View File

@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c271cfa846431634db54fa41238b7b35, type: 3}
m_Name: Accessibility Options
m_EditorClassIdentifier:
_mode: 0
_mode: 2
_calm:
_value: 0
_tunnel: {fileID: 2100000, guid: e26770f868f0d0d44960f5354b21e17c, type: 2}

View File

@ -82,7 +82,7 @@ Material:
m_Floats:
- _Alpha: 1
- _AlphaClip: 0
- _BaseScale: 0.8
- _BaseScale: 1.2
- _Blend: 0
- _BumpScale: 1
- _C: 0
@ -104,7 +104,7 @@ Material:
- _Parallax: 0.005
- _PulseIntensity: 0.5
- _QueueOffset: 0
- _RadiusWithDistance: 0.00005
- _RadiusWithDistance: 0.00007
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0

View File

@ -104,7 +104,7 @@ Material:
- _Parallax: 0.005
- _PulseIntensity: 1
- _QueueOffset: 0
- _RadiusWithDistance: 0.00005
- _RadiusWithDistance: 0.00007
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0

View File

@ -47,6 +47,20 @@ MonoBehaviour:
m_EditorClassIdentifier:
xMin: -10.1
xMax: 10.1
--- !u!114 &1858863165099212332
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1738226812227614583}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ea3f51bb4cd6c8146a185362df2fe451, type: 3}
m_Name:
m_EditorClassIdentifier:
_speedRange: {x: -10, y: 10}
_xBounds: {x: -10, y: 10}
--- !u!1 &7094929575626237127
GameObject:
m_ObjectHideFlags: 0
@ -198,16 +212,3 @@ MonoBehaviour:
m_EditorClassIdentifier:
xMin: -10.1
xMax: 10.1
--- !u!114 &1858863165099212332
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1738226812227614583}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ea3f51bb4cd6c8146a185362df2fe451, type: 3}
m_Name:
m_EditorClassIdentifier:
_speedRange: {x: -5, y: 5}

View File

@ -94,7 +94,7 @@ BoxCollider:
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Size: {x: 0.1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &8761754940900000814
MonoBehaviour:

View File

@ -177,6 +177,7 @@ GameObject:
m_Component:
- component: {fileID: 84273095}
- component: {fileID: 84273094}
- component: {fileID: 84273096}
m_Layer: 0
m_Name: App
m_TagString: Untagged
@ -221,6 +222,20 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &84273096
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 84273093}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 565df9595af1e6e4a9547067e1d23b5d, type: 3}
m_Name:
m_EditorClassIdentifier:
_base: 1
_perBeatIncrease: 0.005
--- !u!1 &186457103
GameObject:
m_ObjectHideFlags: 0
@ -1614,12 +1629,16 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2145967175348613560, guid: 88246464365fd0745b75edfcff208598, type: 3}
propertyPath: _onBeat.m_PersistentCalls.m_Calls.Array.size
value: 2
value: 3
objectReference: {fileID: 0}
- target: {fileID: 2145967175348613560, guid: 88246464365fd0745b75edfcff208598, type: 3}
propertyPath: _onBeat.m_PersistentCalls.m_Calls.Array.data[1].m_Mode
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2145967175348613560, guid: 88246464365fd0745b75edfcff208598, type: 3}
propertyPath: _onBeat.m_PersistentCalls.m_Calls.Array.data[2].m_Mode
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2145967175348613560, guid: 88246464365fd0745b75edfcff208598, type: 3}
propertyPath: _onBeat.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
@ -1628,22 +1647,42 @@ PrefabInstance:
propertyPath: _onBeat.m_PersistentCalls.m_Calls.Array.data[1].m_Target
value:
objectReference: {fileID: 532372216}
- target: {fileID: 2145967175348613560, guid: 88246464365fd0745b75edfcff208598, type: 3}
propertyPath: _onBeat.m_PersistentCalls.m_Calls.Array.data[2].m_Target
value:
objectReference: {fileID: 84273096}
- target: {fileID: 2145967175348613560, guid: 88246464365fd0745b75edfcff208598, type: 3}
propertyPath: _onBeat.m_PersistentCalls.m_Calls.Array.data[1].m_CallState
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2145967175348613560, guid: 88246464365fd0745b75edfcff208598, type: 3}
propertyPath: _onBeat.m_PersistentCalls.m_Calls.Array.data[2].m_CallState
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2145967175348613560, guid: 88246464365fd0745b75edfcff208598, type: 3}
propertyPath: _onBeat.m_PersistentCalls.m_Calls.Array.data[1].m_MethodName
value: OnBeat
objectReference: {fileID: 0}
- target: {fileID: 2145967175348613560, guid: 88246464365fd0745b75edfcff208598, type: 3}
propertyPath: _onBeat.m_PersistentCalls.m_Calls.Array.data[2].m_MethodName
value: OnBeat
objectReference: {fileID: 0}
- target: {fileID: 2145967175348613560, guid: 88246464365fd0745b75edfcff208598, type: 3}
propertyPath: _onBeat.m_PersistentCalls.m_Calls.Array.data[1].m_TargetAssemblyTypeName
value: BeatSpawner, Assembly-CSharp
objectReference: {fileID: 0}
- target: {fileID: 2145967175348613560, guid: 88246464365fd0745b75edfcff208598, type: 3}
propertyPath: _onBeat.m_PersistentCalls.m_Calls.Array.data[2].m_TargetAssemblyTypeName
value: IncreaseDifficultyOverTime, Assembly-CSharp
objectReference: {fileID: 0}
- target: {fileID: 2145967175348613560, guid: 88246464365fd0745b75edfcff208598, type: 3}
propertyPath: _onBeat.m_PersistentCalls.m_Calls.Array.data[1].m_Arguments.m_ObjectArgumentAssemblyTypeName
value: UnityEngine.Object, UnityEngine
objectReference: {fileID: 0}
- target: {fileID: 2145967175348613560, guid: 88246464365fd0745b75edfcff208598, type: 3}
propertyPath: _onBeat.m_PersistentCalls.m_Calls.Array.data[2].m_Arguments.m_ObjectArgumentAssemblyTypeName
value: UnityEngine.Object, UnityEngine
objectReference: {fileID: 0}
- target: {fileID: 2145967175348613561, guid: 88246464365fd0745b75edfcff208598, type: 3}
propertyPath: m_Name
value: Audio

View File

@ -45,7 +45,7 @@ public class DisableOnDeath : MonoBehaviour
private void Die()
{
var oldName = gameObject.name;
gameObject.name = "disabled";
gameObject.transform.parent.name = "disabled";
_collider.enabled = false;
float duration = 0.4f;

View File

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using FMOD;
using UnityEngine;
using Debug = UnityEngine.Debug;
public class IncreaseDifficultyOverTime : MonoBehaviour
{
[SerializeField] private float _base;
[SerializeField] private float _perBeatIncrease;
public void OnBeat(int beat)
{
var difficulty = _base * Mathf.Pow(1.0f+_perBeatIncrease, beat);
Debug.Log(difficulty);
Shader.SetGlobalFloat("_Difficulty", difficulty);
}
}

View File

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

View File

@ -7,8 +7,15 @@ using UnityEngine;
public class SlideSideways : MonoBehaviour
{
[SerializeField] private Vector2 _speedRange;
[SerializeField] private Vector2 _xBounds;
private float _speed;
private float _xDiff;
private void Awake()
{
_xDiff = _xBounds.y - _xBounds.x;
}
private void Start()
{
@ -19,5 +26,14 @@ public class SlideSideways : MonoBehaviour
private void LateUpdate()
{
transform.Translate(Vector3.right * _speed * Time.deltaTime);
if (transform.position.x < _xBounds.x)
{
transform.position += Vector3.right * _xDiff;
}
else if (transform.position.x > _xBounds.y)
{
transform.position -= Vector3.right * _xDiff;
}
}
}

View File

@ -4,6 +4,7 @@ using NUnit.Framework.Constraints;
using UnityEditor.UIElements;
using UnityEngine;
using UnityEngine.Assertions;
using Utils;
using Random = UnityEngine.Random;
namespace Weapons.Spawning
@ -32,7 +33,7 @@ namespace Weapons.Spawning
[SerializeField] private int numPerSide;
[SerializeField] private bool flipVertical;
[SerializeField] private float radius;
[SerializeField] private ParticleSystem.MinMaxCurve radius;
[SerializeField, Range(0, 360)] private float arc;
[SerializeField] private SpawnZone[] composite;
@ -89,7 +90,7 @@ namespace Weapons.Spawning
if (flipVertical)
point.y = 1 - point.y;
point *= radius;
point *= radius.EvaluateMinMaxCurve();
if (spawnPlane == SpawnPlane.XZ)
{
@ -168,7 +169,7 @@ namespace Weapons.Spawning
dir = Random.insideUnitCircle.normalized;
onGetPoint((point * radius) + offset, dir);
onGetPoint((point * radius.EvaluateMinMaxCurve()) + offset, dir);
}
}

View File

@ -169,6 +169,7 @@ public class Weapon : ScriptableObject
// if it's inactive, we haven't hit anything
if (!instance.gameObject.activeSelf) return false;
if (instance.gameObject.name == "disabled") return false;
// use the non allocating version so we don't have to allocate memory for every bullet
numHits = Physics.OverlapCapsuleNonAlloc(prevPos, instance.position, size/2f, _results, collidesWith, QueryTriggerInteraction.Collide);

View File

@ -68,6 +68,7 @@ Shader "custom/enemy"
float4 _FarColor;
float _Alpha;
float _Difficulty;
float _SpeedMultiplier;
float _RadiusWithDistance;
@ -143,8 +144,9 @@ Shader "custom/enemy"
wpos.y += radius;
float bounceStrength=5.0*_Intensity;
float bounce = (_SpeedMultiplier+bounceStrength*(_DistanceToNextBeat*_DistanceSinceLastBeat));
float bounce = _SpeedMultiplier+bounceStrength*(_DistanceToNextBeat*_DistanceSinceLastBeat);
wpos.z *= bounce;
wpos.z *= _Difficulty;
// wpos.z *= max(1, (wpos.z-6)* _SpeedMultiplier);
vpos = TransformWorldToObject(wpos);
@ -184,6 +186,8 @@ Shader "custom/enemy"
c = lerp(_Color1, _Color2, length(p));
c = lerp(c, _FarColor, normalised * _Intensity);
float4 nc = normalize(c);
c = lerp(nc, c, clamp(_Intensity + 0.02, 0, 1));
// float distanceAhead = IN.wpos.z - 6;
// float ca = clamp(distanceAhead * 0.1,0,1);

View File

@ -70,6 +70,7 @@ Shader "custom/obstacle"
float _Alpha;
float _PulseIntensity;
float _Difficulty;
float _SpeedMultiplier;
float _RadiusWithDistance;
@ -227,6 +228,7 @@ Shader "custom/obstacle"
float boundsStrength = 5.0*_Intensity;
float bounce = (_SpeedMultiplier+boundsStrength*(_DistanceToNextBeat*_DistanceSinceLastBeat));
wpos.z *= bounce;
wpos.z *= _Difficulty;
vpos = TransformWorldToObject(wpos);

View File

@ -99,7 +99,7 @@ MonoBehaviour:
m_PostInfinity: 2
m_RotationOrder: 4
m_ConstantMin: 0
m_ConstantMax: 1
m_ConstantMax: 0.1
damage: 1
collidesWith:
serializedVersion: 2
@ -116,9 +116,25 @@ MonoBehaviour:
surfaceOnly: 0
evenDistribution: 0
numSides: 3
numPerSide: 10
numPerSide: 5
flipVertical: 0
radius: 10
radius:
m_Mode: 3
m_CurveMultiplier: 0
m_CurveMin:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_CurveMax:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_ConstantMin: 7
m_ConstantMax: 13
arc: 360
composite: []
manualFire: 1

View File

@ -118,7 +118,23 @@ MonoBehaviour:
numSides: 3
numPerSide: 10
flipVertical: 0
radius: 5
radius:
m_Mode: 3
m_CurveMultiplier: 0
m_CurveMin:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_CurveMax:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_ConstantMin: 3
m_ConstantMax: 9
arc: 360
composite: []
manualFire: 1

View File

@ -81,10 +81,10 @@ MonoBehaviour:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_ConstantMin: 1.25
m_ConstantMax: 1.5
m_ConstantMin: 0.5
m_ConstantMax: 0.75
bulletSize:
m_Mode: 3
m_Mode: 0
m_CurveMultiplier: 0
m_CurveMin:
serializedVersion: 2
@ -98,8 +98,8 @@ MonoBehaviour:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_ConstantMin: 0.1
m_ConstantMax: 0.4
m_ConstantMin: 1
m_ConstantMax: 3
damage: 1
collidesWith:
serializedVersion: 2
@ -111,7 +111,7 @@ MonoBehaviour:
spawnType: 1
spawnDir: 0
spawnPlane: 1
width: 0.75
width: 1.5
height: 0
surfaceOnly: 1
evenDistribution: 1