imported music, added combat and death
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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()
|
||||
|
8
Assets/Scripts/Item/Registers.meta
Normal file
8
Assets/Scripts/Item/Registers.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90f48ba02e4248644b7c711ebd9b212f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
24
Assets/Scripts/Item/Registers/FlareRegister.cs
Normal file
24
Assets/Scripts/Item/Registers/FlareRegister.cs
Normal 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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
Assets/Scripts/Item/Registers/FlareRegister.cs.meta
Normal file
11
Assets/Scripts/Item/Registers/FlareRegister.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 788a4240e87c8654fa8813057977c848
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -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);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user