This commit is contained in:
2025-09-17 18:56:28 +08:00
commit 54c72710a5
5244 changed files with 5717609 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
namespace DestroyIt
{
public enum Tag
{
ClingingDebris = 0,
ClingPoint = 7,
Concrete = 1,
Glass = 2,
MaterialTransferred = 3,
Metal = 4,
Paper = 5,
Wood = 6,
Powered = 8,
Pooled = 9,
Untagged = 10,
DestructibleGroup = 11,
Rubber = 12,
Stuffing = 13,
Plastic = 14,
TerrainTree = 15,
SpeedTree = 16,
DontDoDamage = 17
}
[System.Flags]
public enum HitBy
{
Bullet = (1 << 0),
Cannonball = (1 << 1),
Axe = (1 << 2)
}
public enum FacingDirection
{
None,
FollowedObject,
FixedPosition
}
public enum WeaponType
{
Cannonball = 0,
Rocket = 1,
Gun,
Nuke,
Melee,
RepairWrench
}
public enum DestructionType
{
//TODO: Possible future limited destruction types for things beyond specified camera distance:
//None,
//FiftyPercentDebris,
ParticleEffect = 0
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 889efda6cb6fc8a42a42ceffbcf5a8e0
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@@ -0,0 +1,14 @@
using System;
using UnityEngine;
namespace DestroyIt
{
[Serializable]
public class HitEffect
{
/// <summary>The type of weapon the object was hit by. (Bullet, Slashing, Cannonball, etc)</summary>
public HitBy hitBy;
/// <summary>The effect to play when hit by this type of weapon.</summary>
public GameObject effect;
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 3a4454c59e6c84d438c612c4b88f752b
timeCreated: 1484712234
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@

namespace DestroyIt
{
public interface Damage
{
float DamageAmount { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ffe5da0c083ba12438bd0c18ac72c538
timeCreated: 1469680742
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,145 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
// ReSharper disable IdentifierTypo
namespace DestroyIt
{
[Serializable]
public class DamageLevel
{
public float maxHitPoints;
public float minHitPoints;
public int healthPercent;
public bool hasError;
public int visibleDamageLevel;
}
/// <summary>A particle effect that is triggered at a specified damage level.</summary>
[Serializable]
public class DamageEffect
{
public int TriggeredAt;
public Vector3 Offset;
public Vector3 Rotation;
public Vector3 Scale = Vector3.one;
[FormerlySerializedAs("Effect")]
public GameObject Prefab;
public GameObject GameObject;
public bool HasStarted;
public bool HasTagDependency;
public Tag TagDependency;
public bool UnparentOnDestroy = true;
public bool StopEmittingOnDestroy;
public ParticleSystem[] ParticleSystems { get; set; }
}
public class Debris
{
public Rigidbody Rigidbody { get; set; }
public GameObject GameObject { get; set; }
public bool IsActive
{
get {return (Rigidbody != null && GameObject.activeSelf);}
}
public void Disable()
{
if (Rigidbody != null)
GameObject.SetActive(false);
}
}
public class ExplosiveDamage : Damage
{
public float BlastForce { get; set; }
public Vector3 Position { get; set; }
public float Radius { get; set; }
public float UpwardModifier { get; set; }
public float DamageAmount { get; set; }
}
/// <summary>Contains information about the object that collided with a destructible object.</summary>
public class ImpactDamage : Damage
{
/// <summary>The amount of damage done by the impact force.</summary>
public float DamageAmount { get; set; }
/// <summary>A reference to the object that collided into the destructible object.</summary>
public Rigidbody ImpactObject { get; set; }
public Vector3 ImpactObjectVelocityFrom { get; set; }
public Vector3 ImpactObjectVelocityTo
{
get { return ImpactObjectVelocityFrom * -1; }
}
public float AdditionalForce { get; set; }
public Vector3 AdditionalForcePosition { get; set; }
public float AdditionalForceRadius { get; set; }
}
/// <summary>Direct damage without any impact or force.</summary>
public class DirectDamage : Damage
{
public float DamageAmount { get; set; }
}
public class ActiveParticle
{
public GameObject GameObject { get; set; }
public float InstantiatedTime { get; set; }
public int ParentId { get; set; }
}
[Serializable]
public class DamageMaterial
{
public string name;
public List<Material> damageMaterials;
}
[Serializable]
public class MaterialMapping
{
public Material SourceMaterial;
public Material ReplacementMaterial;
}
[Serializable]
public class PoolEntry
{
public GameObject Prefab;
public int Count;
public bool OnlyPooled;
}
public class TerrainTree
{
public int Index { get; set; }
public Vector3 Position { get; set; }
public TreeInstance TreeInstance { get; set; }
}
[Serializable]
public class DestructibleTree
{
public int prototypeIndex;
public GameObject Prefab;
}
[Serializable]
public class TreeReset
{
public int prototypeIndex;
public Vector3 position;
public DateTime resetTime;
public Color color;
public float heightScale;
public float widthScale;
}
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1e4ec7c7c4f9fa8439737c3485bc1579
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData: