imported music, added combat and death

This commit is contained in:
2023-04-21 03:30:43 -04:00
parent 0b7b2515d1
commit c4094b169c
82 changed files with 11177 additions and 2270 deletions

View File

@ -7,6 +7,7 @@ public class FlareBeacon : MonoBehaviour
{
[SerializeField]
private float range = 1;
public float Range { get { return range; }}
[SerializeField]
private float duration = 5f;
@ -14,6 +15,7 @@ public class FlareBeacon : MonoBehaviour
[SerializeField]
private NavMeshObstacle obstacle;
private FlareRegister register;
void OnDrawGizmosSelected()
{
// Draw a yellow sphere at the transform's position
@ -24,6 +26,8 @@ public class FlareBeacon : MonoBehaviour
// Start is called before the first frame update
void Start()
{
register = FlareRegister.instance;
register.beacons.Add(this);
transform.localEulerAngles = new Vector3(-89.98f, 0, 0);
Ray r = new Ray();
r.direction = -transform.forward;
@ -42,6 +46,8 @@ public class FlareBeacon : MonoBehaviour
if(Physics.Raycast(r,out hit)){
// transform.position = hit.point;
}
if(obstacle!=null)
obstacle.radius = this.range / 10;
}

View File

@ -9,11 +9,18 @@ public class BulletComponent : MonoBehaviour
private float existed = 0f;
[SerializeField]
private string type = "flare";
private FlareRegister register;
[SerializeField]
private float damageRange = 20f;
[SerializeField]
private float damageMagnitude = 1f;
public float DamageMagnitude { get { return this.damageMagnitude; } }
public float DamageRange { get { return damageRange; } }
// Start is called before the first frame update
void Start()
{
register = FlareRegister.instance;
register.bullets.Add(this);
}
// Update is called once per frame
@ -25,6 +32,7 @@ public class BulletComponent : MonoBehaviour
{
if(existed >= duration)
{
register.bullets.Remove(this);
Destroy(this.gameObject);
}
existed += Time.fixedDeltaTime;

View File

@ -25,6 +25,7 @@ public class PistolComponent : MonoBehaviour
[SerializeField]
private float maxProjectileDuration = 5f;
//private Dictionary<int,float> projectiles = new Dictionary<int, float>();
@ -32,7 +33,7 @@ public class PistolComponent : MonoBehaviour
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
@ -66,7 +67,7 @@ public class PistolComponent : MonoBehaviour
{
targetObject.gameObject.transform.position = hit.point;
float drop = CalculateDrop(this.bulletSpawnPoint.position, hit.point, this.transform.up * this.firePower);
print(drop);
//print(drop);
}
}
@ -84,6 +85,8 @@ public class PistolComponent : MonoBehaviour
Rigidbody pRigid = projectile.GetComponent<Rigidbody>();
pRigid.AddForce(pRigid.transform.up*this.firePower, ForceMode.Impulse);
projectile.transform.parent = null;
}
public void Enable()

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 90f48ba02e4248644b7c711ebd9b212f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FlareRegister : MonoBehaviour
{
public List<BulletComponent> bullets= new List<BulletComponent>();
public List<FlareBeacon> beacons= new List<FlareBeacon>();
public static FlareRegister instance;
// Start is called before the first frame update
void Start()
{
instance = this;
}
// Update is called once per frame
void Update()
{
}
}

View File

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

View File

@ -34,10 +34,12 @@ public class SpecialItemCycler : MonoBehaviour
private TMP_Text selectedQuantityText;
private Color sqtInitColor;
// Start is called before the first frame update
void Start()
{
sqtInitColor = selectedQuantityText.color;
sqtInitColor = selectedQuantityText.color;
}
// Update is called once per frame
@ -81,7 +83,7 @@ public class SpecialItemCycler : MonoBehaviour
instance.transform.localPosition = Vector3.zero;
instance.transform.parent = null;
invent.Remove(spawnableItems[spawnableIndex].name);
}
}