GUNS GUNS GUNS
GUESS WHAT
This commit is contained in:
parent
1e273d691e
commit
8aaccac2b5
83 changed files with 15291 additions and 1291 deletions
|
|
@ -2,15 +2,13 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using System;
|
||||
using MessagePack;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class ProjectileWeaponData : WeaponData
|
||||
public class ProjectileWeaponData : InstantWeaponData
|
||||
{
|
||||
[InspectablePrefab, JsonProperty("bullet"), Key(6)]
|
||||
public string BulletPrefab;
|
||||
|
||||
[InspectableField, JsonProperty("spread"), Key(7)]
|
||||
public PerformanceStat Spread = new PerformanceStat();
|
||||
|
||||
|
|
@ -22,46 +20,6 @@ public class ProjectileWeaponData : WeaponData
|
|||
|
||||
public override IBehavior CreateInstance(ItemManager context, Entity entity, EquippedItem item)
|
||||
{
|
||||
return new ProjectileWeapon(context, this, entity, item);
|
||||
}
|
||||
}
|
||||
|
||||
public class ProjectileWeapon : IBehavior
|
||||
{
|
||||
private ProjectileWeaponData _data;
|
||||
private Entity Entity { get; }
|
||||
private EquippedItem Item { get; }
|
||||
private ItemManager Context { get; }
|
||||
|
||||
public BehaviorData Data => _data;
|
||||
|
||||
public ProjectileWeapon(ItemManager context, ProjectileWeaponData c, Entity entity, EquippedItem item)
|
||||
{
|
||||
Context = context;
|
||||
_data = c;
|
||||
Entity = entity;
|
||||
Item = item;
|
||||
}
|
||||
|
||||
// private void Fire()
|
||||
// {
|
||||
// Hardpoint.Temperature += _projectileWeapon.Heat.Evaluate(Hardpoint) / Hardpoint.HeatCapacity;
|
||||
// var inst = GameObject.Instantiate(_projectileWeapon.BulletPrefab).transform;
|
||||
// Physics.IgnoreCollision(Hardpoint.Ship.Ship.GetComponent<Collider>(), inst.GetComponent<Collider>());
|
||||
// var bullet = inst.GetComponent<Bullet>();
|
||||
// bullet.Target = Hardpoint.Ship.Ship.Target;
|
||||
// bullet.Source = Hardpoint.Ship.Ship.Hitpoints;
|
||||
// bullet.Lifetime = _projectileWeapon.Range.Evaluate(Hardpoint) / _projectileWeapon.Velocity.Evaluate(Hardpoint);
|
||||
// bullet.Damage = _projectileWeapon.Damage.Evaluate(Hardpoint);
|
||||
// inst.position = Hardpoint.Proxy.position;
|
||||
// inst.rotation = Hardpoint.Proxy.rotation;
|
||||
// inst.GetComponent<Rigidbody>().velocity = _projectileWeapon.Velocity.Evaluate(Hardpoint) * Vector3.RotateTowards(-inst.forward, Hardpoint.Ship.Ship.Direction, _projectileWeapon.Deflection * Mathf.Deg2Rad, 1);
|
||||
// Hardpoint.Ship.Ship.AudioSource.PlayOneShot(_projectileWeapon.Sounds.RandomElement());
|
||||
// Debug.Log($"Firing bullet {b}");
|
||||
// }
|
||||
|
||||
public bool Update(float delta)
|
||||
{
|
||||
return true;
|
||||
return new InstantWeapon(context, this, entity, item);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue