Initial Wwise Integration

Created wwise project
Integrated inventory UI sounds
Improved projectile weapon behavior (randomized start position, stopped them from self-destructing at target range when airburst is disabled)
This commit is contained in:
Reinier Vens 2021-02-27 20:53:36 +00:00
commit db8c3c7779
1019 changed files with 76372 additions and 110 deletions

View file

@ -15,7 +15,6 @@ public class Projectile : MonoBehaviour
public float AirburstDistance;
public float AirburstRange;
public float AirburstVelocity;
public float DirectHitDamageMultiplier = 1;
private bool _alive;
@ -87,7 +86,7 @@ public class Projectile : MonoBehaviour
var distanceTraveled = (transform.position - StartPosition).magnitude;
if(distanceTraveled > Range)
StartCoroutine(Kill());
if (AirburstDistance > 1 && distanceTraveled > AirburstDistance)
if (AirburstRange > 1 && distanceTraveled > AirburstDistance)
{
StartCoroutine(Kill());
var ht = HitEffect.Instantiate<Transform>();

View file

@ -17,13 +17,13 @@ public class ProjectileManager : InstantWeaponEffectManager
var barrel = source.GetBarrel(hp);
var angle = weapon.Spread / 2;
p.SourceEntity = source.Entity;
p.StartPosition = p.transform.position = barrel.position;
p.Velocity = Quaternion.Euler(
Random.Range(-angle, angle),
Random.Range(-angle, angle),
Random.Range(-angle, angle)) *
barrel.forward *
weapon.Velocity;
p.StartPosition = p.transform.position = barrel.position + p.Velocity * (Random.value * Time.deltaTime);
if(InheritVelocity)
p.Velocity += new Vector3(source.Entity.Velocity.x, 0, source.Entity.Velocity.y);
p.Damage = weapon.Damage;

View file

@ -85,6 +85,7 @@ public class CombatState : BaseState
{
var targetHullData = _agent.ItemManager.GetData(target.Hull) as HullData;
var targetVelocity = float3(target.Velocity.x, 0, target.Velocity.y);
var shipVelocity = float3(_agent.Ship.Velocity.x, 0, _agent.Ship.Velocity.y);
var predictedPosition = AetheriaMath.FirstOrderIntercept(
_agent.Ship.Position,
float3.zero,

View file

@ -105,6 +105,11 @@ public class TurretController : IBehavior
}
else
{
foreach (var x in _weapons)
{
if (x.Firing)
x.Deactivate();
}
EquippedEntity.Target.Value = EquippedEntity.VisibleHostiles.FirstOrDefault(e => e is Ship);
}
return true;

View file

@ -162,7 +162,7 @@ public abstract class Entity
{
VisibleEntities.Remove(replace.Key);
if(IsHostileTo(replace.Key))
VisibleHostiles.Add(replace.Key);
VisibleHostiles.Remove(replace.Key);
}
});
EntityInfoGathered.ObserveRemove().Subscribe(remove => VisibleEntities.Remove(remove.Key));

View file

@ -48,6 +48,7 @@ public class InventoryMenu : MonoBehaviour
private void OnEnable()
{
AkSoundEngine.RegisterGameObj(gameObject);
BackgroundEntered.gameObject.SetActive(true);
BackgroundEntered.OnPointerEnterAsObservable().Subscribe(enter =>
@ -68,6 +69,7 @@ public class InventoryMenu : MonoBehaviour
private void OnDisable()
{
AkSoundEngine.UnregisterGameObj(gameObject);
BackgroundEntered.gameObject.SetActive(false);
}
@ -103,6 +105,7 @@ public class InventoryMenu : MonoBehaviour
_dragOffsets = _dragCells.Select(x => (Vector2) x.position - data.PointerEventData.position).ToArray();
panel.IgnoreOccupancy = _originalOccupancy;
panel.RefreshCells(_originalOccupancy.Expand().Coordinates);
AkSoundEngine.PostEvent("Pickup", gameObject);
}
}
else if (data is InventoryEntityEventData entityEvent)
@ -130,6 +133,7 @@ public class InventoryMenu : MonoBehaviour
_dragOffsets = _dragCells.Select(x => (Vector2) x.position - data.PointerEventData.position).ToArray();
panel.IgnoreOccupancy = _originalOccupancy;
panel.RefreshCells(_originalOccupancy.Expand().Coordinates);
AkSoundEngine.PostEvent("Pickup", gameObject);
}
}
});
@ -155,15 +159,21 @@ public class InventoryMenu : MonoBehaviour
{
cargoEvent.CargoBay.Remove(_dragItem);
_dragTargetPanel.DropItem(_dragItem, _dragTargetPosition);
if(_dragTargetPanel.Target == InventoryPanelTarget.Cargo)
AkSoundEngine.PostEvent("Drop", gameObject);
else
AkSoundEngine.PostEvent("Equip", gameObject);
}
else if (data is InventoryEntityEventData entityEvent)
{
if (entityEvent.Entity.Unequip(_originalEquippedItem) != null)
{
_dragTargetPanel.DropItem(_dragItem, _dragTargetPosition);
AkSoundEngine.PostEvent("Unequip", gameObject);
}
else
{
AkSoundEngine.PostEvent("UI_Fail", gameObject);
Dialog.Clear();
Dialog.Title.text = "Unable to move item!";
Dialog.AddProperty("Verify that cargo bays are empty before un-equipping them.");
@ -282,6 +292,7 @@ public class InventoryMenu : MonoBehaviour
var otherPanel = panel == InventoryPanels[0] ? InventoryPanels[1] : InventoryPanels[0];
if (otherPanel.DropItem(item))
{
AkSoundEngine.PostEvent("Equip", gameObject);
cargoEvent.CargoBay.Remove(item);
panel.RefreshCells();
otherPanel.RefreshCells();
@ -313,6 +324,7 @@ public class InventoryMenu : MonoBehaviour
var v2 = _selectedItemData.Shape.Rotate(v, _selectedItem.Rotation) + _selectedPosition;
_selectedPanel.CellInstances[v2].Icon.color = _selectedPanel.GetColor(v2, true);
}
AkSoundEngine.PostEvent("UI_Success", gameObject);
}
}
}
@ -326,6 +338,7 @@ public class InventoryMenu : MonoBehaviour
var otherPanel = panel == InventoryPanels[0] ? InventoryPanels[1] : InventoryPanels[0];
if (otherPanel.DropItem(item.EquippableItem))
{
AkSoundEngine.PostEvent("Unequip", gameObject);
entityEvent.Entity.Unequip(item);
panel.RefreshCells();
otherPanel.RefreshCells();
@ -355,6 +368,7 @@ public class InventoryMenu : MonoBehaviour
var v2 = _selectedItemData.Shape.Rotate(v, _selectedItem.Rotation) + _selectedPosition;
_selectedPanel.CellInstances[v2].Icon.color = _selectedPanel.GetColor(v2, true);
}
AkSoundEngine.PostEvent("UI_Success", gameObject);
}
}
}

View file

@ -85,6 +85,10 @@ public class InventoryPanel : MonoBehaviour
int2(-1, 1)
};
public InventoryPanelTarget Target =>
_displayedEntity != null ? InventoryPanelTarget.Equipment :
_displayedCargo != null ? InventoryPanelTarget.Cargo : InventoryPanelTarget.None;
private void Start()
{
if (Thermal)
@ -692,3 +696,10 @@ public class InventoryCargoEventData : InventoryEventData
public EquippedCargoBay CargoBay { get; }
}
public enum InventoryPanelTarget
{
None,
Cargo,
Equipment
}