diff --git a/.gitmodules b/.gitmodules index 7de3ea9d..7e83ce33 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "Assets/Plugins/UnityUtilLib"] - path = Assets/Plugins/UnityUtilLib + path = Assets/External/UnityUtilLib url = https://github.com/james7132/UnityUtilLib.git diff --git a/Assets/Plugins.meta b/Assets/External.meta similarity index 67% rename from Assets/Plugins.meta rename to Assets/External.meta index 1f27015c..d26c59e1 100644 --- a/Assets/Plugins.meta +++ b/Assets/External.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 1ad993fa7a3ec8c43b434b91d5a64fc5 +guid: 7d659feaa131eda4297db14b38207fff folderAsset: yes -timeCreated: 1427611154 +timeCreated: 1427734615 licenseType: Free DefaultImporter: userData: diff --git a/Assets/Plugins/DanmakuUnity2D.meta b/Assets/External/DanmakuUnity2D.meta similarity index 67% rename from Assets/Plugins/DanmakuUnity2D.meta rename to Assets/External/DanmakuUnity2D.meta index 10b49598..0f2a770d 100644 --- a/Assets/Plugins/DanmakuUnity2D.meta +++ b/Assets/External/DanmakuUnity2D.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: d67c7618ed1e35d4798efbd2df519e76 +guid: eb312124ef71cda4dbb59b8d1a9b6a56 folderAsset: yes -timeCreated: 1427611179 +timeCreated: 1427734720 licenseType: Free DefaultImporter: userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Attack Patterns.meta b/Assets/External/DanmakuUnity2D/Attack Patterns.meta similarity index 67% rename from Assets/Plugins/DanmakuUnity2D/Attack Patterns.meta rename to Assets/External/DanmakuUnity2D/Attack Patterns.meta index dde59b60..93c96d12 100644 --- a/Assets/Plugins/DanmakuUnity2D/Attack Patterns.meta +++ b/Assets/External/DanmakuUnity2D/Attack Patterns.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 0fbd30016b6c30d419ef6ecfae52b3ba +guid: f44a42adcc0c51e42998d6ca5ad1e270 folderAsset: yes -timeCreated: 1427611179 +timeCreated: 1427734773 licenseType: Free DefaultImporter: userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Attack Patterns/Burst.cs b/Assets/External/DanmakuUnity2D/Attack Patterns/Burst.cs similarity index 93% rename from Assets/Plugins/DanmakuUnity2D/Attack Patterns/Burst.cs rename to Assets/External/DanmakuUnity2D/Attack Patterns/Burst.cs index 0077dc96..ec3585bb 100644 --- a/Assets/Plugins/DanmakuUnity2D/Attack Patterns/Burst.cs +++ b/Assets/External/DanmakuUnity2D/Attack Patterns/Burst.cs @@ -34,12 +34,10 @@ public class Burst : AttackPattern { private FrameCounter burstDelay; [SerializeField] - [Range(-180f, 180f)] - private float burstInitialRotation; + private DynamicFloat burstInitialRotation; [SerializeField] - [Range(-360f, 360f)] - private float burstRotationDelta; + private DynamicFloat burstRotationDelta; [SerializeField] private ProjectileControlBehavior[] controllers; diff --git a/Assets/Plugins/DanmakuUnity2D/Attack Patterns/Burst.cs.meta b/Assets/External/DanmakuUnity2D/Attack Patterns/Burst.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Attack Patterns/Burst.cs.meta rename to Assets/External/DanmakuUnity2D/Attack Patterns/Burst.cs.meta index 4d979a52..f7701a7b 100644 --- a/Assets/Plugins/DanmakuUnity2D/Attack Patterns/Burst.cs.meta +++ b/Assets/External/DanmakuUnity2D/Attack Patterns/Burst.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 470558aa7cbb4c0468822ddf5f28d1c7 -timeCreated: 1425854335 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 470558aa7cbb4c0468822ddf5f28d1c7 +timeCreated: 1425854335 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Attack Patterns/EnemyBasicAttack.cs b/Assets/External/DanmakuUnity2D/Attack Patterns/EnemyBasicAttack.cs similarity index 85% rename from Assets/Plugins/DanmakuUnity2D/Attack Patterns/EnemyBasicAttack.cs rename to Assets/External/DanmakuUnity2D/Attack Patterns/EnemyBasicAttack.cs index de087510..c6ee764c 100644 --- a/Assets/Plugins/DanmakuUnity2D/Attack Patterns/EnemyBasicAttack.cs +++ b/Assets/External/DanmakuUnity2D/Attack Patterns/EnemyBasicAttack.cs @@ -17,19 +17,19 @@ public class EnemyBasicAttack : AttackPattern { private FrameCounter fireDelay; [SerializeField] - private float velocity; + private DynamicFloat velocity; [SerializeField] - public float angV; + public DynamicFloat angV; [SerializeField] - private float currentDelay; + private DynamicFloat currentDelay; [SerializeField] - private float generalRange; + private DynamicFloat generalRange; [SerializeField] - private ProjectilePrefab basicPrefab; + private DanmakuPrefab basicPrefab; protected override bool IsFinished { get { diff --git a/Assets/Plugins/DanmakuUnity2D/Attack Patterns/EnemyBasicAttack.cs.meta b/Assets/External/DanmakuUnity2D/Attack Patterns/EnemyBasicAttack.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Attack Patterns/EnemyBasicAttack.cs.meta rename to Assets/External/DanmakuUnity2D/Attack Patterns/EnemyBasicAttack.cs.meta index 7f07c210..d9d2c60c 100644 --- a/Assets/Plugins/DanmakuUnity2D/Attack Patterns/EnemyBasicAttack.cs.meta +++ b/Assets/External/DanmakuUnity2D/Attack Patterns/EnemyBasicAttack.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 17f444899c7446b4abf0fdacf845001a -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: 17f444899c7446b4abf0fdacf845001a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Attack Patterns/ObjectAttackPattern.cs b/Assets/External/DanmakuUnity2D/Attack Patterns/ObjectAttackPattern.cs similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Attack Patterns/ObjectAttackPattern.cs rename to Assets/External/DanmakuUnity2D/Attack Patterns/ObjectAttackPattern.cs index 68df081b..faba0008 100644 --- a/Assets/Plugins/DanmakuUnity2D/Attack Patterns/ObjectAttackPattern.cs +++ b/Assets/External/DanmakuUnity2D/Attack Patterns/ObjectAttackPattern.cs @@ -1,27 +1,27 @@ -using UnityEngine; -using System.Collections; - -namespace Danmaku2D.AttackPatterns { - - - public class ObjectAttackPattern : TimedAttackPattern { - - public GameObject prefab; - public Vector2 position; - private GameObject Runtime; - - protected override void OnInitialize () { - base.OnInitialize (); - if(prefab == null) - throw new MissingReferenceException(GetType().ToString() + " needs a prefab to function."); - Runtime = TargetField.SpawnGameObject(prefab, position); - } - - protected override void OnFinalize () { - base.OnFinalize (); - if (Runtime != null) - Destroy (Runtime); - } - } - +using UnityEngine; +using System.Collections; + +namespace Danmaku2D.AttackPatterns { + + + public class ObjectAttackPattern : TimedAttackPattern { + + public GameObject prefab; + public Vector2 position; + private GameObject Runtime; + + protected override void OnInitialize () { + base.OnInitialize (); + if(prefab == null) + throw new MissingReferenceException(GetType().ToString() + " needs a prefab to function."); + Runtime = TargetField.SpawnGameObject(prefab, position); + } + + protected override void OnFinalize () { + base.OnFinalize (); + if (Runtime != null) + Destroy (Runtime); + } + } + } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Attack Patterns/ObjectAttackPattern.cs.meta b/Assets/External/DanmakuUnity2D/Attack Patterns/ObjectAttackPattern.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Attack Patterns/ObjectAttackPattern.cs.meta rename to Assets/External/DanmakuUnity2D/Attack Patterns/ObjectAttackPattern.cs.meta index 399d9d71..ceadbac9 100644 --- a/Assets/Plugins/DanmakuUnity2D/Attack Patterns/ObjectAttackPattern.cs.meta +++ b/Assets/External/DanmakuUnity2D/Attack Patterns/ObjectAttackPattern.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 5a98f1ea76fd80d41b2ce6cf3f3e6192 -timeCreated: 1427477152 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 5a98f1ea76fd80d41b2ce6cf3f3e6192 +timeCreated: 1427477152 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Attack Patterns/TimedAttackPattern.cs b/Assets/External/DanmakuUnity2D/Attack Patterns/TimedAttackPattern.cs similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Attack Patterns/TimedAttackPattern.cs rename to Assets/External/DanmakuUnity2D/Attack Patterns/TimedAttackPattern.cs index a2fd3d58..0dd22c58 100644 --- a/Assets/Plugins/DanmakuUnity2D/Attack Patterns/TimedAttackPattern.cs +++ b/Assets/External/DanmakuUnity2D/Attack Patterns/TimedAttackPattern.cs @@ -1,36 +1,36 @@ -using UnityEngine; -using System.Collections; -using UnityUtilLib; - -/// -/// A development kit for quick development of 2D Danmaku games -/// -namespace Danmaku2D { - /// - /// A abstract class meant for time-limited AttackPatterns - /// - public abstract class TimedAttackPattern : AttackPattern { - - /// - /// Defines how long the AttackPattern will last before automatically terminating - /// - [SerializeField] - private FrameCounter timeout; - - protected override void MainLoop () { - if(timeout.Tick (false)) { - return; - } - } - - protected override void OnInitialize () { - timeout.Reset (); - } - - protected sealed override bool IsFinished { - get { - return timeout.Ready(); - } - } - } +using UnityEngine; +using System.Collections; +using UnityUtilLib; + +/// +/// A development kit for quick development of 2D Danmaku games +/// +namespace Danmaku2D { + /// + /// A abstract class meant for time-limited AttackPatterns + /// + public abstract class TimedAttackPattern : AttackPattern { + + /// + /// Defines how long the AttackPattern will last before automatically terminating + /// + [SerializeField] + private FrameCounter timeout; + + protected override void MainLoop () { + if(timeout.Tick (false)) { + return; + } + } + + protected override void OnInitialize () { + timeout.Reset (); + } + + protected sealed override bool IsFinished { + get { + return timeout.Ready(); + } + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Attack Patterns/TimedAttackPattern.cs.meta b/Assets/External/DanmakuUnity2D/Attack Patterns/TimedAttackPattern.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Attack Patterns/TimedAttackPattern.cs.meta rename to Assets/External/DanmakuUnity2D/Attack Patterns/TimedAttackPattern.cs.meta index 8815cf39..50877205 100644 --- a/Assets/Plugins/DanmakuUnity2D/Attack Patterns/TimedAttackPattern.cs.meta +++ b/Assets/External/DanmakuUnity2D/Attack Patterns/TimedAttackPattern.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: c839ded8ccd0f974b848f85a9a665ff7 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: c839ded8ccd0f974b848f85a9a665ff7 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/BasicEnemy.cs b/Assets/External/DanmakuUnity2D/BasicEnemy.cs similarity index 90% rename from Assets/Plugins/DanmakuUnity2D/BasicEnemy.cs rename to Assets/External/DanmakuUnity2D/BasicEnemy.cs index 595acdc0..9b337f34 100644 --- a/Assets/Plugins/DanmakuUnity2D/BasicEnemy.cs +++ b/Assets/External/DanmakuUnity2D/BasicEnemy.cs @@ -1,66 +1,68 @@ -using UnityEngine; -using System.Collections; - -/// -/// A development kit for quick development of 2D Danmaku games -/// -namespace Danmaku2D { - - /// - /// A basic enemy that is usually used as cannon fodder in Danmaku games. - /// - [RequireComponent(typeof(MovementPattern))] - public class BasicEnemy : Enemy { - - [SerializeField] - private float maxHealth; - private float currentHealth; - - /// - /// Gets the current health. - /// - /// The current health. - public float CurrentHealth { - get { - return currentHealth; - } - } - - private MovementPattern movementPattern; - - private AttackPattern attackPattern; - /// - /// Gets the current attack pattern. - /// - /// The current attack pattern. - public override AttackPattern CurrentAttackPattern { - get { - return attackPattern; - } - } - - public override void Awake() { - base.Awake (); - currentHealth = maxHealth; - movementPattern = GetComponent (); - movementPattern.DestroyOnEnd = true; - attackPattern = GetComponent (); - if (attackPattern != null) { - attackPattern.TargetField = Field.TargetField; - attackPattern.Fire(); - } - movementPattern.StartMovement (); - } - - protected override void Damage (float damage) { - currentHealth -= damage; - print (currentHealth); - } - - public override bool IsDead { - get { - return currentHealth <= 0; - } - } - } -} +using UnityEngine; +using System.Collections; +using UnityUtilLib; + +/// +/// A development kit for quick development of 2D Danmaku games +/// +namespace Danmaku2D { + + /// + /// A basic enemy that is usually used as cannon fodder in Danmaku games. + /// + [RequireComponent(typeof(MovementPattern))] + public class BasicEnemy : Enemy { + + [SerializeField] + private float maxHealth; + private float currentHealth; + + /// + /// Gets the current health. + /// + /// The current health. + public float CurrentHealth { + get { + return currentHealth; + } + } + + private MovementPattern movementPattern; + + private AttackPattern attackPattern; + /// + /// Gets the current attack pattern. + /// + /// The current attack pattern. + public override AttackPattern CurrentAttackPattern { + get { + return attackPattern; + } + } + + public override void Awake() { + base.Awake (); + Field = Util.FindClosest (transform.position); + currentHealth = maxHealth; + movementPattern = GetComponent (); + movementPattern.DestroyOnEnd = true; + attackPattern = GetComponent (); + if (attackPattern != null) { + attackPattern.TargetField = Field.TargetField; + attackPattern.Fire(); + } + movementPattern.StartMovement (); + } + + protected override void Damage (float damage) { + currentHealth -= damage; + print (currentHealth); + } + + public override bool IsDead { + get { + return currentHealth <= 0; + } + } + } +} diff --git a/Assets/Plugins/DanmakuUnity2D/BasicEnemy.cs.meta b/Assets/External/DanmakuUnity2D/BasicEnemy.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/BasicEnemy.cs.meta rename to Assets/External/DanmakuUnity2D/BasicEnemy.cs.meta index 318607ed..69a0a927 100644 --- a/Assets/Plugins/DanmakuUnity2D/BasicEnemy.cs.meta +++ b/Assets/External/DanmakuUnity2D/BasicEnemy.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: bdbf957699d83554481b58d40e2a68ef -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: bdbf957699d83554481b58d40e2a68ef +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/BulletCancelArea.cs b/Assets/External/DanmakuUnity2D/BulletCancelArea.cs similarity index 96% rename from Assets/Plugins/DanmakuUnity2D/BulletCancelArea.cs rename to Assets/External/DanmakuUnity2D/BulletCancelArea.cs index c8cbd8a6..ea0a7c56 100644 --- a/Assets/Plugins/DanmakuUnity2D/BulletCancelArea.cs +++ b/Assets/External/DanmakuUnity2D/BulletCancelArea.cs @@ -1,39 +1,39 @@ -using UnityEngine; -using System.Collections; -using UnityUtilLib; - -/// -/// A development kit for quick development of 2D Danmaku games -/// -namespace Danmaku2D { - [RequireComponent(typeof(SpriteRenderer))] - [RequireComponent(typeof(ProjectileBoundary))] - [RequireComponent(typeof(Collider2D))] - public class BulletCancelArea : PausableGameObject { - - public void Run(float duration, float maxScale) { - StartCoroutine (Execute (duration, maxScale)); - } - - /// - /// Execute this instance. - /// - private IEnumerator Execute(float duration, float maxScale) { - SpriteRenderer rend = GetComponent (); - Vector3 maxScaleV = Vector3.one * maxScale; - Vector3 startScale = transform.localScale; - Color spriteColor = rend.color; - Color targetColor = spriteColor; - targetColor.a = 0f; - float t = 0f; - float dt = Util.TargetDeltaTime; - while (t < 1f) { - transform.localScale = Vector3.Lerp(startScale, maxScaleV, t); - rend.color = Color.Lerp(spriteColor, targetColor, t); - yield return UtilCoroutines.WaitForUnpause(this); - t += dt / duration; - } - Destroy (gameObject); - } - } +using UnityEngine; +using System.Collections; +using UnityUtilLib; + +/// +/// A development kit for quick development of 2D Danmaku games +/// +namespace Danmaku2D { + [RequireComponent(typeof(SpriteRenderer))] + [RequireComponent(typeof(ProjectileBoundary))] + [RequireComponent(typeof(Collider2D))] + public class BulletCancelArea : PausableGameObject { + + public void Run(float duration, float maxScale) { + StartCoroutine (Execute (duration, maxScale)); + } + + /// + /// Execute this instance. + /// + private IEnumerator Execute(float duration, float maxScale) { + SpriteRenderer rend = GetComponent (); + Vector3 maxScaleV = Vector3.one * maxScale; + Vector3 startScale = transform.localScale; + Color spriteColor = rend.color; + Color targetColor = spriteColor; + targetColor.a = 0f; + float t = 0f; + float dt = Util.TargetDeltaTime; + while (t < 1f) { + transform.localScale = Vector3.Lerp(startScale, maxScaleV, t); + rend.color = Color.Lerp(spriteColor, targetColor, t); + yield return UtilCoroutines.WaitForUnpause(this); + t += dt / duration; + } + Destroy (gameObject); + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/BulletCancelArea.cs.meta b/Assets/External/DanmakuUnity2D/BulletCancelArea.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/BulletCancelArea.cs.meta rename to Assets/External/DanmakuUnity2D/BulletCancelArea.cs.meta index 34e051a8..bb56ad20 100644 --- a/Assets/Plugins/DanmakuUnity2D/BulletCancelArea.cs.meta +++ b/Assets/External/DanmakuUnity2D/BulletCancelArea.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 0a1a899b9950ff84f8cc2deea6e3b260 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: 0a1a899b9950ff84f8cc2deea6e3b260 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers.meta b/Assets/External/DanmakuUnity2D/Controllers.meta similarity index 67% rename from Assets/Plugins/DanmakuUnity2D/Controllers.meta rename to Assets/External/DanmakuUnity2D/Controllers.meta index 6d90b4cf..1e6624fc 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers.meta +++ b/Assets/External/DanmakuUnity2D/Controllers.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 36c7286cac9cb7648a99e19902fa7472 +guid: b888e549009f8234b99f4776bf29550e folderAsset: yes -timeCreated: 1427611179 +timeCreated: 1427734773 licenseType: Free DefaultImporter: userData: diff --git a/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers.meta b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers.meta new file mode 100644 index 00000000..64c9b68a --- /dev/null +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: da2de519a7f832249896b926e7bc61ca +folderAsset: yes +timeCreated: 1427734773 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AccelerationProjectileController.cs b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AccelerationProjectileController.cs similarity index 61% rename from Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AccelerationProjectileController.cs rename to Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AccelerationProjectileController.cs index 54aeccf6..72128a23 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AccelerationProjectileController.cs +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AccelerationProjectileController.cs @@ -1,21 +1,6 @@ -using UnityEngine; +using UnityEngine; using UnityUtilLib; -namespace Danmaku2D.ProjectileControllers { - - public class AccelerationProjectileController : ControllerWrapperBehavior { - [SerializeField] - private AccelerationController controller; - - #region implemented abstract members of ControllerWrapperBehavior - protected override AccelerationController CreateController () { - return controller; - } - #endregion - } - -} - /// /// A development kit for quick development of 2D Danmaku games /// @@ -25,26 +10,31 @@ namespace Danmaku2D { /// A ProjectileController or ProjectileGroupController for creating bullets that move along a straight path. /// [System.Serializable] - public class AccelerationController : IProjectileController { + public class AccelerationController : IDanmakuController { [SerializeField] - private float acceleration = 0; + private DynamicFloat acceleration; [SerializeField] - private float capSpeed; + private DynamicFloat capSpeed; + + public AccelerationController() { + this.acceleration = (DynamicFloat)0f; + this.capSpeed = (DynamicFloat)0f; + } /// /// Initializes a new instance of the class. /// /// The velocity of the controlled Projectile(s) in absolute world coordinates per second - public AccelerationController (float acceleration, float capSpeed) : base() { + public AccelerationController (DynamicFloat acceleration, DynamicFloat capSpeed) : base() { this.acceleration = acceleration; this.capSpeed = capSpeed; } #region IProjectileController implementation - public virtual void UpdateProjectile (Projectile projectile, float dt) { + public virtual void UpdateProjectile (Danmaku projectile, float dt) { if (acceleration != 0) { float velocity = projectile.Velocity; velocity += acceleration * projectile.Time; @@ -59,5 +49,13 @@ public virtual void UpdateProjectile (Projectile projectile, float dt) { #endregion } + + namespace Wrapper { + + public class AccelerationProjectileController : ControllerWrapperBehavior { + } + + } + } diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AccelerationProjectileController.cs.meta b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AccelerationProjectileController.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AccelerationProjectileController.cs.meta rename to Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AccelerationProjectileController.cs.meta index db369a73..693b8df7 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AccelerationProjectileController.cs.meta +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AccelerationProjectileController.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 9905f94ec16afff4fb94b6855ffa34fa -timeCreated: 1427578703 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 9905f94ec16afff4fb94b6855ffa34fa +timeCreated: 1427578703 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AnimationCurveControl.cs b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AnimationCurveControl.cs new file mode 100644 index 00000000..a23b3494 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AnimationCurveControl.cs @@ -0,0 +1,26 @@ +using UnityEngine; +using Danmaku2D.ProjectileControllers; + +namespace Danmaku2D { + + [System.Serializable] + public class AnimationCurveController : IDanmakuController { + + [SerializeField] + private AnimationCurve velocityCurve; + + #region IProjectileController implementation + public virtual void UpdateProjectile (Danmaku projectile, float dt) { + float velocity = velocityCurve.Evaluate (projectile.Time); + if (velocity != 0) + projectile.Position += projectile.Direction * velocity * dt; + } + #endregion + } + + namespace Wrapper { + internal class AnimationCurveController : ControllerWrapperBehavior { + } + } +} + diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AnimationCurveControl.cs.meta b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AnimationCurveControl.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AnimationCurveControl.cs.meta rename to Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AnimationCurveControl.cs.meta index c1ec6d3a..1f197ae3 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AnimationCurveControl.cs.meta +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AnimationCurveControl.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: d31413dbaa70dd04ca4e163346cbccd5 -timeCreated: 1426617258 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: d31413dbaa70dd04ca4e163346cbccd5 +timeCreated: 1426617258 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AutoDeactivateController.cs b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AutoDeactivateController.cs similarity index 61% rename from Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AutoDeactivateController.cs rename to Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AutoDeactivateController.cs index fe7f9339..649fd596 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AutoDeactivateController.cs +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AutoDeactivateController.cs @@ -1,22 +1,22 @@ -using UnityEngine; -using System.Collections; - -namespace Danmaku2D { - - [System.Serializable] - public class AutoDeactivateController : IProjectileController { - - public bool useTime; - public int frames; - - #region IProjectileController implementation - public void UpdateProjectile (Projectile projectile, float dt) { - if (projectile.frames > frames) { - projectile.Deactivate(); - } - } - #endregion - - } - +using UnityEngine; +using System.Collections; + +namespace Danmaku2D { + + [System.Serializable] + public class AutoDeactivateController : IDanmakuController { + + public bool useTime; + public int frames; + + #region IProjectileController implementation + public void UpdateProjectile (Danmaku projectile, float dt) { + if (projectile.frames > frames) { + projectile.Deactivate(); + } + } + #endregion + + } + } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AutoDeactivateController.cs.meta b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AutoDeactivateController.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AutoDeactivateController.cs.meta rename to Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AutoDeactivateController.cs.meta index 90903d8f..8e470f4e 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AutoDeactivateController.cs.meta +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/AutoDeactivateController.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 28a40b98003b19042b403ec550874254 -timeCreated: 1427599385 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 28a40b98003b19042b403ec550874254 +timeCreated: 1427599385 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ColorFadeProjectile.cs b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ColorFadeProjectile.cs similarity index 90% rename from Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ColorFadeProjectile.cs rename to Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ColorFadeProjectile.cs index b458efcc..85a61043 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ColorFadeProjectile.cs +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ColorFadeProjectile.cs @@ -14,7 +14,7 @@ public class ColorFadeProjectile : ProjectileControlBehavior { [SerializeField] private float endTime; - public override void UpdateProjectile (Projectile projectile, float dt) { + public override void UpdateProjectile (Danmaku projectile, float dt) { float bulletTime = projectile.Time; Color startColor = projectile.Prefab.cachedColor; // Debug.Log (bulletTime); diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ColorFadeProjectile.cs.meta b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ColorFadeProjectile.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ColorFadeProjectile.cs.meta rename to Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ColorFadeProjectile.cs.meta index 970ebf2c..2f841996 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ColorFadeProjectile.cs.meta +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ColorFadeProjectile.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 42d779184468eae4ab3fcf4057a6786a -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: 42d779184468eae4ab3fcf4057a6786a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ControllerWrapperBehavior.cs b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ControllerWrapperBehavior.cs similarity index 56% rename from Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ControllerWrapperBehavior.cs rename to Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ControllerWrapperBehavior.cs index 0ea3dff6..9ac4fa05 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ControllerWrapperBehavior.cs +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ControllerWrapperBehavior.cs @@ -1,17 +1,18 @@ -using UnityEngine; +using UnityEngine; using System.Collections; /// /// A development kit for quick development of 2D Danmaku games /// -namespace Danmaku2D.ProjectileControllers { +namespace Danmaku2D { /// /// An abstract generic superclass to mirror the functionality of any implementor of IPorjectileGroupController in a ProjectileControlBehavior. /// It can be used with other ProjectileControlBehavior implementations; however it is best used with IProjectileGroupController implementations that don't derive from ProjectileControlBehavior. /// - public abstract class ControllerWrapperBehavior : ProjectileControlBehavior where T : IProjectileController { + public abstract class ControllerWrapperBehavior : ProjectileControlBehavior where T : IDanmakuController, new() { + [SerializeField] private T projectileController; /// @@ -25,25 +26,13 @@ public T Controller { } public override void Awake () { - ProjectileGroup = new ProjectileGroup (); if (projectileController == null) { - projectileController = CreateController (); - if (projectileController == null) { - throw new System.NotImplementedException(GetType().ToString() + " does not implement CreateController() properly"); - } - ProjectileGroup.AddController(projectileController); + projectileController = new T(); } } - /// - /// Creates the underlying controller. - /// This function is only called if the serialized controller is null or if the type of the controller is not serialziable. - /// - /// The underlying controller. - protected abstract T CreateController (); - #region implemented abstract members of ProjectileControlBehavior - public sealed override void UpdateProjectile (Projectile projectile, float dt) { + public sealed override void UpdateProjectile (Danmaku projectile, float dt) { projectileController.UpdateProjectile(projectile, dt); } #endregion diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ControllerWrapperBehavior.cs.meta b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ControllerWrapperBehavior.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ControllerWrapperBehavior.cs.meta rename to Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ControllerWrapperBehavior.cs.meta index e85624d5..6d592008 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ControllerWrapperBehavior.cs.meta +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ControllerWrapperBehavior.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 80237dc767189234d910255f72b2bff1 -timeCreated: 1426358268 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 80237dc767189234d910255f72b2bff1 +timeCreated: 1426358268 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/IProjectileController.cs b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/DanmakuController.cs similarity index 81% rename from Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/IProjectileController.cs rename to Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/DanmakuController.cs index 1d2fad2e..26aa87bc 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/IProjectileController.cs +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/DanmakuController.cs @@ -1,25 +1,25 @@ -using UnityEngine; - -/// -/// A development kit for quick development of 2D Danmaku games -/// -namespace Danmaku2D { - - public delegate void ProjectileController(Projectile proj, float dt); - - /// - /// An interface for defining any controller of single Projectile. - /// If looking to reuse behavior among large numbers of projectiles, use a ProjectileGroup and IProjectileGroupController instead. - /// Generally speaking it's best not to directly implement this interface manually, use only when sublcassing ProjectileController or ProjectileControlBehavior does not work. - /// - public interface IProjectileController { - - /// - /// Updates the Projectile controlled by the controller instance. - /// - /// the displacement from the Projectile's original position after udpating - /// the change in time since the last update - void UpdateProjectile (Projectile projectile, float dt); - - } +using UnityEngine; + +/// +/// A development kit for quick development of 2D Danmaku games +/// +namespace Danmaku2D { + + public delegate void DanmakuController(Danmaku proj, float dt); + + /// + /// An interface for defining any controller of single Projectile. + /// If looking to reuse behavior among large numbers of projectiles, use a ProjectileGroup and IProjectileGroupController instead. + /// Generally speaking it's best not to directly implement this interface manually, use only when sublcassing ProjectileController or ProjectileControlBehavior does not work. + /// + public interface IDanmakuController { + + /// + /// Updates the Projectile controlled by the controller instance. + /// + /// the displacement from the Projectile's original position after udpating + /// the change in time since the last update + void UpdateProjectile (Danmaku projectile, float dt); + + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Core/IProjectileCollider.cs.meta b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/DanmakuController.cs.meta similarity index 72% rename from Assets/Plugins/DanmakuUnity2D/Core/IProjectileCollider.cs.meta rename to Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/DanmakuController.cs.meta index 58262eb2..2db90f83 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/IProjectileCollider.cs.meta +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/DanmakuController.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: c53f3e3bb20fc124989fe4650906c84c -timeCreated: 1426536816 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 803a33d8cc50d354086a8a52b61bef60 +timeCreated: 1427677338 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/DelayedAngleChange.cs b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/DelayedAngleChange.cs similarity index 71% rename from Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/DelayedAngleChange.cs rename to Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/DelayedAngleChange.cs index 5463d941..89eb8265 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/DelayedAngleChange.cs +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/DelayedAngleChange.cs @@ -1,5 +1,5 @@ -using UnityEngine; -using System.Collections; +using UnityEngine; +using UnityUtilLib; namespace Danmaku2D.ProjectileControllers { @@ -14,17 +14,14 @@ private enum RotationMode { Absolute, Relative, Player } private float delay; [SerializeField] - private float angle; - - [SerializeField] - private float range; + private DynamicFloat angle; #region implemented abstract members of ProjectileControlBehavior - public override void UpdateProjectile (Projectile projectile, float dt) { + public override void UpdateProjectile (Danmaku projectile, float dt) { float time = projectile.Time; if(time >= delay && time - dt <= delay) { - float baseAngle = angle; + float baseAngle = angle.Value; switch(rotationMode) { case RotationMode.Relative: baseAngle += projectile.Rotation; @@ -35,7 +32,7 @@ public override void UpdateProjectile (Projectile projectile, float dt) { case RotationMode.Absolute: break; } - projectile.Rotation = Random.Range(baseAngle - range, baseAngle + range); + projectile.Rotation = baseAngle; } } diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/DelayedAngleChange.cs.meta b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/DelayedAngleChange.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/DelayedAngleChange.cs.meta rename to Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/DelayedAngleChange.cs.meta index 90a6c3ed..a36b4384 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/DelayedAngleChange.cs.meta +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/DelayedAngleChange.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 6bd141673927f3f4cabd045212ab2bda -timeCreated: 1426269678 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 6bd141673927f3f4cabd045212ab2bda +timeCreated: 1426269678 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/FireDanmakuController.cs b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/FireDanmakuController.cs new file mode 100644 index 00000000..e1e0d887 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/FireDanmakuController.cs @@ -0,0 +1,28 @@ +using UnityEngine; +using System.Collections; + +namespace Danmaku2D { + + [System.Serializable] + public class FireDanmakuController : IDanmakuController { + + [SerializeField] + private float delay; + + [SerializeField] + private bool repeat; + + [SerializeField] + private bool deactivateAfterwards; + + [SerializeField] + private DanmakuEmitter emitter; + + #region IDanmakuController implementation + public void UpdateProjectile (Danmaku projectile, float dt) { + } + #endregion + + } + +} diff --git a/Assets/Plugins/DanmakuUnity2D/Core/ProjectilePool.cs.meta b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/FireDanmakuController.cs.meta similarity index 76% rename from Assets/Plugins/DanmakuUnity2D/Core/ProjectilePool.cs.meta rename to Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/FireDanmakuController.cs.meta index 5bae5681..fd0280f8 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/ProjectilePool.cs.meta +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/FireDanmakuController.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 3e19591c524de2d4c9d180d87b10b36d -timeCreated: 1427434407 +guid: 5b97b97a3f57df34cb93413178936309 +timeCreated: 1427685776 licenseType: Free MonoImporter: serializedVersion: 2 diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ProjectileControlBehavior.cs b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ProjectileControlBehavior.cs similarity index 59% rename from Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ProjectileControlBehavior.cs rename to Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ProjectileControlBehavior.cs index 279de442..02a41fbf 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ProjectileControlBehavior.cs +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ProjectileControlBehavior.cs @@ -1,25 +1,25 @@ -using System; -using UnityEngine; - -namespace Danmaku2D { - - public abstract class ProjectileControlBehavior : MonoBehaviour, IProjectileController { - - public ProjectileGroup ProjectileGroup { - get; - set; - } - - public virtual void Awake() { - ProjectileGroup = new ProjectileGroup (); - ProjectileGroup.AddController(this); - } - - #region IProjectileController implementation - - public abstract void UpdateProjectile (Projectile projectile, float dt); - - #endregion - } -} - +using System; +using UnityEngine; + +namespace Danmaku2D { + + public abstract class ProjectileControlBehavior : MonoBehaviour, IDanmakuController { + + public DanmakuGroup ProjectileGroup { + get; + set; + } + + public virtual void Awake() { + ProjectileGroup = new DanmakuGroup (); + ProjectileGroup.AddController(this); + } + + #region IProjectileController implementation + + public abstract void UpdateProjectile (Danmaku projectile, float dt); + + #endregion + } +} + diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ProjectileControlBehavior.cs.meta b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ProjectileControlBehavior.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ProjectileControlBehavior.cs.meta rename to Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ProjectileControlBehavior.cs.meta index 1e9b53f4..988bd286 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/ProjectileControlBehavior.cs.meta +++ b/Assets/External/DanmakuUnity2D/Controllers/Danmaku Controllers/ProjectileControlBehavior.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 68906d1b3b21e7546ae7298d931906be -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: 68906d1b3b21e7546ae7298d931906be +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/External/DanmakuUnity2D/Controllers/Player Controllers.meta b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers.meta new file mode 100644 index 00000000..ff25c945 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: bda61390ee137fd4a9ce7ebe019a441d +folderAsset: yes +timeCreated: 1427734773 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/ControlledAgent.cs b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/ControlledAgent.cs similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/ControlledAgent.cs rename to Assets/External/DanmakuUnity2D/Controllers/Player Controllers/ControlledAgent.cs index e5d5b58a..8f440196 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/ControlledAgent.cs +++ b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/ControlledAgent.cs @@ -1,11 +1,11 @@ -using UnityEngine; -using System.Collections; - -namespace Danmaku2D { - public class ControlledAgent : PlayerAgent { - - public override void Update () { - throw new System.NotImplementedException (); - } - } +using UnityEngine; +using System.Collections; + +namespace Danmaku2D { + public class ControlledAgent : PlayerAgent { + + public override void Update () { + throw new System.NotImplementedException (); + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/ControlledAgent.cs.meta b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/ControlledAgent.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/ControlledAgent.cs.meta rename to Assets/External/DanmakuUnity2D/Controllers/Player Controllers/ControlledAgent.cs.meta index 7d55a7d8..05cd3b27 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/ControlledAgent.cs.meta +++ b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/ControlledAgent.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 2d046f530d49a2548a97388fd5b626c5 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: 2d046f530d49a2548a97388fd5b626c5 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/DanmakuPlayer.cs b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/DanmakuPlayer.cs similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/DanmakuPlayer.cs rename to Assets/External/DanmakuUnity2D/Controllers/Player Controllers/DanmakuPlayer.cs index a5af5dd4..a2b5981c 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/DanmakuPlayer.cs +++ b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/DanmakuPlayer.cs @@ -26,6 +26,7 @@ public PlayerAgent Agent { public override void Awake () { base.Awake (); Field = Util.FindClosest (transform.position); + Field.player = this; } public override void NormalUpdate () { @@ -97,7 +98,7 @@ public void ForbidMovement(Vector2 direction) { public abstract void Fire (); - public virtual void Hit(Projectile proj) { + public virtual void Hit(Danmaku proj) { livesRemaining--; } @@ -105,7 +106,7 @@ public void Reset(int maxLives) { livesRemaining = maxLives; } - public virtual void Graze (Projectile proj) { + public virtual void Graze (Danmaku proj) { } public void FireCheck(float dt) { diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/DanmakuPlayer.cs.meta b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/DanmakuPlayer.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/DanmakuPlayer.cs.meta rename to Assets/External/DanmakuUnity2D/Controllers/Player Controllers/DanmakuPlayer.cs.meta index e9b44b94..63e58d4c 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/DanmakuPlayer.cs.meta +++ b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/DanmakuPlayer.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 7412257a126f3a740a85e462d22323dc -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: 7412257a126f3a740a85e462d22323dc +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/Player Hitboxes.meta b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/Player Hitboxes.meta similarity index 67% rename from Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/Player Hitboxes.meta rename to Assets/External/DanmakuUnity2D/Controllers/Player Controllers/Player Hitboxes.meta index b0d76f85..f983c7f1 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/Player Hitboxes.meta +++ b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/Player Hitboxes.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: b8e03f49b83b0434bbb40f7092686870 +guid: 7cc873730d6d8264892c782729ff16b4 folderAsset: yes -timeCreated: 1427611179 +timeCreated: 1427734773 licenseType: Free DefaultImporter: userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/Player Hitboxes/PlayerDeathHitbox.cs b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/Player Hitboxes/PlayerDeathHitbox.cs similarity index 74% rename from Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/Player Hitboxes/PlayerDeathHitbox.cs rename to Assets/External/DanmakuUnity2D/Controllers/Player Controllers/Player Hitboxes/PlayerDeathHitbox.cs index a52cca62..92e3ae6b 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/Player Hitboxes/PlayerDeathHitbox.cs +++ b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/Player Hitboxes/PlayerDeathHitbox.cs @@ -1,24 +1,24 @@ -using UnityEngine; -using UnityUtilLib; -using System.Collections; - -namespace Danmaku2D { - public class PlayerDeathHitbox : MonoBehaviour, IProjectileCollider { - - private DanmakuPlayer player; - - void Start() { - player = GetComponentInParent (); - if (player == null) { - Debug.LogError("PlayerDeathHitbox should be on a child object of a GameObject with an Avatar sublcass script"); - } - } - - public void OnProjectileCollision(Projectile proj) { - if (player != null) { - player.Hit (proj); - proj.Deactivate(); - } - } - } +using UnityEngine; +using UnityUtilLib; +using System.Collections; + +namespace Danmaku2D { + public class PlayerDeathHitbox : MonoBehaviour, IDanmakuCollider { + + private DanmakuPlayer player; + + void Start() { + player = GetComponentInParent (); + if (player == null) { + Debug.LogError("PlayerDeathHitbox should be on a child object of a GameObject with an Avatar sublcass script"); + } + } + + public void OnProjectileCollision(Danmaku proj) { + if (player != null) { + player.Hit (proj); + proj.Deactivate(); + } + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/Player Hitboxes/PlayerDeathHitbox.cs.meta b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/Player Hitboxes/PlayerDeathHitbox.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/Player Hitboxes/PlayerDeathHitbox.cs.meta rename to Assets/External/DanmakuUnity2D/Controllers/Player Controllers/Player Hitboxes/PlayerDeathHitbox.cs.meta index e5dfbb76..fb323803 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/Player Hitboxes/PlayerDeathHitbox.cs.meta +++ b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/Player Hitboxes/PlayerDeathHitbox.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 4fb4b20b90d935146b4622eac1468c43 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: 4fb4b20b90d935146b4622eac1468c43 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/Player Hitboxes/PlayerGrazeHitbox.cs b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/Player Hitboxes/PlayerGrazeHitbox.cs similarity index 83% rename from Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/Player Hitboxes/PlayerGrazeHitbox.cs rename to Assets/External/DanmakuUnity2D/Controllers/Player Controllers/Player Hitboxes/PlayerGrazeHitbox.cs index 92eb5b08..cf5980ff 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/Player Hitboxes/PlayerGrazeHitbox.cs +++ b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/Player Hitboxes/PlayerGrazeHitbox.cs @@ -1,40 +1,40 @@ -using UnityEngine; -using UnityUtilLib; -using System.Collections; - -namespace Danmaku2D { - public class PlayerGrazeHitbox : MonoBehaviour, IProjectileCollider{ - - private DanmakuPlayer player; - - void Start() { - player = GetComponentInParent (); - if (player == null) { - Debug.LogError("PlayerGrazeHitbox should be on a child object of a GameObject with an Avatar sublcass script"); - } - } - - #region IProjectileCollider implementation - public void OnProjectileCollision (Projectile proj) { - //throw new System.NotImplementedException (); - } - #endregion - - //TODO: FIX - - void OnTriggerExit2D(Collider2D other) { - // if (player != null) { - // Projectile proj = other.GetComponent(); - // if(proj != null) { - // player.Graze(proj); - // } - // } - } - - // void OnBulletCollision(ProjectileData other) { - // if (player != null) { - // player.Graze(); - // } - // } - } +using UnityEngine; +using UnityUtilLib; +using System.Collections; + +namespace Danmaku2D { + public class PlayerGrazeHitbox : MonoBehaviour, IDanmakuCollider{ + + private DanmakuPlayer player; + + void Start() { + player = GetComponentInParent (); + if (player == null) { + Debug.LogError("PlayerGrazeHitbox should be on a child object of a GameObject with an Avatar sublcass script"); + } + } + + #region IProjectileCollider implementation + public void OnProjectileCollision (Danmaku proj) { + //throw new System.NotImplementedException (); + } + #endregion + + //TODO: FIX + + void OnTriggerExit2D(Collider2D other) { + // if (player != null) { + // Projectile proj = other.GetComponent(); + // if(proj != null) { + // player.Graze(proj); + // } + // } + } + + // void OnBulletCollision(ProjectileData other) { + // if (player != null) { + // player.Graze(); + // } + // } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/Player Hitboxes/PlayerGrazeHitbox.cs.meta b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/Player Hitboxes/PlayerGrazeHitbox.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/Player Hitboxes/PlayerGrazeHitbox.cs.meta rename to Assets/External/DanmakuUnity2D/Controllers/Player Controllers/Player Hitboxes/PlayerGrazeHitbox.cs.meta index 1f54b2fb..848e6702 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/Player Hitboxes/PlayerGrazeHitbox.cs.meta +++ b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/Player Hitboxes/PlayerGrazeHitbox.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 80cf408cccaf01e4cadc4be03b2543d6 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: 80cf408cccaf01e4cadc4be03b2543d6 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/PlayerAgent.cs b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/PlayerAgent.cs similarity index 94% rename from Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/PlayerAgent.cs rename to Assets/External/DanmakuUnity2D/Controllers/Player Controllers/PlayerAgent.cs index fae25178..6e5f6698 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/PlayerAgent.cs +++ b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/PlayerAgent.cs @@ -1,37 +1,37 @@ -using UnityEngine; -using System; -using System.Collections; - -namespace Danmaku2D { - [Serializable] - public abstract class PlayerAgent { - - private DanmakuPlayer player; - public DanmakuPlayer Player { - get { - return player; - } - set { - player = value; - field = player.Field; - } - } - - private DanmakuField field; - public DanmakuField Field { - get { - return field; - } - set { - field = value; - player = field.Player; - } - } - - /// - /// Update the specified dt. - /// - /// Dt. - public abstract void Update(); - } +using UnityEngine; +using System; +using System.Collections; + +namespace Danmaku2D { + [Serializable] + public abstract class PlayerAgent { + + private DanmakuPlayer player; + public DanmakuPlayer Player { + get { + return player; + } + set { + player = value; + field = player.Field; + } + } + + private DanmakuField field; + public DanmakuField Field { + get { + return field; + } + set { + field = value; + player = field.Player; + } + } + + /// + /// Update the specified dt. + /// + /// Dt. + public abstract void Update(); + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/PlayerAgent.cs.meta b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/PlayerAgent.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/PlayerAgent.cs.meta rename to Assets/External/DanmakuUnity2D/Controllers/Player Controllers/PlayerAgent.cs.meta index 243fd200..cb0d14a5 100644 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers/PlayerAgent.cs.meta +++ b/Assets/External/DanmakuUnity2D/Controllers/Player Controllers/PlayerAgent.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: da6ae7628fe42da469868d781e8e1ece -timeCreated: 1425903019 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: da6ae7628fe42da469868d781e8e1ece +timeCreated: 1425903019 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Core.meta b/Assets/External/DanmakuUnity2D/Core.meta similarity index 67% rename from Assets/Plugins/DanmakuUnity2D/Core.meta rename to Assets/External/DanmakuUnity2D/Core.meta index c4db2204..d9232354 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core.meta +++ b/Assets/External/DanmakuUnity2D/Core.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: ad54ef5f6134f724a82991258f39074a +guid: 5734496efaca2e54ba2cbe1479115005 folderAsset: yes -timeCreated: 1427611179 +timeCreated: 1427734773 licenseType: Free DefaultImporter: userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Core/AttackPattern.cs b/Assets/External/DanmakuUnity2D/Core/AttackPattern.cs similarity index 83% rename from Assets/Plugins/DanmakuUnity2D/Core/AttackPattern.cs rename to Assets/External/DanmakuUnity2D/Core/AttackPattern.cs index 9c8da7d0..5fdc98ac 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/AttackPattern.cs +++ b/Assets/External/DanmakuUnity2D/Core/AttackPattern.cs @@ -94,37 +94,37 @@ private IEnumerator Execute() { Active = false; } - protected Projectile SpawnProjectile(ProjectilePrefab projectileType, + protected Danmaku SpawnProjectile(DanmakuPrefab projectileType, Vector2 location, - float rotation, + DynamicFloat rotation, DanmakuField.CoordinateSystem coordSys = DanmakuField.CoordinateSystem.View) { return TargetField.SpawnProjectile (projectileType, location, rotation, coordSys); } - protected Projectile FireLinear(ProjectilePrefab projectileType, + protected Danmaku FireLinear(DanmakuPrefab projectileType, Vector2 location, - float rotation, - float velocity, + DynamicFloat rotation, + DynamicFloat velocity, DanmakuField.CoordinateSystem coordSys = DanmakuField.CoordinateSystem.View, - ProjectileController controller = null, + DanmakuController controller = null, FireModifier modifier = null, - ProjectileGroup group = null) { + DanmakuGroup group = null) { return TargetField.FireLinear (projectileType, location, rotation, velocity, coordSys, controller, modifier, group); } - protected Projectile FireCurved(ProjectilePrefab projectileType, + protected Danmaku FireCurved(DanmakuPrefab projectileType, Vector2 location, - float rotation, - float velocity, - float angularVelocity, + DynamicFloat rotation, + DynamicFloat velocity, + DynamicFloat angularVelocity, DanmakuField.CoordinateSystem coordSys = DanmakuField.CoordinateSystem.View, - ProjectileController controller = null, + DanmakuController controller = null, FireModifier modifier = null, - ProjectileGroup group = null) { + DanmakuGroup group = null) { return TargetField.FireCurved (projectileType, location, rotation, velocity, angularVelocity, coordSys, controller, modifier, group); } - protected Projectile Fire(FireBuilder data) { + protected Danmaku Fire(FireBuilder data) { return TargetField.Fire (data); } } diff --git a/Assets/Plugins/DanmakuUnity2D/Core/AttackPattern.cs.meta b/Assets/External/DanmakuUnity2D/Core/AttackPattern.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Core/AttackPattern.cs.meta rename to Assets/External/DanmakuUnity2D/Core/AttackPattern.cs.meta index 291c004f..15d146bf 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/AttackPattern.cs.meta +++ b/Assets/External/DanmakuUnity2D/Core/AttackPattern.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 66e44749d6b9e45409e1c0093b69201d -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: 66e44749d6b9e45409e1c0093b69201d +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Core/Projectile.cs b/Assets/External/DanmakuUnity2D/Core/Danmaku.cs similarity index 92% rename from Assets/Plugins/DanmakuUnity2D/Core/Projectile.cs rename to Assets/External/DanmakuUnity2D/Core/Danmaku.cs index 29da04fb..7b6f1861 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/Projectile.cs +++ b/Assets/External/DanmakuUnity2D/Core/Danmaku.cs @@ -13,7 +13,7 @@ namespace Danmaku2D { /// A single projectile fired. /// The base object that represents a single bullet in a Danmaku game /// - public sealed partial class Projectile : IPooledObject, IColorable, IPrefabed { + public sealed partial class Danmaku : IPooledObject, IColorable, IPrefabed { internal int index; @@ -33,22 +33,21 @@ public sealed partial class Projectile : IPooledObject, IColorable, IPrefabed groups; + private DanmakuController controllerUpdate; + internal List groups; private DanmakuField field; private Bounds2D bounds; @@ -56,7 +55,7 @@ public sealed partial class Projectile : IPooledObject, IColorable, IPrefabed /// Initializes a new instance of the class. /// - internal Projectile() { - groups = new List (); + internal Danmaku() { + groups = new List (); gameObject = new GameObject (); transform = gameObject.transform; renderer = gameObject.AddComponent (); @@ -290,7 +300,7 @@ internal Projectile() { #endif raycastHits = new RaycastHit2D[5]; colliders = new Collider2D[5]; - scripts = new IProjectileCollider[5]; + scripts = new IDanmakuCollider[5]; } internal void Update() { @@ -377,7 +387,7 @@ internal void Update() { /// - any on the ProjectilePrefab will be included as additional that will affect the behavior of this bullet /// /// the ProjectilePrefab to match. - public void MatchPrefab(ProjectilePrefab prefab) { + public void MatchPrefab(DanmakuPrefab prefab) { if (this.prefab != prefab) { this.prefab = prefab; this.runtime = prefab.GetRuntime(); @@ -451,7 +461,7 @@ public void Deactivate() { /// Adds this projectile to the given ProjectileGroup /// /// the group this Projectile is to be added to - public void AddToGroup(ProjectileGroup group) { + public void AddToGroup(DanmakuGroup group) { groups.Add (group); group.group.Add (this); groupCountCache++; @@ -462,7 +472,7 @@ public void AddToGroup(ProjectileGroup group) { /// Removes this projectile from the given ProjectileGroup /// /// the group this Projectile is to be removed from - public void RemoveFromGroup(ProjectileGroup group) { + public void RemoveFromGroup(DanmakuGroup group) { groups.Remove (group); group.group.Remove (this); groupCountCache--; diff --git a/Assets/Plugins/DanmakuUnity2D/Modifiers/ModifierWrapper.cs.meta b/Assets/External/DanmakuUnity2D/Core/Danmaku.cs.meta similarity index 72% rename from Assets/Plugins/DanmakuUnity2D/Modifiers/ModifierWrapper.cs.meta rename to Assets/External/DanmakuUnity2D/Core/Danmaku.cs.meta index 7f7e2638..03f70b3f 100644 --- a/Assets/Plugins/DanmakuUnity2D/Modifiers/ModifierWrapper.cs.meta +++ b/Assets/External/DanmakuUnity2D/Core/Danmaku.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 9e5d2bebefb44bf4390a5e45345ea6bc -timeCreated: 1427591410 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 9fbea7c430d3f7746b244798a0d4dd39 +timeCreated: 1427667737 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Core/DanmakuField.cs b/Assets/External/DanmakuUnity2D/Core/DanmakuField.cs similarity index 89% rename from Assets/Plugins/DanmakuUnity2D/Core/DanmakuField.cs rename to Assets/External/DanmakuUnity2D/Core/DanmakuField.cs index 28048e2a..d8f7167d 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/DanmakuField.cs +++ b/Assets/External/DanmakuUnity2D/Core/DanmakuField.cs @@ -55,7 +55,7 @@ public enum CoordinateSystem { View, Relative, World } [System.NonSerialized] public DanmakuField TargetField; - private DanmakuPlayer player; + internal DanmakuPlayer player; private float currentAspectRatio; private float screenOffset; internal Bounds2D bounds; @@ -394,23 +394,23 @@ public T SpawnObject(T prefab, Vector2 location, CoordinateSystem coordSys = /// The location within the field to spawn the projectile. /// Rotation. /// If set to true, location is in absolute world coordinates relative to the bottom right corner of the game plane. - public Projectile SpawnProjectile(ProjectilePrefab bulletType, Vector2 location, float rotation, CoordinateSystem coordSys = CoordinateSystem.View) { - Projectile bullet = Projectile.Get (bulletType, WorldPoint(location, coordSys), rotation, this); + public Danmaku SpawnProjectile(DanmakuPrefab bulletType, Vector2 location, DynamicFloat rotation, CoordinateSystem coordSys = CoordinateSystem.View) { + Danmaku bullet = Danmaku.Get (bulletType, WorldPoint(location, coordSys), rotation, this); bullet.Activate (); return bullet; } - public Projectile FireLinear(ProjectilePrefab bulletType, + public Danmaku FireLinear(DanmakuPrefab bulletType, Vector2 location, - float rotation, - float velocity, + DynamicFloat rotation, + DynamicFloat velocity, CoordinateSystem coordSys = CoordinateSystem.View, - ProjectileController controller = null, + DanmakuController controller = null, FireModifier modifier = null, - ProjectileGroup group = null) { + DanmakuGroup group = null) { Vector2 position = WorldPoint (location, coordSys); if (modifier == null) { - Projectile projectile = Projectile.Get (bulletType, position, rotation, this); + Danmaku projectile = Danmaku.Get (bulletType, position, rotation, this); projectile.Activate (); projectile.Velocity = velocity; if (group != null) { @@ -424,18 +424,18 @@ public Projectile FireLinear(ProjectilePrefab bulletType, } } - public Projectile FireCurved(ProjectilePrefab bulletType, + public Danmaku FireCurved(DanmakuPrefab bulletType, Vector2 location, - float rotation, - float velocity, - float angularVelocity, + DynamicFloat rotation, + DynamicFloat velocity, + DynamicFloat angularVelocity, CoordinateSystem coordSys = CoordinateSystem.View, - ProjectileController controller = null, + DanmakuController controller = null, FireModifier modifier = null, - ProjectileGroup group = null) { + DanmakuGroup group = null) { Vector2 position = WorldPoint (location, coordSys); if (modifier == null) { - Projectile projectile = Projectile.Get (bulletType, position, rotation, this); + Danmaku projectile = Danmaku.Get (bulletType, position, rotation, this); projectile.Activate (); projectile.Velocity = velocity; projectile.AngularVelocity = angularVelocity; @@ -451,10 +451,10 @@ public Projectile FireCurved(ProjectilePrefab bulletType, } } - public Projectile Fire(FireBuilder data) { + public Danmaku Fire(FireBuilder data) { FireModifier modifier = data.Modifier; if (modifier == null) { - Projectile projectile = Projectile.Get (this, data); + Danmaku projectile = Danmaku.Get (this, data); projectile.Activate (); return projectile; } else { @@ -480,29 +480,19 @@ void OnDrawGizmos() { #endif } - public struct FireData where T : IProjectileController { - public Projectile Projectile; - public T Controller; - - public FireData(Projectile projectile, T controller) { - Projectile = projectile; - Controller = controller; - } - } - [System.Serializable] public class FireBuilder : IClonable { - public ProjectilePrefab Prefab = null; + public DanmakuPrefab Prefab = null; public Vector2 Position = Vector2.zero; - public float Rotation = 0; - public float Velocity; - public float AngularVelocity; - public ProjectileController Controller = null; + public DynamicFloat Rotation; + public DynamicFloat Velocity; + public DynamicFloat AngularVelocity; + public DanmakuController Controller = null; public DanmakuField.CoordinateSystem CoordinateSystem = DanmakuField.CoordinateSystem.View; - public ProjectileGroup Group; + public DanmakuGroup Group; public FireModifier Modifier; - public FireBuilder(ProjectilePrefab prefab) { + public FireBuilder(DanmakuPrefab prefab) { this.Prefab = prefab; } diff --git a/Assets/Plugins/DanmakuUnity2D/Core/DanmakuField.cs.meta b/Assets/External/DanmakuUnity2D/Core/DanmakuField.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Core/DanmakuField.cs.meta rename to Assets/External/DanmakuUnity2D/Core/DanmakuField.cs.meta index 1a344c36..52351dfd 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/DanmakuField.cs.meta +++ b/Assets/External/DanmakuUnity2D/Core/DanmakuField.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: d76c239fde6757549963073cca304778 -timeCreated: 1426642188 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: -29000 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: d76c239fde6757549963073cca304778 +timeCreated: 1426642188 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: -29000 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Core/DanmakuGameController.cs b/Assets/External/DanmakuUnity2D/Core/DanmakuGameController.cs similarity index 90% rename from Assets/Plugins/DanmakuUnity2D/Core/DanmakuGameController.cs rename to Assets/External/DanmakuUnity2D/Core/DanmakuGameController.cs index 78a55b49..24b53de9 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/DanmakuGameController.cs +++ b/Assets/External/DanmakuUnity2D/Core/DanmakuGameController.cs @@ -41,13 +41,13 @@ public static int MaximumLives { public override void Update() { base.Update (); if (!IsGamePaused) { - Projectile.UpdateAll(); + Danmaku.UpdateAll(); } } public override void Awake () { base.Awake (); - Projectile.Setup (projectileInitialCount, projectileSpawnOnEmpty, angleResolution); + Danmaku.Setup (projectileInitialCount, projectileSpawnOnEmpty, angleResolution); } } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Core/DanmakuGameController.cs.meta b/Assets/External/DanmakuUnity2D/Core/DanmakuGameController.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Core/DanmakuGameController.cs.meta rename to Assets/External/DanmakuUnity2D/Core/DanmakuGameController.cs.meta index 977ccf71..6098a460 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/DanmakuGameController.cs.meta +++ b/Assets/External/DanmakuUnity2D/Core/DanmakuGameController.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: b2f6d7ccc638e1a4a97849d2e36e5272 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: b2f6d7ccc638e1a4a97849d2e36e5272 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/External/DanmakuUnity2D/Core/DanmakuGroup.cs b/Assets/External/DanmakuUnity2D/Core/DanmakuGroup.cs new file mode 100644 index 00000000..6933b0f5 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/Core/DanmakuGroup.cs @@ -0,0 +1,229 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityUtilLib; + +namespace Danmaku2D { + + public sealed class DanmakuGroup : ICollection { + + internal HashSet group; + + internal DanmakuController groupControllers; + + public DanmakuGroup() { + group = new HashSet (); + } + + public int Damage { + set { + foreach(Danmaku danmaku in group) { + danmaku.Damage = value; + } + } + } + + public Sprite Sprite { + set { + foreach(Danmaku danmaku in group) { + danmaku.Sprite = value; + } + } + } + + public Color Color { + set { + foreach(Danmaku danmaku in group) { + danmaku.Color = value; + } + } + } + + public Vector2 Position { + set { + foreach(Danmaku danmaku in group) { + danmaku.Position = value; + } + } + } + + public Vector2 PositionImmediate { + set { + foreach(Danmaku danmaku in group) { + danmaku.PositionImmediate = value; + } + } + } + + public DynamicFloat Rotation { + set { + foreach(Danmaku danmaku in group) { + danmaku.Rotation = value.Value; + } + } + } + + public string Tag { + set { + foreach(Danmaku danmaku in group) { + danmaku.Tag = value; + } + } + } + + public int Layer { + set { + foreach(Danmaku danmaku in group) { + danmaku.Layer = value; + } + } + } + + public bool BoundsCheck { + set { + foreach(Danmaku danmaku in group) { + danmaku.BoundsCheck = value; + } + } + } + + public bool CollisionCheck { + set { + foreach(Danmaku danmaku in group) { + danmaku.CollisionCheck = value; + } + } + } + + public void Rotate(DynamicFloat delta) { + foreach(Danmaku danmaku in group) { + danmaku.Rotate(delta); + } + } + + public void MatchPrefab(DanmakuPrefab prefab) { + foreach (Danmaku danmaku in group) { + danmaku.MatchPrefab(prefab); + } + } + + public void AddToGroup(DanmakuGroup otherGroup) { + if(this == otherGroup) + return; + foreach(Danmaku danmaku in group) { + danmaku.AddToGroup(otherGroup); + } + } + + public void RemoveFromGroup(DanmakuGroup otherGroup) { + if (this == otherGroup) { + Clear(); + return; + } + foreach(Danmaku danmaku in group) { + danmaku.RemoveFromGroup(otherGroup); + } + } + + public void AddController(IDanmakuController controller) { + groupControllers -= controller.UpdateProjectile; + foreach(Danmaku proj in group) { + proj.AddController(controller.UpdateProjectile); + } + } + + public void RemoveController(IDanmakuController controller) { + groupControllers -= controller.UpdateProjectile; + foreach(Danmaku proj in group) { + proj.RemoveController(controller.UpdateProjectile); + } + } + + public void ClearControllers() { + foreach(Danmaku danmaku in group) { + danmaku.ClearControllers(); + } + } + + public void ClearGroupControllers() { + foreach(Danmaku danmaku in group) { + danmaku.RemoveController(groupControllers); + } + groupControllers = null; + } + + #region ICollection implementation + + public void Add (Danmaku item) { + bool added = group.Add(item); + if (added) { + item.groups.Add (this); + item.groupCountCache++; + item.groupCheck = item.groups.Count > 0; + item.AddController(groupControllers); + } + } + + public void Clear () { + foreach(Danmaku proj in group) { + proj.RemoveFromGroup(this); + } + } + + public bool Contains (Danmaku item) { + return group.Contains (item); + } + + public void CopyTo (Danmaku[] array, int arrayIndex) { + group.CopyTo (array, arrayIndex); + } + + public bool Remove (Danmaku item) { + bool success = false; + success = group.Remove(item); + if (success) { + item.groups.Remove (this); + item.groupCountCache--; + item.groupCheck = item.groups.Count > 0; + item.RemoveController(groupControllers); + } + return success; + } + + public int Count { + get { + return group.Count; + } + } + + public bool IsReadOnly { + get { + return false; + } + } + + #endregion + + #region IEnumerable implementation + + public IEnumerator GetEnumerator () { + return group.GetEnumerator (); + } + + #endregion + + #region IEnumerable implementation + + IEnumerator IEnumerable.GetEnumerator () { + return group.GetEnumerator (); + } + + #endregion + + + + + } +} + diff --git a/Assets/Plugins/DanmakuUnity2D/Core/ProjectileStatic.cs.meta b/Assets/External/DanmakuUnity2D/Core/DanmakuGroup.cs.meta similarity index 72% rename from Assets/Plugins/DanmakuUnity2D/Core/ProjectileStatic.cs.meta rename to Assets/External/DanmakuUnity2D/Core/DanmakuGroup.cs.meta index e571bc6b..5c57d17a 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/ProjectileStatic.cs.meta +++ b/Assets/External/DanmakuUnity2D/Core/DanmakuGroup.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 5557fc4e0dff4014ab5191ff8a91777f -timeCreated: 1427434407 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: e2236d083b8a1f8409e8b54da3855cc8 +timeCreated: 1427676691 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Core/DanmakuObject.cs b/Assets/External/DanmakuUnity2D/Core/DanmakuObject.cs similarity index 100% rename from Assets/Plugins/DanmakuUnity2D/Core/DanmakuObject.cs rename to Assets/External/DanmakuUnity2D/Core/DanmakuObject.cs diff --git a/Assets/Plugins/DanmakuUnity2D/Core/DanmakuObject.cs.meta b/Assets/External/DanmakuUnity2D/Core/DanmakuObject.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Core/DanmakuObject.cs.meta rename to Assets/External/DanmakuUnity2D/Core/DanmakuObject.cs.meta index f348e835..f6be90e0 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/DanmakuObject.cs.meta +++ b/Assets/External/DanmakuUnity2D/Core/DanmakuObject.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 3271e911ce2ba324bb457810d59196d4 -timeCreated: 1427233869 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 3271e911ce2ba324bb457810d59196d4 +timeCreated: 1427233869 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Core/ProjectilePool.cs b/Assets/External/DanmakuUnity2D/Core/DanmakuPool.cs similarity index 85% rename from Assets/Plugins/DanmakuUnity2D/Core/ProjectilePool.cs rename to Assets/External/DanmakuUnity2D/Core/DanmakuPool.cs index 745788fe..e3c3cc59 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/ProjectilePool.cs +++ b/Assets/External/DanmakuUnity2D/Core/DanmakuPool.cs @@ -12,12 +12,12 @@ namespace Danmaku2D { /// A single projectile fired. /// The base object that represents a single bullet in a Danmaku game /// - public sealed partial class Projectile : IPooledObject, IColorable, IPrefabed { + public sealed partial class Danmaku : IPooledObject, IColorable, IPrefabed { - internal class ProjectilePool : IPool { + internal class ProjectilePool : IPool { internal int[] queue; - internal Projectile[] all; + internal Danmaku[] all; private int currentIndex; private int endIndex; @@ -36,7 +36,7 @@ public ProjectilePool(int initial, int spawn) { protected void Spawn(int count) { if(all == null || queue == null) { - all = new Projectile[2]; + all = new Danmaku[2]; queue = new int[2]; } int endCount = totalCount + spawnCount; @@ -46,7 +46,7 @@ protected void Spawn(int count) { size = Mathf.NextPowerOfTwo(size + 1); } - Projectile[] temp = new Projectile[size]; + Danmaku[] temp = new Danmaku[size]; Array.Copy(all, temp, all.Length); all = temp; @@ -65,7 +65,7 @@ protected void Spawn(int count) { queue = tempQueue; } for(int i = totalCount; i < endCount; i++, endIndex++) { - all[i] = new Projectile(); + all[i] = new Danmaku(); all[i].index = i; all[i].Pool = this; queue[endIndex] = i; @@ -74,7 +74,7 @@ protected void Spawn(int count) { inactiveCount += spawnCount; } - public void Get(Projectile[] projectiles) { + public void Get(Danmaku[] projectiles) { if (projectiles == null) throw new ArgumentNullException ("Projectiles can't be null"); int count = projectiles.Length; @@ -87,7 +87,7 @@ public void Get(Projectile[] projectiles) { } } - public void Return(Projectile[] projectiles) { + public void Return(Danmaku[] projectiles) { if(projectiles == null) throw new ArgumentNullException ("Projectiles can't be null"); int count = projectiles.Length; @@ -100,7 +100,7 @@ public void Return(Projectile[] projectiles) { #region IPool implementation - public Projectile Get () { + public Danmaku Get () { if(inactiveCount <= 0) { Spawn (spawnCount); } @@ -110,7 +110,7 @@ public Projectile Get () { return all [index]; } - public void Return (Projectile obj) { + public void Return (Danmaku obj) { queue [endIndex] = obj.index; endIndex = (endIndex + 1) % size; inactiveCount++; @@ -125,7 +125,7 @@ object IPool.Get () { } public void Return (object obj) { - Return (obj as Projectile); + Return (obj as Danmaku); } #endregion diff --git a/Assets/External/DanmakuUnity2D/Core/DanmakuPool.cs.meta b/Assets/External/DanmakuUnity2D/Core/DanmakuPool.cs.meta new file mode 100644 index 00000000..476f2365 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/Core/DanmakuPool.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 088facdcd50503a46bf86798d91bd528 +timeCreated: 1427667737 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Core/ProjectilePrefab.cs b/Assets/External/DanmakuUnity2D/Core/DanmakuPrefab.cs similarity index 73% rename from Assets/Plugins/DanmakuUnity2D/Core/ProjectilePrefab.cs rename to Assets/External/DanmakuUnity2D/Core/DanmakuPrefab.cs index 41bde711..f932e168 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/ProjectilePrefab.cs +++ b/Assets/External/DanmakuUnity2D/Core/DanmakuPrefab.cs @@ -10,9 +10,9 @@ namespace Danmaku2D { /// [RequireComponent(typeof(CircleCollider2D))] [RequireComponent(typeof(SpriteRenderer))] - public sealed class ProjectilePrefab : DanmakuObjectPrefab { + public sealed class DanmakuPrefab : DanmakuObjectPrefab { - private ProjectilePrefab runtime; + private DanmakuPrefab runtime; private ProjectileControlBehavior[] extraControllers; internal ProjectileControlBehavior[] ExtraControllers { @@ -26,14 +26,14 @@ public override void Awake() { extraControllers = GetComponents(); } - internal ProjectilePrefab GetRuntime() { + internal DanmakuPrefab GetRuntime() { if(runtime == null) runtime = CreateRuntimeInstance(this); return runtime; } - private static ProjectilePrefab CreateRuntimeInstance(ProjectilePrefab prefab) { - ProjectilePrefab runtime = (ProjectilePrefab)Instantiate (prefab); + private static DanmakuPrefab CreateRuntimeInstance(DanmakuPrefab prefab) { + DanmakuPrefab runtime = (DanmakuPrefab)Instantiate (prefab); runtime.gameObject.hideFlags = HideFlags.HideInHierarchy; runtime.gameObject.SetActive (false); return runtime; diff --git a/Assets/Plugins/DanmakuUnity2D/Core/ProjectilePrefab.cs.meta b/Assets/External/DanmakuUnity2D/Core/DanmakuPrefab.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Core/ProjectilePrefab.cs.meta rename to Assets/External/DanmakuUnity2D/Core/DanmakuPrefab.cs.meta index 80f23aa8..e9a0bc58 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/ProjectilePrefab.cs.meta +++ b/Assets/External/DanmakuUnity2D/Core/DanmakuPrefab.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 0d455abbca205534bbe1c646accadd68 -timeCreated: 1426400523 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: -30000 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 0d455abbca205534bbe1c646accadd68 +timeCreated: 1426400523 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: -30000 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Core/ProjectileStatic.cs b/Assets/External/DanmakuUnity2D/Core/DanmakuStatic.cs similarity index 86% rename from Assets/Plugins/DanmakuUnity2D/Core/ProjectileStatic.cs rename to Assets/External/DanmakuUnity2D/Core/DanmakuStatic.cs index 0a828fa8..ec1c7ecc 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/ProjectileStatic.cs +++ b/Assets/External/DanmakuUnity2D/Core/DanmakuStatic.cs @@ -12,7 +12,7 @@ namespace Danmaku2D { /// A single projectile fired. /// The base object that represents a single bullet in a Danmaku game /// - public sealed partial class Projectile : IPooledObject, IColorable, IPrefabed { + public sealed partial class Danmaku : IPooledObject, IColorable, IPrefabed { private const float twoPI = Mathf.PI * 2; private static Vector2[] unitCircle; @@ -59,7 +59,7 @@ internal static float Tan(float angle) { internal static void UpdateAll() { dt = Util.TargetDeltaTime; - Projectile[] all = projectilePool.all; + Danmaku[] all = projectilePool.all; int totalCount = projectilePool.totalCount; for (int i = 0; i < totalCount; i++) { if(all[i].is_active) { @@ -69,7 +69,7 @@ internal static void UpdateAll() { } public static void DeactivateAll() { - Projectile[] all = projectilePool.all; + Danmaku[] all = projectilePool.all; int totalCount = projectilePool.totalCount; for (int i = 0; i < totalCount; i++) { if(all[i].is_active) @@ -89,8 +89,8 @@ public static int ActiveCount { } } - public static Projectile Get (ProjectilePrefab projectileType, Vector2 position, float rotation, DanmakuField field) { - Projectile proj = projectilePool.Get (); + public static Danmaku Get (DanmakuPrefab projectileType, Vector2 position, DynamicFloat rotation, DanmakuField field) { + Danmaku proj = projectilePool.Get (); proj.MatchPrefab (projectileType); proj.PositionImmediate = position; proj.Rotation = rotation; @@ -99,8 +99,8 @@ public static Projectile Get (ProjectilePrefab projectileType, Vector2 position, return proj; } - public static Projectile Get(DanmakuField field, FireBuilder builder) { - Projectile proj = projectilePool.Get (); + public static Danmaku Get(DanmakuField field, FireBuilder builder) { + Danmaku proj = projectilePool.Get (); proj.MatchPrefab (builder.Prefab); proj.PositionImmediate = field.WorldPoint (builder.Position, builder.CoordinateSystem); proj.Rotation = builder.Rotation; diff --git a/Assets/External/DanmakuUnity2D/Core/DanmakuStatic.cs.meta b/Assets/External/DanmakuUnity2D/Core/DanmakuStatic.cs.meta new file mode 100644 index 00000000..0f912511 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/Core/DanmakuStatic.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ba447b32fc85b674fb1309555647ac5e +timeCreated: 1427667737 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Core/Enemy.cs b/Assets/External/DanmakuUnity2D/Core/Enemy.cs similarity index 97% rename from Assets/Plugins/DanmakuUnity2D/Core/Enemy.cs rename to Assets/External/DanmakuUnity2D/Core/Enemy.cs index 826fad79..b26bc04a 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/Enemy.cs +++ b/Assets/External/DanmakuUnity2D/Core/Enemy.cs @@ -1,4 +1,4 @@ -using UnityEngine; +using UnityEngine; using UnityUtilLib; /// @@ -85,7 +85,7 @@ protected virtual void OnDeath() { /// A message handler for handling collisions with Projectile(s) /// /// the projectile that hit the enemy - void OnProjectileCollision(Projectile proj) { + void OnProjectileCollision(Danmaku proj) { Hit (proj.Damage); proj.Deactivate(); } diff --git a/Assets/Plugins/DanmakuUnity2D/Core/Enemy.cs.meta b/Assets/External/DanmakuUnity2D/Core/Enemy.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Core/Enemy.cs.meta rename to Assets/External/DanmakuUnity2D/Core/Enemy.cs.meta index 401de701..dbe7236c 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/Enemy.cs.meta +++ b/Assets/External/DanmakuUnity2D/Core/Enemy.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: fef17956d76a9d84f9ad081564de6d85 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: fef17956d76a9d84f9ad081564de6d85 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/External/DanmakuUnity2D/Core/IDanmakuCollider.cs b/Assets/External/DanmakuUnity2D/Core/IDanmakuCollider.cs new file mode 100644 index 00000000..8881738e --- /dev/null +++ b/Assets/External/DanmakuUnity2D/Core/IDanmakuCollider.cs @@ -0,0 +1,8 @@ +using System; + +namespace Danmaku2D { + public interface IDanmakuCollider { + void OnProjectileCollision(Danmaku proj); + } +} + diff --git a/Assets/External/DanmakuUnity2D/Core/IDanmakuCollider.cs.meta b/Assets/External/DanmakuUnity2D/Core/IDanmakuCollider.cs.meta new file mode 100644 index 00000000..352b7fc3 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/Core/IDanmakuCollider.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3f03d4e12a796b84c8b9cd3a45859471 +timeCreated: 1427677758 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Core/MovementPattern.cs b/Assets/External/DanmakuUnity2D/Core/MovementPattern.cs similarity index 100% rename from Assets/Plugins/DanmakuUnity2D/Core/MovementPattern.cs rename to Assets/External/DanmakuUnity2D/Core/MovementPattern.cs diff --git a/Assets/Plugins/DanmakuUnity2D/Core/MovementPattern.cs.meta b/Assets/External/DanmakuUnity2D/Core/MovementPattern.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Core/MovementPattern.cs.meta rename to Assets/External/DanmakuUnity2D/Core/MovementPattern.cs.meta index 17e6378d..28181772 100644 --- a/Assets/Plugins/DanmakuUnity2D/Core/MovementPattern.cs.meta +++ b/Assets/External/DanmakuUnity2D/Core/MovementPattern.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: beed726bf734e4242a2015b569cedd2b -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: beed726bf734e4242a2015b569cedd2b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Editor.meta b/Assets/External/DanmakuUnity2D/Editor.meta similarity index 67% rename from Assets/Plugins/DanmakuUnity2D/Editor.meta rename to Assets/External/DanmakuUnity2D/Editor.meta index 33a35e39..b3dafa01 100644 --- a/Assets/Plugins/DanmakuUnity2D/Editor.meta +++ b/Assets/External/DanmakuUnity2D/Editor.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 65f6caea4d0249f47992d1ec7ad8bd0c +guid: 78624b29fad6f684da735be8df24a42b folderAsset: yes -timeCreated: 1427611179 +timeCreated: 1427734773 licenseType: Free DefaultImporter: userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Editor/AtomicMovementDrawer.cs b/Assets/External/DanmakuUnity2D/Editor/AtomicMovementDrawer.cs similarity index 100% rename from Assets/Plugins/DanmakuUnity2D/Editor/AtomicMovementDrawer.cs rename to Assets/External/DanmakuUnity2D/Editor/AtomicMovementDrawer.cs diff --git a/Assets/Plugins/DanmakuUnity2D/Editor/AtomicMovementDrawer.cs.meta b/Assets/External/DanmakuUnity2D/Editor/AtomicMovementDrawer.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Editor/AtomicMovementDrawer.cs.meta rename to Assets/External/DanmakuUnity2D/Editor/AtomicMovementDrawer.cs.meta index 45b8e243..a20f6638 100644 --- a/Assets/Plugins/DanmakuUnity2D/Editor/AtomicMovementDrawer.cs.meta +++ b/Assets/External/DanmakuUnity2D/Editor/AtomicMovementDrawer.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: af43737246b760f4a91af85820646830 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: af43737246b760f4a91af85820646830 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Editor/DanmakuAssets.cs b/Assets/External/DanmakuUnity2D/Editor/DanmakuAssets.cs similarity index 96% rename from Assets/Plugins/DanmakuUnity2D/Editor/DanmakuAssets.cs rename to Assets/External/DanmakuUnity2D/Editor/DanmakuAssets.cs index dfe50006..b7c0ff6e 100644 --- a/Assets/Plugins/DanmakuUnity2D/Editor/DanmakuAssets.cs +++ b/Assets/External/DanmakuUnity2D/Editor/DanmakuAssets.cs @@ -1,123 +1,123 @@ -using UnityEngine; -using UnityEditor; -using UnityUtilLib; -using Danmaku2D; -using Danmaku2D.Phantasmagoria; -using System.IO; - -/// -/// A static class full of editor shortcuts for faster development -/// -internal static class DanmakuAssets { - - private static string GetProjectWindowFolder() { - UnityEngine.Object activeObject = Selection.activeObject; - string path = ""; - if (activeObject == null) - return "Assets"; // Nothing selected - else - path = AssetDatabase.GetAssetPath (activeObject); - if (path.Length > 0) { - if (Directory.Exists (path)) { - return path; // path is a folder - } else { -// Debug.Log(path); -// Debug.Log(Directory.GetParent(path).FullName); - return Directory.GetParent(path).FullName; - } - } - return ""; //path in Assets folder - } - - /// - /// Creates a blank ProjectilePrefab asset - /// Found under Assets/Create/Danmaku 2D/Projectile Prefab - /// - [MenuItem("Assets/Create/Danmaku 2D/Projectile Prefab", false, 51)] - public static void AddProjectilePrefab() { - GameObject temp = new GameObject ("Projectile Prefab"); - temp.AddComponent (); - string pathName = GetProjectWindowFolder (); - GameObject prefab = PrefabUtility.CreatePrefab (pathName + "/Projectile Prefab.prefab", temp); - Object.DestroyImmediate (temp); - SerializedObject so = new SerializedObject (prefab.GetComponent ()); - so.FindProperty ("circleCollider").objectReferenceValue = prefab.GetComponent (); - so.FindProperty ("spriteRenderer").objectReferenceValue = prefab.GetComponent (); - so.ApplyModifiedProperties (); - } - - /// - /// Creates the base of a full Phantasmagoria game with a single click - /// Found under GameObject/Create/Danmaku 2D/Phantasmagoria/Game Gamecontroller - /// - [MenuItem("GameObject/Create/Danmaku 2D/Phantasmagoria/Game Controller")] - public static void CreatePhantasmagoriaGame() { - GameObject temp = new GameObject ("Game Controller"); - temp.AddComponent (); - PhantasmagoriaGameController pcg = temp.AddComponent (); - DanmakuField playerField1 = CreateDanmakuField (); - DanmakuField playerField2 = CreateDanmakuField (); - playerField1.gameObject.name = "Player 1 " + playerField1.gameObject.name; - playerField2.gameObject.name = "Player 2 " + playerField2.gameObject.name; - SerializedObject pcgS = new SerializedObject (pcg); - pcgS.FindProperty ("player1.field").objectReferenceValue = playerField1; - pcgS.FindProperty ("player2.field").objectReferenceValue = playerField2; - pcgS.ApplyModifiedProperties (); - playerField1.transform.position = new Vector3 (-100f, 0f, 0f); - playerField2.transform.position = new Vector3 (100f, 0f, 0f); - temp.AddComponent (); - temp.AddComponent (); - temp.AddComponent(); - temp.AddComponent (); - } - - /// - /// Creates a PhantasmagoriaField with a single click - /// Found under GameObject/Create/Danmaku 2D/Phantasmagoria/Field - /// - /// The phantasmagoria field created. - [MenuItem("GameObject/Create/Danmaku 2D/Danmaku Field")] - public static DanmakuField CreateDanmakuField() { - GameObject temp = new GameObject ("Field"); - DanmakuField field = temp.AddComponent (); - GameObject background = GameObject.CreatePrimitive (PrimitiveType.Quad); - background.name = "Background"; - background.transform.parent = field.transform; - background.transform.localPosition = new Vector3 (0f, 0f, 10f); - Object.DestroyImmediate(background.GetComponent ()); - background.transform.localScale = new Vector3 (48.125f, 48.125f, 1f); - GameObject cam = new GameObject ("Camera"); - cam.transform.parent = temp.transform; - cam.transform.localScale = new Vector3 (0f, 0f, -10f); - Camera camera = cam.AddComponent (); - SerializedObject camS = new SerializedObject (field); - camS.FindProperty ("fieldCamera").objectReferenceValue = camera; - camS.ApplyModifiedProperties (); - camera.orthographic = true; - camera.orthographicSize = 20; - camera.farClipPlane = 25; - return field; - } - -// [MenuItem("Assets/Create/Danmaku 2D/Custom Attack Pattern")] -// public static void CreateAttackPattern() { -// string text = "using UnityEngine;\nusing System.Collections;\nusing Danmaku2D;\n" + -// "\npublic class NewAttackPattern : AttackPattern {\n" + -// "\t//Used to determine when the attack pattern is finished and can terminate" + -// "\n\tprotected override bool IsFinished {\n" + -// "\t\tget {\n" + -// "\t\t\treturn false;\n" + -// "\t\t}\n" + -// "\t}\n" + -// "\n\t//The main loop of the attack pattern, executed every frame" + -// "\tprotected override void MainLoop() {\n" + -// "\n\n\t}\n" + -// "}"; -// CreateScript (text, "NewAttackPattern"); -// } -// -// private static void CreateScript(string scriptText, string name) { -// File.WriteAllText (Application.dataPath + "/ " + name + ".cs", scriptText); -// AssetDatabase.ImportAsset ("Assets/" + name + ".cs"); -// } -} +using UnityEngine; +using UnityEditor; +using UnityUtilLib; +using Danmaku2D; +using Danmaku2D.Phantasmagoria; +using System.IO; + +/// +/// A static class full of editor shortcuts for faster development +/// +internal static class DanmakuAssets { + + private static string GetProjectWindowFolder() { + UnityEngine.Object activeObject = Selection.activeObject; + string path = ""; + if (activeObject == null) + return "Assets"; // Nothing selected + else + path = AssetDatabase.GetAssetPath (activeObject); + if (path.Length > 0) { + if (Directory.Exists (path)) { + return path; // path is a folder + } else { +// Debug.Log(path); +// Debug.Log(Directory.GetParent(path).FullName); + return Directory.GetParent(path).FullName; + } + } + return ""; //path in Assets folder + } + + /// + /// Creates a blank ProjectilePrefab asset + /// Found under Assets/Create/Danmaku 2D/Projectile Prefab + /// + [MenuItem("Assets/Create/Danmaku 2D/Projectile Prefab", false, 51)] + public static void AddProjectilePrefab() { + GameObject temp = new GameObject ("Projectile Prefab"); + temp.AddComponent (); + string pathName = GetProjectWindowFolder (); + GameObject prefab = PrefabUtility.CreatePrefab (pathName + "/Projectile Prefab.prefab", temp); + Object.DestroyImmediate (temp); + SerializedObject so = new SerializedObject (prefab.GetComponent ()); + so.FindProperty ("circleCollider").objectReferenceValue = prefab.GetComponent (); + so.FindProperty ("spriteRenderer").objectReferenceValue = prefab.GetComponent (); + so.ApplyModifiedProperties (); + } + + /// + /// Creates the base of a full Phantasmagoria game with a single click + /// Found under GameObject/Create/Danmaku 2D/Phantasmagoria/Game Gamecontroller + /// + [MenuItem("GameObject/Create/Danmaku 2D/Phantasmagoria/Game Controller")] + public static void CreatePhantasmagoriaGame() { + GameObject temp = new GameObject ("Game Controller"); + temp.AddComponent (); + PhantasmagoriaGameController pcg = temp.AddComponent (); + DanmakuField playerField1 = CreateDanmakuField (); + DanmakuField playerField2 = CreateDanmakuField (); + playerField1.gameObject.name = "Player 1 " + playerField1.gameObject.name; + playerField2.gameObject.name = "Player 2 " + playerField2.gameObject.name; + SerializedObject pcgS = new SerializedObject (pcg); + pcgS.FindProperty ("player1.field").objectReferenceValue = playerField1; + pcgS.FindProperty ("player2.field").objectReferenceValue = playerField2; + pcgS.ApplyModifiedProperties (); + playerField1.transform.position = new Vector3 (-100f, 0f, 0f); + playerField2.transform.position = new Vector3 (100f, 0f, 0f); + temp.AddComponent (); + temp.AddComponent (); + temp.AddComponent(); + temp.AddComponent (); + } + + /// + /// Creates a PhantasmagoriaField with a single click + /// Found under GameObject/Create/Danmaku 2D/Phantasmagoria/Field + /// + /// The phantasmagoria field created. + [MenuItem("GameObject/Create/Danmaku 2D/Danmaku Field")] + public static DanmakuField CreateDanmakuField() { + GameObject temp = new GameObject ("Field"); + DanmakuField field = temp.AddComponent (); + GameObject background = GameObject.CreatePrimitive (PrimitiveType.Quad); + background.name = "Background"; + background.transform.parent = field.transform; + background.transform.localPosition = new Vector3 (0f, 0f, 10f); + Object.DestroyImmediate(background.GetComponent ()); + background.transform.localScale = new Vector3 (48.125f, 48.125f, 1f); + GameObject cam = new GameObject ("Camera"); + cam.transform.parent = temp.transform; + cam.transform.localScale = new Vector3 (0f, 0f, -10f); + Camera camera = cam.AddComponent (); + SerializedObject camS = new SerializedObject (field); + camS.FindProperty ("fieldCamera").objectReferenceValue = camera; + camS.ApplyModifiedProperties (); + camera.orthographic = true; + camera.orthographicSize = 20; + camera.farClipPlane = 25; + return field; + } + +// [MenuItem("Assets/Create/Danmaku 2D/Custom Attack Pattern")] +// public static void CreateAttackPattern() { +// string text = "using UnityEngine;\nusing System.Collections;\nusing Danmaku2D;\n" + +// "\npublic class NewAttackPattern : AttackPattern {\n" + +// "\t//Used to determine when the attack pattern is finished and can terminate" + +// "\n\tprotected override bool IsFinished {\n" + +// "\t\tget {\n" + +// "\t\t\treturn false;\n" + +// "\t\t}\n" + +// "\t}\n" + +// "\n\t//The main loop of the attack pattern, executed every frame" + +// "\tprotected override void MainLoop() {\n" + +// "\n\n\t}\n" + +// "}"; +// CreateScript (text, "NewAttackPattern"); +// } +// +// private static void CreateScript(string scriptText, string name) { +// File.WriteAllText (Application.dataPath + "/ " + name + ".cs", scriptText); +// AssetDatabase.ImportAsset ("Assets/" + name + ".cs"); +// } +} diff --git a/Assets/Plugins/DanmakuUnity2D/Editor/DanmakuAssets.cs.meta b/Assets/External/DanmakuUnity2D/Editor/DanmakuAssets.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Editor/DanmakuAssets.cs.meta rename to Assets/External/DanmakuUnity2D/Editor/DanmakuAssets.cs.meta index 0df28411..bcf677cf 100644 --- a/Assets/Plugins/DanmakuUnity2D/Editor/DanmakuAssets.cs.meta +++ b/Assets/External/DanmakuUnity2D/Editor/DanmakuAssets.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: f2961d7bc00e575429a3bd17d18b762a -timeCreated: 1425693398 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: f2961d7bc00e575429a3bd17d18b762a +timeCreated: 1425693398 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Editor/DanmakuFieldEditor.cs b/Assets/External/DanmakuUnity2D/Editor/DanmakuFieldEditor.cs similarity index 97% rename from Assets/Plugins/DanmakuUnity2D/Editor/DanmakuFieldEditor.cs rename to Assets/External/DanmakuUnity2D/Editor/DanmakuFieldEditor.cs index 46160ee8..569be9fa 100644 --- a/Assets/Plugins/DanmakuUnity2D/Editor/DanmakuFieldEditor.cs +++ b/Assets/External/DanmakuUnity2D/Editor/DanmakuFieldEditor.cs @@ -1,197 +1,197 @@ -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; -using Danmaku2D; -using UnityUtilLib; - -namespace Danmaku2D.Editor { - - [CustomEditor(typeof(DanmakuField))] - internal class DanmakuFieldEditor : UnityEditor.Editor { - - private DanmakuField field; - - private SerializedProperty clipBoundary; - private SerializedProperty playerSpawnLocation; - private SerializedProperty gamePlaneDistance; - private SerializedProperty camera3D; - private SerializedProperty camera2D; - private SerializedProperty cameraTransform2D; - - private SerializedProperty camera2Drotation; - - private SerializedProperty size; - private SerializedProperty viewportRect; - //private SerializedProperty cullingMask; - private SerializedProperty depth; - private SerializedProperty renderingPath; - private SerializedProperty renderTexture; - private SerializedProperty occlusionCulling; - private SerializedProperty hdr; - - private SerializedProperty c_size; - private SerializedProperty c_viewportRect; - private SerializedProperty c_cullingMask; - private SerializedProperty c_depth; - private SerializedProperty c_renderingPath; - private SerializedProperty c_renderTexture; - private SerializedProperty c_occlusionCulling; - private SerializedProperty c_hdr; - - private SerializedProperty fixedCameraArea; - private SerializedProperty anchorPoint; - private SerializedProperty nativeAspect; - private SerializedProperty nativeScreenBounds; - - private SerializedObject cameraSO; - - private GUIContent camera3DLabel; - private GUIContent sizeLabel; - private GUIContent cullingMaskLabel; - private GUIContent viewportLabel; - private GUIContent depthLabel; - private GUIContent renderingPathLabel; - private GUIContent renderTextureLabel; - private GUIContent occlusionCullingLabel; - private GUIContent hdrLabel; - - private GUIContent rotationLabel; - - private Camera camera2Dobj; - - public void OnEnable() { - field = target as DanmakuField; - - clipBoundary = serializedObject.FindProperty ("ClipBoundary"); - playerSpawnLocation = serializedObject.FindProperty ("playerSpawnLocation"); - gamePlaneDistance = serializedObject.FindProperty ("GamePlaneDistance"); - camera3D = serializedObject.FindProperty ("camera3D"); - camera2D = serializedObject.FindProperty ("camera2D"); - cameraTransform2D = serializedObject.FindProperty ("cameraTransform2D"); - - camera2Drotation = serializedObject.FindProperty ("camera2DRotation"); - - viewportRect = serializedObject.FindProperty ("normalArea"); - - fixedCameraArea = serializedObject.FindProperty("fixedCameraArea"); - anchorPoint = serializedObject.FindProperty("cameraScreenAnchorPoint"); - nativeAspect = serializedObject.FindProperty("nativeScreenAspectRatio"); - nativeScreenBounds = serializedObject.FindProperty("nativeScreenBounds"); - - size = serializedObject.FindProperty ("size"); - viewportRect = serializedObject.FindProperty ("viewportRect"); - //cullingMask = serializedObject.FindProperty ("cullingMask"); - depth = serializedObject.FindProperty ("depth"); - renderingPath = serializedObject.FindProperty("renderingPath"); - renderTexture = serializedObject.FindProperty ("renderTexture"); - occlusionCulling = serializedObject.FindProperty("occlusionCulling"); - hdr = serializedObject.FindProperty("hdr"); - - camera3DLabel = new GUIContent ("3D Camera"); - sizeLabel = new GUIContent ("size"); - cullingMaskLabel = new GUIContent ("Culling Mask"); - viewportLabel = new GUIContent ("Viewport Rect"); - depthLabel = new GUIContent("Depth"); - renderingPathLabel = new GUIContent ("Rendering Path"); - renderTextureLabel = new GUIContent ("Target Texture"); - occlusionCullingLabel = new GUIContent ("Occlusion Culling"); - hdrLabel = new GUIContent ("HDR"); - - rotationLabel = new GUIContent ("Rotation"); - - SetupCamera (); - } - - private void SetupCamera() { - camera2Dobj = camera2D.objectReferenceValue as Camera; - if (camera2Dobj == null) { - cameraSO = null; - cameraTransform2D.objectReferenceValue = null; - } else { - cameraSO = new SerializedObject (camera2Dobj); - cameraTransform2D.objectReferenceValue = camera2Dobj.transform; - c_size = cameraSO.FindProperty ("orthographic size"); - c_cullingMask = cameraSO.FindProperty ("m_CullingMask"); - c_viewportRect = cameraSO.FindProperty ("m_NormalizedViewPortRect"); - c_depth = cameraSO.FindProperty ("m_Depth"); - c_renderingPath= cameraSO.FindProperty ("m_RenderingPath"); - c_renderTexture = cameraSO.FindProperty ("m_TargetTexture"); - c_occlusionCulling = cameraSO.FindProperty ("m_OcclusionCulling"); - c_hdr = cameraSO.FindProperty ("m_HDR"); - } - } - - public override bool RequiresConstantRepaint () { - return true; - } - - public override void OnInspectorGUI () { - serializedObject.Update (); - EditorGUILayout.PropertyField (clipBoundary); - EditorGUILayout.PropertyField (playerSpawnLocation); - EditorGUILayout.PropertyField (gamePlaneDistance); - EditorGUILayout.PropertyField (camera3D, camera3DLabel); - -// if(camera2Dobj != null) { -// camera2Dobj.orthographicSize = size.floatValue; -// camera2Dobj.cullingMask = cullingMask.intValue; -// camera2Dobj.rect = viewportRect.rectValue; -// camera2Dobj.depth = depth.floatValue; -// camera2Dobj.renderingPath = (RenderingPath)renderingPath.enumValueIndex; -// camera2Dobj.targetTexture = (RenderTexture)renderTexture.objectReferenceValue; -// camera2Dobj.useOcclusionCulling = occlusionCulling.boolValue; -// camera2Dobj.hdr = hdr.boolValue; -// } - - SetupCamera (); - - if (cameraSO != null) { - cameraSO.Update(); - EditorGUILayout.PropertyField (c_size, sizeLabel); - EditorGUILayout.LabelField ("2D Camera"); - EditorGUI.indentLevel++; - EditorGUILayout.PropertyField(camera2Drotation, rotationLabel); - EditorGUILayout.PropertyField (c_cullingMask, cullingMaskLabel); - EditorGUILayout.PropertyField (c_viewportRect, viewportLabel); - EditorGUILayout.PropertyField (c_depth, depthLabel); - EditorGUILayout.PropertyField (c_renderingPath, renderingPathLabel); - EditorGUILayout.PropertyField (c_renderTexture, renderTextureLabel); - EditorGUILayout.PropertyField (c_occlusionCulling, occlusionCullingLabel); - EditorGUILayout.PropertyField (c_hdr, hdrLabel); - - size.floatValue = c_size.floatValue; -// cullingMask.intValue = c_cullingMask.intValue; -// print(cullingMask.intValue); -// print(c_cullingMask.intValue); - viewportRect.rectValue = c_viewportRect.rectValue; - depth.floatValue = c_depth.floatValue; - renderingPath.enumValueIndex = c_renderingPath.enumValueIndex; - renderTexture.objectReferenceValue = c_renderTexture.objectReferenceValue; - occlusionCulling.boolValue = c_occlusionCulling.boolValue; - hdr.boolValue = c_hdr.boolValue; - - EditorGUILayout.PropertyField(fixedCameraArea); - if(fixedCameraArea.boolValue) { - EditorGUILayout.PropertyField(anchorPoint); - EditorGUILayout.PropertyField(nativeAspect); - EditorGUILayout.PropertyField(nativeScreenBounds); - if(GUILayout.Button("Reinitialize")) { - Vector2 screenSize = EditorUtil.GetGameViewAspectRatio(); - if(screenSize == Vector2.zero) { - Debug.LogWarning("Warning: Game View in Free Aspect. Native Aspect Ratio is improperly initialized. Try again with a fixed aspect ratio."); - } - nativeAspect.floatValue = screenSize.x / screenSize.y; - nativeScreenBounds.rectValue = camera2Dobj.rect; - } - } - EditorGUI.indentLevel--; - } - if (UnityEngine.GUI.changed) { - cameraSO.ApplyModifiedProperties(); - serializedObject.ApplyModifiedProperties (); - camera2Dobj.enabled = true; - field.enabled = true; - } - } - } +using UnityEngine; +using UnityEditor; +using System.Collections.Generic; +using Danmaku2D; +using UnityUtilLib; + +namespace Danmaku2D.Editor { + + [CustomEditor(typeof(DanmakuField))] + internal class DanmakuFieldEditor : UnityEditor.Editor { + + private DanmakuField field; + + private SerializedProperty clipBoundary; + private SerializedProperty playerSpawnLocation; + private SerializedProperty gamePlaneDistance; + private SerializedProperty camera3D; + private SerializedProperty camera2D; + private SerializedProperty cameraTransform2D; + + private SerializedProperty camera2Drotation; + + private SerializedProperty size; + private SerializedProperty viewportRect; + //private SerializedProperty cullingMask; + private SerializedProperty depth; + private SerializedProperty renderingPath; + private SerializedProperty renderTexture; + private SerializedProperty occlusionCulling; + private SerializedProperty hdr; + + private SerializedProperty c_size; + private SerializedProperty c_viewportRect; + private SerializedProperty c_cullingMask; + private SerializedProperty c_depth; + private SerializedProperty c_renderingPath; + private SerializedProperty c_renderTexture; + private SerializedProperty c_occlusionCulling; + private SerializedProperty c_hdr; + + private SerializedProperty fixedCameraArea; + private SerializedProperty anchorPoint; + private SerializedProperty nativeAspect; + private SerializedProperty nativeScreenBounds; + + private SerializedObject cameraSO; + + private GUIContent camera3DLabel; + private GUIContent sizeLabel; + private GUIContent cullingMaskLabel; + private GUIContent viewportLabel; + private GUIContent depthLabel; + private GUIContent renderingPathLabel; + private GUIContent renderTextureLabel; + private GUIContent occlusionCullingLabel; + private GUIContent hdrLabel; + + private GUIContent rotationLabel; + + private Camera camera2Dobj; + + public void OnEnable() { + field = target as DanmakuField; + + clipBoundary = serializedObject.FindProperty ("ClipBoundary"); + playerSpawnLocation = serializedObject.FindProperty ("playerSpawnLocation"); + gamePlaneDistance = serializedObject.FindProperty ("GamePlaneDistance"); + camera3D = serializedObject.FindProperty ("camera3D"); + camera2D = serializedObject.FindProperty ("camera2D"); + cameraTransform2D = serializedObject.FindProperty ("cameraTransform2D"); + + camera2Drotation = serializedObject.FindProperty ("camera2DRotation"); + + viewportRect = serializedObject.FindProperty ("normalArea"); + + fixedCameraArea = serializedObject.FindProperty("fixedCameraArea"); + anchorPoint = serializedObject.FindProperty("cameraScreenAnchorPoint"); + nativeAspect = serializedObject.FindProperty("nativeScreenAspectRatio"); + nativeScreenBounds = serializedObject.FindProperty("nativeScreenBounds"); + + size = serializedObject.FindProperty ("size"); + viewportRect = serializedObject.FindProperty ("viewportRect"); + //cullingMask = serializedObject.FindProperty ("cullingMask"); + depth = serializedObject.FindProperty ("depth"); + renderingPath = serializedObject.FindProperty("renderingPath"); + renderTexture = serializedObject.FindProperty ("renderTexture"); + occlusionCulling = serializedObject.FindProperty("occlusionCulling"); + hdr = serializedObject.FindProperty("hdr"); + + camera3DLabel = new GUIContent ("3D Camera"); + sizeLabel = new GUIContent ("size"); + cullingMaskLabel = new GUIContent ("Culling Mask"); + viewportLabel = new GUIContent ("Viewport Rect"); + depthLabel = new GUIContent("Depth"); + renderingPathLabel = new GUIContent ("Rendering Path"); + renderTextureLabel = new GUIContent ("Target Texture"); + occlusionCullingLabel = new GUIContent ("Occlusion Culling"); + hdrLabel = new GUIContent ("HDR"); + + rotationLabel = new GUIContent ("Rotation"); + + SetupCamera (); + } + + private void SetupCamera() { + camera2Dobj = camera2D.objectReferenceValue as Camera; + if (camera2Dobj == null) { + cameraSO = null; + cameraTransform2D.objectReferenceValue = null; + } else { + cameraSO = new SerializedObject (camera2Dobj); + cameraTransform2D.objectReferenceValue = camera2Dobj.transform; + c_size = cameraSO.FindProperty ("orthographic size"); + c_cullingMask = cameraSO.FindProperty ("m_CullingMask"); + c_viewportRect = cameraSO.FindProperty ("m_NormalizedViewPortRect"); + c_depth = cameraSO.FindProperty ("m_Depth"); + c_renderingPath= cameraSO.FindProperty ("m_RenderingPath"); + c_renderTexture = cameraSO.FindProperty ("m_TargetTexture"); + c_occlusionCulling = cameraSO.FindProperty ("m_OcclusionCulling"); + c_hdr = cameraSO.FindProperty ("m_HDR"); + } + } + + public override bool RequiresConstantRepaint () { + return true; + } + + public override void OnInspectorGUI () { + serializedObject.Update (); + EditorGUILayout.PropertyField (clipBoundary); + EditorGUILayout.PropertyField (playerSpawnLocation); + EditorGUILayout.PropertyField (gamePlaneDistance); + EditorGUILayout.PropertyField (camera3D, camera3DLabel); + +// if(camera2Dobj != null) { +// camera2Dobj.orthographicSize = size.floatValue; +// camera2Dobj.cullingMask = cullingMask.intValue; +// camera2Dobj.rect = viewportRect.rectValue; +// camera2Dobj.depth = depth.floatValue; +// camera2Dobj.renderingPath = (RenderingPath)renderingPath.enumValueIndex; +// camera2Dobj.targetTexture = (RenderTexture)renderTexture.objectReferenceValue; +// camera2Dobj.useOcclusionCulling = occlusionCulling.boolValue; +// camera2Dobj.hdr = hdr.boolValue; +// } + + SetupCamera (); + + if (cameraSO != null) { + cameraSO.Update(); + EditorGUILayout.PropertyField (c_size, sizeLabel); + EditorGUILayout.LabelField ("2D Camera"); + EditorGUI.indentLevel++; + EditorGUILayout.PropertyField(camera2Drotation, rotationLabel); + EditorGUILayout.PropertyField (c_cullingMask, cullingMaskLabel); + EditorGUILayout.PropertyField (c_viewportRect, viewportLabel); + EditorGUILayout.PropertyField (c_depth, depthLabel); + EditorGUILayout.PropertyField (c_renderingPath, renderingPathLabel); + EditorGUILayout.PropertyField (c_renderTexture, renderTextureLabel); + EditorGUILayout.PropertyField (c_occlusionCulling, occlusionCullingLabel); + EditorGUILayout.PropertyField (c_hdr, hdrLabel); + + size.floatValue = c_size.floatValue; +// cullingMask.intValue = c_cullingMask.intValue; +// print(cullingMask.intValue); +// print(c_cullingMask.intValue); + viewportRect.rectValue = c_viewportRect.rectValue; + depth.floatValue = c_depth.floatValue; + renderingPath.enumValueIndex = c_renderingPath.enumValueIndex; + renderTexture.objectReferenceValue = c_renderTexture.objectReferenceValue; + occlusionCulling.boolValue = c_occlusionCulling.boolValue; + hdr.boolValue = c_hdr.boolValue; + + EditorGUILayout.PropertyField(fixedCameraArea); + if(fixedCameraArea.boolValue) { + EditorGUILayout.PropertyField(anchorPoint); + EditorGUILayout.PropertyField(nativeAspect); + EditorGUILayout.PropertyField(nativeScreenBounds); + if(GUILayout.Button("Reinitialize")) { + Vector2 screenSize = EditorUtil.GetGameViewAspectRatio(); + if(screenSize == Vector2.zero) { + Debug.LogWarning("Warning: Game View in Free Aspect. Native Aspect Ratio is improperly initialized. Try again with a fixed aspect ratio."); + } + nativeAspect.floatValue = screenSize.x / screenSize.y; + nativeScreenBounds.rectValue = camera2Dobj.rect; + } + } + EditorGUI.indentLevel--; + } + if (UnityEngine.GUI.changed) { + cameraSO.ApplyModifiedProperties(); + serializedObject.ApplyModifiedProperties (); + camera2Dobj.enabled = true; + field.enabled = true; + } + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Editor/DanmakuFieldEditor.cs.meta b/Assets/External/DanmakuUnity2D/Editor/DanmakuFieldEditor.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Editor/DanmakuFieldEditor.cs.meta rename to Assets/External/DanmakuUnity2D/Editor/DanmakuFieldEditor.cs.meta index 4f0ae850..e422a151 100644 --- a/Assets/Plugins/DanmakuUnity2D/Editor/DanmakuFieldEditor.cs.meta +++ b/Assets/External/DanmakuUnity2D/Editor/DanmakuFieldEditor.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 1927904deafb5874994d90336135a925 -timeCreated: 1426731333 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 1927904deafb5874994d90336135a925 +timeCreated: 1426731333 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Editor/DanmakuGameControllerEditor.cs b/Assets/External/DanmakuUnity2D/Editor/DanmakuGameControllerEditor.cs similarity index 97% rename from Assets/Plugins/DanmakuUnity2D/Editor/DanmakuGameControllerEditor.cs rename to Assets/External/DanmakuUnity2D/Editor/DanmakuGameControllerEditor.cs index 8798370e..2bbfeca0 100644 --- a/Assets/Plugins/DanmakuUnity2D/Editor/DanmakuGameControllerEditor.cs +++ b/Assets/External/DanmakuUnity2D/Editor/DanmakuGameControllerEditor.cs @@ -1,34 +1,34 @@ -using UnityEngine; -using UnityEditor; -using Danmaku2D; - -/// -/// Custom Editor for ProjectileManager -/// -[CustomEditor(typeof(DanmakuGameController))] -internal class DanmakuGameControllerEditor : UnityEditor.Editor { - - /// - /// Creates custom GUI useful for statistics/debug on the Scene View - /// Shows how many active Projectiles and how many - /// - public void OnSceneGUI() { -// ProjectileManager pool = target as ProjectileManager; -// GUISkin skin = GUI.skin; -// Handles.BeginGUI (); -// GUILayout.BeginArea (new Rect(0,0,150,60), skin.box); -// GUILayout.BeginVertical (); -// GUILayout.BeginHorizontal (); -// GUILayout.FlexibleSpace (); -// GUILayout.Label ("Projectile Pool"); -// GUILayout.FlexibleSpace (); -// GUILayout.EndHorizontal(); -// GUILayout.Label ("Total Count: " + pool.TotalCount); -// GUILayout.Label ("Active Count: " + pool.ActiveCount); -// GUILayout.EndVertical (); -// GUILayout.EndArea (); -// if(GUI.changed) -// EditorUtility.SetDirty(target); -// Handles.EndGUI (); - } +using UnityEngine; +using UnityEditor; +using Danmaku2D; + +/// +/// Custom Editor for ProjectileManager +/// +[CustomEditor(typeof(DanmakuGameController))] +internal class DanmakuGameControllerEditor : UnityEditor.Editor { + + /// + /// Creates custom GUI useful for statistics/debug on the Scene View + /// Shows how many active Projectiles and how many + /// + public void OnSceneGUI() { +// ProjectileManager pool = target as ProjectileManager; +// GUISkin skin = GUI.skin; +// Handles.BeginGUI (); +// GUILayout.BeginArea (new Rect(0,0,150,60), skin.box); +// GUILayout.BeginVertical (); +// GUILayout.BeginHorizontal (); +// GUILayout.FlexibleSpace (); +// GUILayout.Label ("Projectile Pool"); +// GUILayout.FlexibleSpace (); +// GUILayout.EndHorizontal(); +// GUILayout.Label ("Total Count: " + pool.TotalCount); +// GUILayout.Label ("Active Count: " + pool.ActiveCount); +// GUILayout.EndVertical (); +// GUILayout.EndArea (); +// if(GUI.changed) +// EditorUtility.SetDirty(target); +// Handles.EndGUI (); + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Editor/DanmakuGameControllerEditor.cs.meta b/Assets/External/DanmakuUnity2D/Editor/DanmakuGameControllerEditor.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Editor/DanmakuGameControllerEditor.cs.meta rename to Assets/External/DanmakuUnity2D/Editor/DanmakuGameControllerEditor.cs.meta index df16fcd7..b16bcfa5 100644 --- a/Assets/Plugins/DanmakuUnity2D/Editor/DanmakuGameControllerEditor.cs.meta +++ b/Assets/External/DanmakuUnity2D/Editor/DanmakuGameControllerEditor.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: e2832f4d79dc40f4f82ba5f7cd141a86 -timeCreated: 1427240205 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: e2832f4d79dc40f4f82ba5f7cd141a86 +timeCreated: 1427240205 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Editor/FieldMovementPatternEditor.cs b/Assets/External/DanmakuUnity2D/Editor/FieldMovementPatternEditor.cs similarity index 100% rename from Assets/Plugins/DanmakuUnity2D/Editor/FieldMovementPatternEditor.cs rename to Assets/External/DanmakuUnity2D/Editor/FieldMovementPatternEditor.cs diff --git a/Assets/Plugins/DanmakuUnity2D/Editor/FieldMovementPatternEditor.cs.meta b/Assets/External/DanmakuUnity2D/Editor/FieldMovementPatternEditor.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Editor/FieldMovementPatternEditor.cs.meta rename to Assets/External/DanmakuUnity2D/Editor/FieldMovementPatternEditor.cs.meta index df4cc65e..3fa42045 100644 --- a/Assets/Plugins/DanmakuUnity2D/Editor/FieldMovementPatternEditor.cs.meta +++ b/Assets/External/DanmakuUnity2D/Editor/FieldMovementPatternEditor.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 2538360e4b53a5941922dfca3500b86a -timeCreated: 1426234458 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 2538360e4b53a5941922dfca3500b86a +timeCreated: 1426234458 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Editor/ProjectilePrefabEditor.cs b/Assets/External/DanmakuUnity2D/Editor/ProjectilePrefabEditor.cs similarity index 90% rename from Assets/Plugins/DanmakuUnity2D/Editor/ProjectilePrefabEditor.cs rename to Assets/External/DanmakuUnity2D/Editor/ProjectilePrefabEditor.cs index 51888b37..e6da02cb 100644 --- a/Assets/Plugins/DanmakuUnity2D/Editor/ProjectilePrefabEditor.cs +++ b/Assets/External/DanmakuUnity2D/Editor/ProjectilePrefabEditor.cs @@ -1,31 +1,31 @@ -using UnityEngine; -using UnityEditor; -using Danmaku2D; - -/// -/// Custom Editor for ProjectilePrefab -/// -[CustomEditor(typeof(ProjectilePrefab))] -internal class ProjectilePrefabEditor : UnityEditor.Editor { - - /// - /// Creates the custom Inspector GUI for an instance of ProjectilePrefab. - /// Adds an extra button to quickly set all the values of the instance so that the user does not need to manually drag in each one. - /// - public override void OnInspectorGUI () { - base.OnInspectorGUI (); - ProjectilePrefab prefab = target as ProjectilePrefab; - if(GUILayout.Button("Reinitialize")) { - SerializedProperty collider = serializedObject.FindProperty("circleCollider"); - SerializedProperty renderer = serializedObject.FindProperty("spriteRenderer"); - collider.objectReferenceValue = prefab.GetComponent(); - renderer.objectReferenceValue = prefab.GetComponent(); -// ProjectileControlBehavior[] controllerScripts = prefab.GetComponents(); -// controllers.arraySize = controllerScripts.Length; -// for(int i = 0; i < controllerScripts.Length; i++) { -// controllers.GetArrayElementAtIndex(i).objectReferenceValue = controllerScripts[i]; -// } - serializedObject.ApplyModifiedProperties(); - } - } +using UnityEngine; +using UnityEditor; +using Danmaku2D; + +/// +/// Custom Editor for ProjectilePrefab +/// +[CustomEditor(typeof(DanmakuPrefab))] +internal class ProjectilePrefabEditor : UnityEditor.Editor { + + /// + /// Creates the custom Inspector GUI for an instance of ProjectilePrefab. + /// Adds an extra button to quickly set all the values of the instance so that the user does not need to manually drag in each one. + /// + public override void OnInspectorGUI () { + base.OnInspectorGUI (); + DanmakuPrefab prefab = target as DanmakuPrefab; + if(GUILayout.Button("Reinitialize")) { + SerializedProperty collider = serializedObject.FindProperty("circleCollider"); + SerializedProperty renderer = serializedObject.FindProperty("spriteRenderer"); + collider.objectReferenceValue = prefab.GetComponent(); + renderer.objectReferenceValue = prefab.GetComponent(); +// ProjectileControlBehavior[] controllerScripts = prefab.GetComponents(); +// controllers.arraySize = controllerScripts.Length; +// for(int i = 0; i < controllerScripts.Length; i++) { +// controllers.GetArrayElementAtIndex(i).objectReferenceValue = controllerScripts[i]; +// } + serializedObject.ApplyModifiedProperties(); + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Editor/ProjectilePrefabEditor.cs.meta b/Assets/External/DanmakuUnity2D/Editor/ProjectilePrefabEditor.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Editor/ProjectilePrefabEditor.cs.meta rename to Assets/External/DanmakuUnity2D/Editor/ProjectilePrefabEditor.cs.meta index 32271750..0a7423a3 100644 --- a/Assets/Plugins/DanmakuUnity2D/Editor/ProjectilePrefabEditor.cs.meta +++ b/Assets/External/DanmakuUnity2D/Editor/ProjectilePrefabEditor.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 302ab4e09e411d04c86db63a4f13479a -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: 302ab4e09e411d04c86db63a4f13479a +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/EnemyManager.cs b/Assets/External/DanmakuUnity2D/EnemyManager.cs similarity index 96% rename from Assets/Plugins/DanmakuUnity2D/EnemyManager.cs rename to Assets/External/DanmakuUnity2D/EnemyManager.cs index 7a357aa3..23b78f68 100644 --- a/Assets/Plugins/DanmakuUnity2D/EnemyManager.cs +++ b/Assets/External/DanmakuUnity2D/EnemyManager.cs @@ -9,11 +9,11 @@ public class EnemyManager : Singleton, IPausable { private List registeredEnemies; public static void RegisterEnemy(Enemy enemy) { - Instance.registeredEnemies.Add (enemy); +// Instance.registeredEnemies.Add (enemy); } public static void UnregisterEnemy(Enemy enemy) { - Instance.registeredEnemies.Remove (enemy); +// Instance.registeredEnemies.Remove (enemy); } private DanmakuGameController controller; diff --git a/Assets/Plugins/DanmakuUnity2D/EnemyManager.cs.meta b/Assets/External/DanmakuUnity2D/EnemyManager.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/EnemyManager.cs.meta rename to Assets/External/DanmakuUnity2D/EnemyManager.cs.meta index feac4608..a8864a6b 100644 --- a/Assets/Plugins/DanmakuUnity2D/EnemyManager.cs.meta +++ b/Assets/External/DanmakuUnity2D/EnemyManager.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 9067bfe8e13f8c54782f822c14d43c59 -timeCreated: 1426400112 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: -16000 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 9067bfe8e13f8c54782f822c14d43c59 +timeCreated: 1426400112 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: -16000 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/FieldBoundary.cs b/Assets/External/DanmakuUnity2D/FieldBoundary.cs similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/FieldBoundary.cs rename to Assets/External/DanmakuUnity2D/FieldBoundary.cs index ba170fab..93719986 100644 --- a/Assets/Plugins/DanmakuUnity2D/FieldBoundary.cs +++ b/Assets/External/DanmakuUnity2D/FieldBoundary.cs @@ -1,106 +1,106 @@ -using System; -using UnityEngine; -using UnityUtilLib; - -namespace Danmaku2D { - - [ExecuteInEditMode] - public class FieldBoundary : CachedObject { - - private enum Edge { Top = 0, Bottom = 1, Left = 2, Right = 3} - - private static Vector2[] fixedPoints = new Vector2[] { - new Vector2 (0, 1f), - new Vector2 (0, -1f), - new Vector2 (-1f, 0f), - new Vector2 (1f, 0f) - }; - - [SerializeField] - private DanmakuField field; - - [SerializeField] - private Edge location; - - [SerializeField] - private float bufferRatio = 0.1f; - - [SerializeField] - private float hangoverRatio = 0f; - - [SerializeField] - private float spaceRatio = 0; - - private BoxCollider2D boundary; - private Bounds2D oldBounds; - private Bounds2D newBounds; - - public override void Awake () { - base.Awake (); - boundary = GetComponent (); - if (field == null) { - print("No field provided, searching in ancestor GameObjects..."); - field = GetComponentInParent(); - } - if (field == null) { - Debug.LogError ("Field Boundary without a DanmakuField"); - } else { - UpdatePosition (); - } - } - - void Update () { - if (field != null && field.MovementBounds != oldBounds) { - UpdatePosition (); - } - } - - void OnDrawGizmos() { - Gizmos.color = Color.green; - Gizmos.DrawWireCube (boundary.bounds.center, boundary.bounds.size); - } - - private void UpdatePosition() { - oldBounds = field.MovementBounds; - - float size = oldBounds.Size.Max(); - Vector2 newPosition = (Vector2)oldBounds.Center + fixedPoints [(int)location].Hadamard2(oldBounds.Extents); - float buffer = bufferRatio * size; - float space = spaceRatio * size; - float hangover = hangoverRatio * size; - - Vector2 area = boundary.size; - switch(location) { - case Edge.Top: - case Edge.Bottom: - area.y = buffer; - area.x = oldBounds.Size.x + hangover; - break; - case Edge.Left: - case Edge.Right: - area.x = buffer; - area.y = oldBounds.Size.y + hangover; - break; - } - boundary.size = area; - - oldBounds = boundary.bounds; - switch(location) { - case Edge.Top: - newPosition.y += oldBounds.Extents.y + space; - break; - case Edge.Bottom: - newPosition.y -= oldBounds.Extents.y + space; - break; - case Edge.Left: - newPosition.x -= oldBounds.Extents.x + space; - break; - case Edge.Right: - newPosition.x += oldBounds.Extents.x + space; - break; - } - - transform.position = newPosition; - } - } +using System; +using UnityEngine; +using UnityUtilLib; + +namespace Danmaku2D { + + [ExecuteInEditMode] + public class FieldBoundary : CachedObject { + + private enum Edge { Top = 0, Bottom = 1, Left = 2, Right = 3} + + private static Vector2[] fixedPoints = new Vector2[] { + new Vector2 (0, 1f), + new Vector2 (0, -1f), + new Vector2 (-1f, 0f), + new Vector2 (1f, 0f) + }; + + [SerializeField] + private DanmakuField field; + + [SerializeField] + private Edge location; + + [SerializeField] + private float bufferRatio = 0.1f; + + [SerializeField] + private float hangoverRatio = 0f; + + [SerializeField] + private float spaceRatio = 0; + + private BoxCollider2D boundary; + private Bounds2D oldBounds; + private Bounds2D newBounds; + + public override void Awake () { + base.Awake (); + boundary = GetComponent (); + if (field == null) { + print("No field provided, searching in ancestor GameObjects..."); + field = GetComponentInParent(); + } + if (field == null) { + Debug.LogError ("Field Boundary without a DanmakuField"); + } else { + UpdatePosition (); + } + } + + void Update () { + if (field != null && field.MovementBounds != oldBounds) { + UpdatePosition (); + } + } + + void OnDrawGizmos() { + Gizmos.color = Color.green; + Gizmos.DrawWireCube (boundary.bounds.center, boundary.bounds.size); + } + + private void UpdatePosition() { + oldBounds = field.MovementBounds; + + float size = oldBounds.Size.Max(); + Vector2 newPosition = (Vector2)oldBounds.Center + fixedPoints [(int)location].Hadamard2(oldBounds.Extents); + float buffer = bufferRatio * size; + float space = spaceRatio * size; + float hangover = hangoverRatio * size; + + Vector2 area = boundary.size; + switch(location) { + case Edge.Top: + case Edge.Bottom: + area.y = buffer; + area.x = oldBounds.Size.x + hangover; + break; + case Edge.Left: + case Edge.Right: + area.x = buffer; + area.y = oldBounds.Size.y + hangover; + break; + } + boundary.size = area; + + oldBounds = boundary.bounds; + switch(location) { + case Edge.Top: + newPosition.y += oldBounds.Extents.y + space; + break; + case Edge.Bottom: + newPosition.y -= oldBounds.Extents.y + space; + break; + case Edge.Left: + newPosition.x -= oldBounds.Extents.x + space; + break; + case Edge.Right: + newPosition.x += oldBounds.Extents.x + space; + break; + } + + transform.position = newPosition; + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/FieldBoundary.cs.meta b/Assets/External/DanmakuUnity2D/FieldBoundary.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/FieldBoundary.cs.meta rename to Assets/External/DanmakuUnity2D/FieldBoundary.cs.meta index 7c55d0ce..a5dbd49a 100644 --- a/Assets/Plugins/DanmakuUnity2D/FieldBoundary.cs.meta +++ b/Assets/External/DanmakuUnity2D/FieldBoundary.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 35b973bd15e9f644da738535041ad0c3 -timeCreated: 1426901102 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 35b973bd15e9f644da738535041ad0c3 +timeCreated: 1426901102 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/FieldMovementPattern.cs b/Assets/External/DanmakuUnity2D/FieldMovementPattern.cs similarity index 96% rename from Assets/Plugins/DanmakuUnity2D/FieldMovementPattern.cs rename to Assets/External/DanmakuUnity2D/FieldMovementPattern.cs index 0f6b2f92..11de91cd 100644 --- a/Assets/Plugins/DanmakuUnity2D/FieldMovementPattern.cs +++ b/Assets/External/DanmakuUnity2D/FieldMovementPattern.cs @@ -1,89 +1,89 @@ -using UnityEngine; -using UnityUtilLib; -using System.Collections; - -/// -/// A development kit for quick development of 2D Danmaku games -/// -namespace Danmaku2D { - public class FieldMovementPattern : MovementPattern { - - [SerializeField] - private DanmakuField field; - - [System.Serializable] - public class AtomicMovement { - [SerializeField] - private float time; - public float Time { - get { - return time; - } - set { - time = value; - } - } - - [SerializeField] - private Vector2 targetLocation; - [SerializeField] - private Vector2 curveControlPoint1; - [SerializeField] - private Vector2 curveControlPoint2; - - public Vector3 NextLocation(DanmakuField field, Vector3 startLocation) { - return Interpret (targetLocation, field, startLocation); - } - - public Vector3 NextControlPoint1(DanmakuField field, Vector3 startLocation) { - return Interpret (curveControlPoint1, field, startLocation); - } - - public Vector3 NextControlPoint2(DanmakuField field, Vector3 startLocation) { - return Interpret (curveControlPoint2, field, startLocation); - } - - private Vector3 Interpret(Vector2 loc, DanmakuField field, Vector3 startLocation) { - Vector3 nextLocation = loc; - return startLocation + (Vector3)field.WorldPoint(nextLocation, DanmakuField.CoordinateSystem.Relative); - } - } - - /// - /// The movements. - /// - public AtomicMovement[] movements; - - public override void Awake () { - base.Awake (); - if (field == null) { - field = Util.FindClosest(transform.position); - } - } - - /// - /// Move this instance. - /// - protected override IEnumerator Move() { - for(int i = 0; i < movements.Length; i++) { - if(movements[i] != null) { - float totalTime = movements[i].Time; - float t = 0f; - Vector3 startLocation = transform.position; - Vector3 targetLocation = movements[i].NextLocation(field, startLocation); - Vector3 control1 = movements[i].NextControlPoint1(field, startLocation); - Vector3 control2 = movements[i].NextControlPoint2(field, startLocation); - Vector3 oldPosition; - float dt = Util.TargetDeltaTime; - while(t < 1f) { - oldPosition = transform.position; - transform.position = Util.BerzierCurveVectorLerp(startLocation, targetLocation, control1, control2, t); - transform.rotation = Util.RotationBetween2D(oldPosition, transform.position); - yield return UtilCoroutines.WaitForUnpause(this); - t += dt / totalTime; - } - } - } - } - } +using UnityEngine; +using UnityUtilLib; +using System.Collections; + +/// +/// A development kit for quick development of 2D Danmaku games +/// +namespace Danmaku2D { + public class FieldMovementPattern : MovementPattern { + + [SerializeField] + private DanmakuField field; + + [System.Serializable] + public class AtomicMovement { + [SerializeField] + private float time; + public float Time { + get { + return time; + } + set { + time = value; + } + } + + [SerializeField] + private Vector2 targetLocation; + [SerializeField] + private Vector2 curveControlPoint1; + [SerializeField] + private Vector2 curveControlPoint2; + + public Vector3 NextLocation(DanmakuField field, Vector3 startLocation) { + return Interpret (targetLocation, field, startLocation); + } + + public Vector3 NextControlPoint1(DanmakuField field, Vector3 startLocation) { + return Interpret (curveControlPoint1, field, startLocation); + } + + public Vector3 NextControlPoint2(DanmakuField field, Vector3 startLocation) { + return Interpret (curveControlPoint2, field, startLocation); + } + + private Vector3 Interpret(Vector2 loc, DanmakuField field, Vector3 startLocation) { + Vector3 nextLocation = loc; + return startLocation + (Vector3)field.WorldPoint(nextLocation, DanmakuField.CoordinateSystem.Relative); + } + } + + /// + /// The movements. + /// + public AtomicMovement[] movements; + + public override void Awake () { + base.Awake (); + if (field == null) { + field = Util.FindClosest(transform.position); + } + } + + /// + /// Move this instance. + /// + protected override IEnumerator Move() { + for(int i = 0; i < movements.Length; i++) { + if(movements[i] != null) { + float totalTime = movements[i].Time; + float t = 0f; + Vector3 startLocation = transform.position; + Vector3 targetLocation = movements[i].NextLocation(field, startLocation); + Vector3 control1 = movements[i].NextControlPoint1(field, startLocation); + Vector3 control2 = movements[i].NextControlPoint2(field, startLocation); + Vector3 oldPosition; + float dt = Util.TargetDeltaTime; + while(t < 1f) { + oldPosition = transform.position; + transform.position = Util.BerzierCurveVectorLerp(startLocation, targetLocation, control1, control2, t); + transform.rotation = Util.RotationBetween2D(oldPosition, transform.position); + yield return UtilCoroutines.WaitForUnpause(this); + t += dt / totalTime; + } + } + } + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/FieldMovementPattern.cs.meta b/Assets/External/DanmakuUnity2D/FieldMovementPattern.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/FieldMovementPattern.cs.meta rename to Assets/External/DanmakuUnity2D/FieldMovementPattern.cs.meta index a2776bcf..24b51dd7 100644 --- a/Assets/Plugins/DanmakuUnity2D/FieldMovementPattern.cs.meta +++ b/Assets/External/DanmakuUnity2D/FieldMovementPattern.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: dee9ff45363e5444aa984232ae1f2750 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: dee9ff45363e5444aa984232ae1f2750 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Materials.meta b/Assets/External/DanmakuUnity2D/Materials.meta similarity index 67% rename from Assets/Plugins/DanmakuUnity2D/Materials.meta rename to Assets/External/DanmakuUnity2D/Materials.meta index 12406819..f2e1c9f6 100644 --- a/Assets/Plugins/DanmakuUnity2D/Materials.meta +++ b/Assets/External/DanmakuUnity2D/Materials.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: c6dbe02d60cf5dd40a9a26cdb9b56174 +guid: f621bd0c51601034f9a6dd73ddd09fde folderAsset: yes -timeCreated: 1427611179 +timeCreated: 1427734773 licenseType: Free DefaultImporter: userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Materials/Bullet Material.mat b/Assets/External/DanmakuUnity2D/Materials/Bullet Material.mat similarity index 96% rename from Assets/Plugins/DanmakuUnity2D/Materials/Bullet Material.mat rename to Assets/External/DanmakuUnity2D/Materials/Bullet Material.mat index dfdc6bba..2ddcc562 100644 --- a/Assets/Plugins/DanmakuUnity2D/Materials/Bullet Material.mat +++ b/Assets/External/DanmakuUnity2D/Materials/Bullet Material.mat @@ -1,37 +1,37 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!21 &2100000 -Material: - serializedVersion: 5 - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_Name: Bullet Material - m_Shader: {fileID: 4800000, guid: 7be60fcf4914ded428c34d23f13bd834, type: 3} - m_ShaderKeywords: - m_LightmapFlags: 5 - m_CustomRenderQueue: -1 - m_SavedProperties: - serializedVersion: 2 - m_TexEnvs: - data: - first: - name: _MainTex - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Floats: {} - m_Colors: - data: - first: - name: _Color - second: {r: 1, g: 1, b: 1, a: 1} - data: - first: - name: _UpperColor - second: {r: 1, g: 1, b: 1, a: 1} - data: - first: - name: _LowerColor - second: {r: 0, g: 0, b: 0, a: 1} +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Bullet Material + m_Shader: {fileID: 4800000, guid: 7be60fcf4914ded428c34d23f13bd834, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 5 + m_CustomRenderQueue: -1 + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + data: + first: + name: _MainTex + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: {} + m_Colors: + data: + first: + name: _Color + second: {r: 1, g: 1, b: 1, a: 1} + data: + first: + name: _UpperColor + second: {r: 1, g: 1, b: 1, a: 1} + data: + first: + name: _LowerColor + second: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Plugins/DanmakuUnity2D/Materials/Bullet Material.mat.meta b/Assets/External/DanmakuUnity2D/Materials/Bullet Material.mat.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Materials/Bullet Material.mat.meta rename to Assets/External/DanmakuUnity2D/Materials/Bullet Material.mat.meta index 45e420fa..0e5728e6 100644 --- a/Assets/Plugins/DanmakuUnity2D/Materials/Bullet Material.mat.meta +++ b/Assets/External/DanmakuUnity2D/Materials/Bullet Material.mat.meta @@ -1,4 +1,4 @@ -fileFormatVersion: 2 -guid: 318bb75f28a02844f98c0bb8880684c2 -NativeFormatImporter: - userData: +fileFormatVersion: 2 +guid: 318bb75f28a02844f98c0bb8880684c2 +NativeFormatImporter: + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Materials/BulletShader.shader b/Assets/External/DanmakuUnity2D/Materials/BulletShader.shader similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Materials/BulletShader.shader rename to Assets/External/DanmakuUnity2D/Materials/BulletShader.shader index b702c474..6ad81074 100644 --- a/Assets/Plugins/DanmakuUnity2D/Materials/BulletShader.shader +++ b/Assets/External/DanmakuUnity2D/Materials/BulletShader.shader @@ -1,84 +1,84 @@ -Shader "Danmaku/Touhou Sprite" -{ - Properties - { - [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} - _UpperColor ("Upper Color", Color) = (1,1,1,1) - _LowerColor ("Lower Color", Color) = (-1,-1,-1,1) - } - - SubShader - { - Tags - { - "Queue"="Transparent" - "IgnoreProjector"="True" - "RenderType"="Transparent" - "PreviewType"="Plane" - "CanUseSpriteAtlas"="True" - } - - Cull Off - Lighting Off - ZWrite Off - Fog { Mode Off } - Blend SrcAlpha OneMinusSrcAlpha - - Pass - { - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma multi_compile DUMMY PIXELSNAP_ON - #include "UnityCG.cginc" - - struct appdata_t - { - float4 vertex : POSITION; - float4 color : COLOR; - float2 texcoord : TEXCOORD0; - }; - - struct v2f - { - float4 vertex : SV_POSITION; - fixed4 color : COLOR; - half2 texcoord : TEXCOORD0; - }; - - v2f vert(appdata_t IN) - { - v2f OUT; - OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex); - OUT.texcoord = IN.texcoord; - OUT.color = IN.color; - #ifdef PIXELSNAP_ON - OUT.vertex = UnityPixelSnap (OUT.vertex); - #endif - - return OUT; - } - - sampler2D _MainTex; - fixed4 _UpperColor; - fixed4 _LowerColor; - - fixed4 frag(v2f IN) : COLOR - { - fixed4 texColor = tex2D(_MainTex, IN.texcoord); - fixed greyScale = (texColor.r + texColor.g + texColor.b) / 3; - fixed4 a = (1, 1, 1, texColor.a * IN.color.a), b; - if(greyScale >= 0.5) - { - b = lerp(IN.color, _UpperColor, (greyScale - 0.5) * 2); - } - else - { - b = lerp(_LowerColor, IN.color, greyScale * 2); - } - return a*b; - } - ENDCG - } - } -} +Shader "Danmaku/Touhou Sprite" +{ + Properties + { + [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} + _UpperColor ("Upper Color", Color) = (1,1,1,1) + _LowerColor ("Lower Color", Color) = (-1,-1,-1,1) + } + + SubShader + { + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + "PreviewType"="Plane" + "CanUseSpriteAtlas"="True" + } + + Cull Off + Lighting Off + ZWrite Off + Fog { Mode Off } + Blend SrcAlpha OneMinusSrcAlpha + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile DUMMY PIXELSNAP_ON + #include "UnityCG.cginc" + + struct appdata_t + { + float4 vertex : POSITION; + float4 color : COLOR; + float2 texcoord : TEXCOORD0; + }; + + struct v2f + { + float4 vertex : SV_POSITION; + fixed4 color : COLOR; + half2 texcoord : TEXCOORD0; + }; + + v2f vert(appdata_t IN) + { + v2f OUT; + OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex); + OUT.texcoord = IN.texcoord; + OUT.color = IN.color; + #ifdef PIXELSNAP_ON + OUT.vertex = UnityPixelSnap (OUT.vertex); + #endif + + return OUT; + } + + sampler2D _MainTex; + fixed4 _UpperColor; + fixed4 _LowerColor; + + fixed4 frag(v2f IN) : COLOR + { + fixed4 texColor = tex2D(_MainTex, IN.texcoord); + fixed greyScale = (texColor.r + texColor.g + texColor.b) / 3; + fixed4 a = (1, 1, 1, texColor.a * IN.color.a), b; + if(greyScale >= 0.5) + { + b = lerp(IN.color, _UpperColor, (greyScale - 0.5) * 2); + } + else + { + b = lerp(_LowerColor, IN.color, greyScale * 2); + } + return a*b; + } + ENDCG + } + } +} diff --git a/Assets/Plugins/DanmakuUnity2D/Materials/BulletShader.shader.meta b/Assets/External/DanmakuUnity2D/Materials/BulletShader.shader.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Materials/BulletShader.shader.meta rename to Assets/External/DanmakuUnity2D/Materials/BulletShader.shader.meta index 8b0392b5..814bffe3 100644 --- a/Assets/Plugins/DanmakuUnity2D/Materials/BulletShader.shader.meta +++ b/Assets/External/DanmakuUnity2D/Materials/BulletShader.shader.meta @@ -1,5 +1,5 @@ -fileFormatVersion: 2 -guid: 7be60fcf4914ded428c34d23f13bd834 -ShaderImporter: - defaultTextures: [] - userData: +fileFormatVersion: 2 +guid: 7be60fcf4914ded428c34d23f13bd834 +ShaderImporter: + defaultTextures: [] + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Materials/Inverted Bullet Material.mat b/Assets/External/DanmakuUnity2D/Materials/Inverted Bullet Material.mat similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Materials/Inverted Bullet Material.mat rename to Assets/External/DanmakuUnity2D/Materials/Inverted Bullet Material.mat index a09f08e4..1e28db2e 100644 --- a/Assets/Plugins/DanmakuUnity2D/Materials/Inverted Bullet Material.mat +++ b/Assets/External/DanmakuUnity2D/Materials/Inverted Bullet Material.mat @@ -1,153 +1,153 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!21 &2100000 -Material: - serializedVersion: 5 - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_Name: Inverted Bullet Material - m_Shader: {fileID: 4800000, guid: 7be60fcf4914ded428c34d23f13bd834, type: 3} - m_ShaderKeywords: - m_LightmapFlags: 5 - m_CustomRenderQueue: -1 - m_SavedProperties: - serializedVersion: 2 - m_TexEnvs: - data: - first: - name: _MainTex - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - data: - first: - name: _BumpMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - data: - first: - name: _DetailNormalMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - data: - first: - name: _ParallaxMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - data: - first: - name: _OcclusionMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - data: - first: - name: _EmissionMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - data: - first: - name: _DetailMask - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - data: - first: - name: _DetailAlbedoMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - data: - first: - name: _MetallicGlossMap - second: - m_Texture: {fileID: 0} - m_Scale: {x: 1, y: 1} - m_Offset: {x: 0, y: 0} - m_Floats: - data: - first: - name: _Cutoff - second: .5 - data: - first: - name: _SrcBlend - second: 1 - data: - first: - name: _DstBlend - second: 0 - data: - first: - name: _Parallax - second: .0199999996 - data: - first: - name: _ZWrite - second: 1 - data: - first: - name: _Glossiness - second: .5 - data: - first: - name: _BumpScale - second: 1 - data: - first: - name: _OcclusionStrength - second: 1 - data: - first: - name: _DetailNormalMapScale - second: 1 - data: - first: - name: _UVSec - second: 0 - data: - first: - name: _EmissionScaleUI - second: 0 - data: - first: - name: _Mode - second: 0 - data: - first: - name: _Metallic - second: 0 - m_Colors: - data: - first: - name: _EmissionColor - second: {r: 0, g: 0, b: 0, a: 1} - data: - first: - name: _Color - second: {r: 1, g: 1, b: 1, a: 1} - data: - first: - name: _EmissionColorUI - second: {r: 1, g: 1, b: 1, a: 1} - data: - first: - name: _UpperColor - second: {r: 0, g: 0, b: 0, a: 1} - data: - first: - name: _LowerColor - second: {r: 1, g: 1, b: 1, a: 1} +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Inverted Bullet Material + m_Shader: {fileID: 4800000, guid: 7be60fcf4914ded428c34d23f13bd834, type: 3} + m_ShaderKeywords: + m_LightmapFlags: 5 + m_CustomRenderQueue: -1 + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + data: + first: + name: _MainTex + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _BumpMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailNormalMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _ParallaxMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _OcclusionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _EmissionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailMask + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _DetailAlbedoMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + data: + first: + name: _MetallicGlossMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + data: + first: + name: _Cutoff + second: .5 + data: + first: + name: _SrcBlend + second: 1 + data: + first: + name: _DstBlend + second: 0 + data: + first: + name: _Parallax + second: .0199999996 + data: + first: + name: _ZWrite + second: 1 + data: + first: + name: _Glossiness + second: .5 + data: + first: + name: _BumpScale + second: 1 + data: + first: + name: _OcclusionStrength + second: 1 + data: + first: + name: _DetailNormalMapScale + second: 1 + data: + first: + name: _UVSec + second: 0 + data: + first: + name: _EmissionScaleUI + second: 0 + data: + first: + name: _Mode + second: 0 + data: + first: + name: _Metallic + second: 0 + m_Colors: + data: + first: + name: _EmissionColor + second: {r: 0, g: 0, b: 0, a: 1} + data: + first: + name: _Color + second: {r: 1, g: 1, b: 1, a: 1} + data: + first: + name: _EmissionColorUI + second: {r: 1, g: 1, b: 1, a: 1} + data: + first: + name: _UpperColor + second: {r: 0, g: 0, b: 0, a: 1} + data: + first: + name: _LowerColor + second: {r: 1, g: 1, b: 1, a: 1} diff --git a/Assets/Plugins/DanmakuUnity2D/Materials/Inverted Bullet Material.mat.meta b/Assets/External/DanmakuUnity2D/Materials/Inverted Bullet Material.mat.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Materials/Inverted Bullet Material.mat.meta rename to Assets/External/DanmakuUnity2D/Materials/Inverted Bullet Material.mat.meta index 1a8e52d6..cd500108 100644 --- a/Assets/Plugins/DanmakuUnity2D/Materials/Inverted Bullet Material.mat.meta +++ b/Assets/External/DanmakuUnity2D/Materials/Inverted Bullet Material.mat.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 892d003777e2d554ab7eab24659dc633 -timeCreated: 1425745446 -licenseType: Free -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 892d003777e2d554ab7eab24659dc633 +timeCreated: 1425745446 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/NoScript.meta b/Assets/External/DanmakuUnity2D/NoScript.meta similarity index 67% rename from Assets/Plugins/DanmakuUnity2D/NoScript.meta rename to Assets/External/DanmakuUnity2D/NoScript.meta index d348976c..adbefce4 100644 --- a/Assets/Plugins/DanmakuUnity2D/NoScript.meta +++ b/Assets/External/DanmakuUnity2D/NoScript.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: b07c30a6f5a47af45ad67a5e84d09bb4 +guid: d9947f93c1071d848b089881e065f3c5 folderAsset: yes -timeCreated: 1427611179 +timeCreated: 1427734773 licenseType: Free DefaultImporter: userData: diff --git a/Assets/External/DanmakuUnity2D/NoScript/DanmakuEmitter.cs b/Assets/External/DanmakuUnity2D/NoScript/DanmakuEmitter.cs new file mode 100644 index 00000000..155ba6f5 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/DanmakuEmitter.cs @@ -0,0 +1,59 @@ +using UnityEngine; +using UnityUtilLib; +using System.Collections; +using Danmaku2D.NoScript; + +namespace Danmaku2D { + + public sealed class DanmakuEmitter : DanmakuTriggerReciever { + + [SerializeField] + private DanmakuSource[] sources; + + [SerializeField] + private FireBuilder fireData; + + [SerializeField] + private Modifier modifier; + + [SerializeField] + private ProjectileControlBehavior[] controllers; + + public FireModifier Modifier { + get { + if(modifier == null) + return null; + return modifier.WrappedModifier; + } + } + + public override void Trigger () { + Fire (); + } + + public void Fire() { + fireData.Controller = null; + for(int i = 0; i < controllers.Length; i++) + fireData.Controller += controllers[i].UpdateProjectile; + fireData.Modifier = Modifier; + for(int i = 0; i < sources.Length; i++) + sources[i].Fire (fireData); + } + + public void FireAtDanmaku(Danmaku danmaku) { + FireBuilder copy = fireData.Clone (); + copy.CoordinateSystem = DanmakuField.CoordinateSystem.World; + copy.Position = danmaku.Position; + copy.Rotation = danmaku.rotation; + danmaku.Field.Fire(copy); + } + + public void FireAtPoint(Vector2 position, DynamicFloat rotation, DanmakuField field) { + FireBuilder copy = fireData.Clone (); + copy.CoordinateSystem = DanmakuField.CoordinateSystem.World; + copy.Position = position; + copy.Rotation = rotation; + field.Fire (copy); + } + } +} \ No newline at end of file diff --git a/Assets/External/DanmakuUnity2D/NoScript/DanmakuEmitter.cs.meta b/Assets/External/DanmakuUnity2D/NoScript/DanmakuEmitter.cs.meta new file mode 100644 index 00000000..7a75546a --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/DanmakuEmitter.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0c4e4f002f1792f4aa4bab53b9200ea7 +timeCreated: 1427666752 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/NoScript/ProjectileSource.cs b/Assets/External/DanmakuUnity2D/NoScript/DanmakuSource.cs similarity index 83% rename from Assets/Plugins/DanmakuUnity2D/NoScript/ProjectileSource.cs rename to Assets/External/DanmakuUnity2D/NoScript/DanmakuSource.cs index e08490a4..d97ddc90 100644 --- a/Assets/Plugins/DanmakuUnity2D/NoScript/ProjectileSource.cs +++ b/Assets/External/DanmakuUnity2D/NoScript/DanmakuSource.cs @@ -6,24 +6,24 @@ namespace Danmaku2D { public class SourcePoint { public Vector2 Position; - public float BaseRotation; + public DynamicFloat BaseRotation; - public SourcePoint(Vector2 location, float rotation) { + public SourcePoint(Vector2 location, DynamicFloat rotation) { this.Position = location; this.BaseRotation = rotation; } } - public abstract class ProjectileSource : CachedObject { + public abstract class DanmakuSource : CachedObject { - public ProjectileSource subSource; + public DanmakuSource subSource; [System.NonSerialized] public DanmakuField TargetField; protected List sourcePoints; - protected void UpdatePoints(Vector2 position, float rotation) { + protected void UpdatePoints(Vector2 position, DynamicFloat rotation) { UpdateSourcePoints(position, rotation); float sourceRotation; if (subSource != null) { @@ -67,16 +67,20 @@ public SourcePoint[] SourcePoints { } } - public void Fire(ProjectilePrefab prefab, - float velocity, - float rotationOffset = 0, - float angularVelocity = 0, - ProjectileController controller = null, + public void Fire(DanmakuPrefab prefab, + DynamicFloat velocity, + DynamicFloat rotationOffset = null, + DynamicFloat angularVelocity = null, + DanmakuController controller = null, FireModifier modifier = null) { if(TargetField == null) { Debug.LogWarning("Firing from a Projectile Source without a Target Field"); return; } + if (rotationOffset == null) + rotationOffset = 0f; + if (angularVelocity == null) + angularVelocity = 0f; for (int i = 0; i < sourcePoints.Count; i++) { SourcePoint source = sourcePoints[i]; TargetField.FireCurved (prefab, @@ -94,11 +98,9 @@ public void Fire(FireBuilder data) { Debug.LogWarning("Firing from a Projectile Source without a Target Field"); return; } - ProjectileController controller = data.Controller; FireBuilder copy = data.Clone (); - float rotationOffset = data.Rotation; + DynamicFloat rotationOffset = data.Rotation; copy.CoordinateSystem = DanmakuField.CoordinateSystem.World; - copy.Controller = controller; for (int i = 0; i < sourcePoints.Count; i++) { SourcePoint source = sourcePoints[i]; copy.Position = source.Position; diff --git a/Assets/External/DanmakuUnity2D/NoScript/DanmakuSource.cs.meta b/Assets/External/DanmakuUnity2D/NoScript/DanmakuSource.cs.meta new file mode 100644 index 00000000..66cf3d11 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/DanmakuSource.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3c6e261a30283454d91c200c75646e51 +timeCreated: 1427666752 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/DanmakuUnity2D/NoScript/DanmakuTrigger.cs b/Assets/External/DanmakuUnity2D/NoScript/DanmakuTrigger.cs new file mode 100644 index 00000000..481ad1d7 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/DanmakuTrigger.cs @@ -0,0 +1,46 @@ +using UnityEngine; +using System.Collections; +using UnityUtilLib; + +namespace Danmaku2D { + + public abstract class DanmakuTriggerReciever : CachedObject { + + [SerializeField] + private DanmakuTrigger[] triggers; + + public override void Awake () { + base.Awake (); + for(int i = 0; i < triggers.Length; i++) { + if(triggers[i] != null) { + triggers[i].Trigger += Trigger; + } + } + } + + public void OnDestroy() { + for(int i = 0; i < triggers.Length; i++) { + if(triggers[i] != null) { + triggers[i].Trigger -= Trigger; + } + } + } + + public abstract void Trigger (); + } + + + public abstract class DanmakuTrigger : CachedObject { + + public delegate void TriggerCallback (); + + internal TriggerCallback Trigger; + + public void FireTrigger() { + if(Trigger != null) + Trigger(); + } + + } + +} diff --git a/Assets/External/DanmakuUnity2D/NoScript/DanmakuTrigger.cs.meta b/Assets/External/DanmakuUnity2D/NoScript/DanmakuTrigger.cs.meta new file mode 100644 index 00000000..74fc1d11 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/DanmakuTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3778c513a7ca3274b8811684ea29874b +timeCreated: 1427666183 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Modifiers/FireModifier.cs b/Assets/External/DanmakuUnity2D/NoScript/FireModifier.cs similarity index 80% rename from Assets/Plugins/DanmakuUnity2D/Modifiers/FireModifier.cs rename to Assets/External/DanmakuUnity2D/NoScript/FireModifier.cs index d4de8d7e..21593603 100644 --- a/Assets/Plugins/DanmakuUnity2D/Modifiers/FireModifier.cs +++ b/Assets/External/DanmakuUnity2D/NoScript/FireModifier.cs @@ -1,5 +1,6 @@ -using UnityEngine; +using UnityEngine; using System.Collections; +using UnityUtilLib; namespace Danmaku2D { @@ -9,7 +10,7 @@ public abstract class FireModifier { private FireModifier subModifier; private FireBuilder builder; - protected float Velocity { + protected DynamicFloat Velocity { get { return builder.Velocity; } @@ -21,7 +22,7 @@ protected float Velocity { } } - protected float AngularVelocity { + protected DynamicFloat AngularVelocity { get { return builder.AngularVelocity; } @@ -38,19 +39,19 @@ protected DanmakuField TargetField { private set; } - protected ProjectileController Controller { + protected DanmakuController Controller { get { return builder.Controller; } } - protected ProjectilePrefab BulletType { + protected DanmakuPrefab BulletType { get { return builder.Prefab; } } - protected ProjectileGroup Group { + protected DanmakuGroup Group { get { return builder.Group; } @@ -67,12 +68,12 @@ public FireModifier SubModifier { } } - internal void Initialize(ProjectilePrefab prefab, + internal void Initialize(DanmakuPrefab prefab, float velocity, float angularVelocity, DanmakuField field, - ProjectileController controller, - ProjectileGroup group) { + DanmakuController controller, + DanmakuGroup group) { TargetField = field; builder = new FireBuilder (prefab); builder.Velocity = velocity; @@ -99,7 +100,7 @@ protected virtual void OnInitialize() { } protected void FireSingle(Vector2 position, - float rotation) { + DynamicFloat rotation) { if (SubModifier == null) { builder.Position = position; builder.Rotation = rotation; @@ -109,7 +110,7 @@ protected void FireSingle(Vector2 position, } } - public abstract void Fire(Vector2 position, float rotation); + public abstract void Fire(Vector2 position, DynamicFloat rotation); } } diff --git a/Assets/Plugins/DanmakuUnity2D/Modifiers/FireModifier.cs.meta b/Assets/External/DanmakuUnity2D/NoScript/FireModifier.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Modifiers/FireModifier.cs.meta rename to Assets/External/DanmakuUnity2D/NoScript/FireModifier.cs.meta index 0b7a0b7a..c8b1b4e5 100644 --- a/Assets/Plugins/DanmakuUnity2D/Modifiers/FireModifier.cs.meta +++ b/Assets/External/DanmakuUnity2D/NoScript/FireModifier.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 2eb53223a7da19c4d93add4bcd44cd1c -timeCreated: 1427573355 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 2eb53223a7da19c4d93add4bcd44cd1c +timeCreated: 1427573355 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/DanmakuUnity2D/NoScript/Modifier.cs b/Assets/External/DanmakuUnity2D/NoScript/Modifier.cs new file mode 100644 index 00000000..75546dae --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Modifier.cs @@ -0,0 +1,47 @@ +using UnityEngine; +using System.Collections; +using UnityUtilLib; + +namespace Danmaku2D { + + public abstract class Modifier : CachedObject { + + public abstract FireModifier WrappedModifier { + get; + } + + } + + public abstract class ModifierWrapper : Modifier where T : FireModifier { + + [SerializeField] + private T modifier; + + public override FireModifier WrappedModifier { + get { + return modifier; + } + } + + [SerializeField] + private Modifier subModifier; + + public Modifier SubModifier { + get { + return subModifier; + } + set { + subModifier = value; + if(subModifier != null) + modifier.SubModifier = subModifier.WrappedModifier; + } + } + + public override void Awake() { + base.Awake (); + if(subModifier != null) + modifier.SubModifier = subModifier.WrappedModifier; + } + + } +} diff --git a/Assets/External/DanmakuUnity2D/NoScript/Modifier.cs.meta b/Assets/External/DanmakuUnity2D/NoScript/Modifier.cs.meta new file mode 100644 index 00000000..56d0a314 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Modifier.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 50e5a0d83526a0944972702177728a1d +timeCreated: 1427667579 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Modifiers.meta b/Assets/External/DanmakuUnity2D/NoScript/Modifiers.meta similarity index 67% rename from Assets/Plugins/DanmakuUnity2D/Modifiers.meta rename to Assets/External/DanmakuUnity2D/NoScript/Modifiers.meta index ee4c452b..9c26fe88 100644 --- a/Assets/Plugins/DanmakuUnity2D/Modifiers.meta +++ b/Assets/External/DanmakuUnity2D/NoScript/Modifiers.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 972d0850edaf79f4dbc464e350c92281 +guid: b39749b8e6dd2ca44aca59f44dd76e11 folderAsset: yes -timeCreated: 1427611179 +timeCreated: 1427734773 licenseType: Free DefaultImporter: userData: diff --git a/Assets/External/DanmakuUnity2D/NoScript/Modifiers/BurstModifier.cs b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/BurstModifier.cs new file mode 100644 index 00000000..5895b950 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/BurstModifier.cs @@ -0,0 +1,47 @@ +using UnityEngine; +using System.Collections; +using UnityUtilLib; + +namespace Danmaku2D { + + [System.Serializable] + public class BurstModifier : FireModifier { + + public DynamicFloat Range = 360f; + public DynamicInt Count = 1; + public DynamicFloat DeltaVelocity = 0f; + public DynamicFloat DeltaAngularVelocity = 0f; + + #region implemented abstract members of FireModifier + + public override void Fire (Vector2 position, DynamicFloat rotation) { + + int count = Count.Value; + float range = Range.Value; + float deltaV = DeltaVelocity.Value; + float deltaAV = DeltaAngularVelocity.Value; + + count = Mathf.Abs (count); + + float start = rotation - range * 0.5f; + float delta = range / (count - 1); + + for (int i = 0; i < count; i++) { + Velocity += deltaV; + AngularVelocity += deltaAV; + FireSingle(position, start + i * delta); + } + + } + + #endregion + + } + + namespace Wrapper { + + public class BurstModifier : ModifierWrapper { + } + + } +} diff --git a/Assets/Plugins/DanmakuUnity2D/Modifiers/BurstModifier.cs.meta b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/BurstModifier.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Modifiers/BurstModifier.cs.meta rename to Assets/External/DanmakuUnity2D/NoScript/Modifiers/BurstModifier.cs.meta index b217891d..882fae98 100644 --- a/Assets/Plugins/DanmakuUnity2D/Modifiers/BurstModifier.cs.meta +++ b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/BurstModifier.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: f8382d8a36abd6d469c9041d84c0b902 -timeCreated: 1427574314 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: f8382d8a36abd6d469c9041d84c0b902 +timeCreated: 1427574314 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/DanmakuUnity2D/NoScript/Modifiers/LineModifier.cs b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/LineModifier.cs new file mode 100644 index 00000000..76e6d13d --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/LineModifier.cs @@ -0,0 +1,34 @@ +using UnityEngine; +using UnityUtilLib; + +namespace Danmaku2D { + + [System.Serializable] + public class LineModifier : FireModifier { + + public DynamicInt Depth = 1; + public DynamicFloat DeltaVelocity = 0f; + public DynamicFloat DeltaAngularVelocity = 0f; + + #region implemented abstract members of FireModifier + public override void Fire (Vector2 position, DynamicFloat rotation) { + float deltaV = DeltaVelocity.Value; + float deltaAV = DeltaAngularVelocity.Value; + float depth = Depth.Value; + for(int i = 0; i < depth; i++) { + Velocity += deltaV; + AngularVelocity += deltaAV; + FireSingle(position, rotation); + } + + } + #endregion + } + + namespace Wrapper { + + internal class LineModifier : ModifierWrapper { + } + + } +} diff --git a/Assets/Plugins/DanmakuUnity2D/Modifiers/LineModifier.cs.meta b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/LineModifier.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Modifiers/LineModifier.cs.meta rename to Assets/External/DanmakuUnity2D/NoScript/Modifiers/LineModifier.cs.meta index b185374b..67ddcc98 100644 --- a/Assets/Plugins/DanmakuUnity2D/Modifiers/LineModifier.cs.meta +++ b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/LineModifier.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 66470c1d5d64b354a872bbb086e6aedd -timeCreated: 1427575454 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 66470c1d5d64b354a872bbb086e6aedd +timeCreated: 1427575454 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeAngleModifier.cs b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeAngleModifier.cs new file mode 100644 index 00000000..8f815e85 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeAngleModifier.cs @@ -0,0 +1,28 @@ +using UnityEngine; +using UnityUtilLib; + +namespace Danmaku2D { + + [System.Serializable] + public class RandomizeAngleModifier : FireModifier { + + [SerializeField, Range(0f, 360f)] + private DynamicFloat range = 0; + + #region implemented abstract members of FireModifier + public override void Fire (Vector2 position, DynamicFloat rotation) { + float rotationValue = rotation.Value; + float rangeValue = range.Value; + FireSingle (position, Random.Range (rotationValue - 0.5f * rangeValue, rotationValue + 0.5f * rangeValue)); + } + #endregion + + } + + namespace Wrapper { + + internal class RandomizeAngleModifier : ModifierWrapper { + } + + } +} \ No newline at end of file diff --git a/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeAngleModifier.cs.meta b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeAngleModifier.cs.meta new file mode 100644 index 00000000..a72ea3b5 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeAngleModifier.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 05f36c0d20f211a4988f9339d5e2690f +timeCreated: 1427668542 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeAngularVelocityModifier.cs b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeAngularVelocityModifier.cs new file mode 100644 index 00000000..6feda2c4 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeAngularVelocityModifier.cs @@ -0,0 +1,31 @@ +using UnityEngine; +using UnityUtilLib; + +namespace Danmaku2D { + + [System.Serializable] + public class RandomizeAngularVelocityModifier : FireModifier { + + [SerializeField] + private DynamicFloat range = 0; + + #region implemented abstract members of FireModifier + public override void Fire (Vector2 position, DynamicFloat rotation) { + float oldAV = AngularVelocity; + float rangeValue = range.Value; + AngularVelocity = oldAV + Random.Range (-0.5f * rangeValue, 0.5f * rangeValue); + FireSingle (position, rotation); + AngularVelocity = oldAV; + } + #endregion + + } + + namespace Wrapper { + + internal class RandomizeAngularVelocityModifier : ModifierWrapper { + } + + } + +} \ No newline at end of file diff --git a/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeAngularVelocityModifier.cs.meta b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeAngularVelocityModifier.cs.meta new file mode 100644 index 00000000..91b89b98 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeAngularVelocityModifier.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 4b49d6442a2154345a44a322d90ff583 +timeCreated: 1427669252 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeVelocityModifier.cs b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeVelocityModifier.cs new file mode 100644 index 00000000..a8ddd8e8 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeVelocityModifier.cs @@ -0,0 +1,31 @@ +using UnityEngine; +using UnityUtilLib; + +namespace Danmaku2D { + + [System.Serializable] + public class RandomizeVelocityModifier : FireModifier { + + [SerializeField] + private DynamicFloat range = 0; + + #region implemented abstract members of FireModifier + public override void Fire (Vector2 position, DynamicFloat rotation) { + float oldVelocity = Velocity; + float rangeValue = range.Value; + Velocity = oldVelocity + Random.Range (-0.5f * rangeValue, 0.5f * rangeValue); + FireSingle (position, rotation); + Velocity = oldVelocity; + } + #endregion + + } + + namespace Wrapper { + + internal class RandomizeVelocityModifier : ModifierWrapper { + } + + } + +} diff --git a/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeVelocityModifier.cs.meta b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeVelocityModifier.cs.meta new file mode 100644 index 00000000..0f9953dc --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Modifiers/RandomizeVelocityModifier.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8a62219bf8d6e0b4a8dc36163aa2ef66 +timeCreated: 1427668916 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/NoScript/Sources.meta b/Assets/External/DanmakuUnity2D/NoScript/Sources.meta similarity index 67% rename from Assets/Plugins/DanmakuUnity2D/NoScript/Sources.meta rename to Assets/External/DanmakuUnity2D/NoScript/Sources.meta index 5661e2e8..48ce092c 100644 --- a/Assets/Plugins/DanmakuUnity2D/NoScript/Sources.meta +++ b/Assets/External/DanmakuUnity2D/NoScript/Sources.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: d69209afcc5b66248bbb5df3e632c490 +guid: f009efb33a22a1c4194f1132cbebd59d folderAsset: yes -timeCreated: 1427611179 +timeCreated: 1427734773 licenseType: Free DefaultImporter: userData: diff --git a/Assets/Plugins/DanmakuUnity2D/NoScript/Sources/CircleSource.cs b/Assets/External/DanmakuUnity2D/NoScript/Sources/CircleSource.cs similarity index 91% rename from Assets/Plugins/DanmakuUnity2D/NoScript/Sources/CircleSource.cs rename to Assets/External/DanmakuUnity2D/NoScript/Sources/CircleSource.cs index ff686ed8..8b7f7f42 100644 --- a/Assets/Plugins/DanmakuUnity2D/NoScript/Sources/CircleSource.cs +++ b/Assets/External/DanmakuUnity2D/NoScript/Sources/CircleSource.cs @@ -1,30 +1,30 @@ -using UnityEngine; -using System.Collections; -using UnityUtilLib; - -namespace Danmaku2D.NoScript { - - internal class CircleSource : ProjectileSource { - - #pragma warning disable 0649 - public int count; - public float radius; - public bool raidalDirection; - #pragma warning restore 0649 - - #region implemented abstract members of ProjectileSource - - protected override void UpdateSourcePoints (Vector2 position, float rotation) { - sourcePoints.Clear (); - float delta = Util.TwoPI / count; - for (int i = 0; i < count; i++) { - float currentRotation = Util.Degree2Rad * rotation + i * delta; - SourcePoint sourcePoint = new SourcePoint(position + radius * Util.OnUnitCircleRadians(currentRotation), - ((raidalDirection) ? Util.Rad2Degree * currentRotation - 90f : rotation)); - sourcePoints.Add(sourcePoint); - } - } - - #endregion - } +using UnityEngine; +using System.Collections; +using UnityUtilLib; + +namespace Danmaku2D.NoScript { + + internal class CircleSource : DanmakuSource { + + #pragma warning disable 0649 + public int count; + public float radius; + public bool raidalDirection; + #pragma warning restore 0649 + + #region implemented abstract members of ProjectileSource + + protected override void UpdateSourcePoints (Vector2 position, float rotation) { + sourcePoints.Clear (); + float delta = Util.TwoPI / count; + for (int i = 0; i < count; i++) { + float currentRotation = Util.Degree2Rad * rotation + i * delta; + SourcePoint sourcePoint = new SourcePoint(position + radius * Util.OnUnitCircleRadians(currentRotation), + ((raidalDirection) ? Util.Rad2Degree * currentRotation - 90f : rotation)); + sourcePoints.Add(sourcePoint); + } + } + + #endregion + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/NoScript/Sources/CircleSource.cs.meta b/Assets/External/DanmakuUnity2D/NoScript/Sources/CircleSource.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/NoScript/Sources/CircleSource.cs.meta rename to Assets/External/DanmakuUnity2D/NoScript/Sources/CircleSource.cs.meta index 134d3b7a..6d2f7131 100644 --- a/Assets/Plugins/DanmakuUnity2D/NoScript/Sources/CircleSource.cs.meta +++ b/Assets/External/DanmakuUnity2D/NoScript/Sources/CircleSource.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 7045342c126352a4e822079d6d80f3fd -timeCreated: 1427127259 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 7045342c126352a4e822079d6d80f3fd +timeCreated: 1427127259 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/NoScript/Sources/PointSource.cs b/Assets/External/DanmakuUnity2D/NoScript/Sources/PointSource.cs similarity index 89% rename from Assets/Plugins/DanmakuUnity2D/NoScript/Sources/PointSource.cs rename to Assets/External/DanmakuUnity2D/NoScript/Sources/PointSource.cs index 089b88e1..99c5a51d 100644 --- a/Assets/Plugins/DanmakuUnity2D/NoScript/Sources/PointSource.cs +++ b/Assets/External/DanmakuUnity2D/NoScript/Sources/PointSource.cs @@ -1,27 +1,27 @@ -using UnityEngine; -using System.Collections.Generic; - -namespace Danmaku2D.NoScript { - - internal class PointSource : ProjectileSource { - - #region implemented abstract members of ProjectileSource - - protected override void UpdateSourcePoints (Vector2 position, float rotation) { - if (sourcePoints.Count <= 0 || sourcePoints.Count > 1) { - sourcePoints.Clear(); - sourcePoints.Add(new SourcePoint(position, rotation)); - Debug.Log(sourcePoints.Count); - } - if(sourcePoints[0] == null) { - sourcePoints[0] = new SourcePoint(position, rotation); - } - sourcePoints [0].Position = position; - sourcePoints [0].BaseRotation = rotation; - } - - #endregion - - } - -} +using UnityEngine; +using System.Collections.Generic; + +namespace Danmaku2D.NoScript { + + internal class PointSource : DanmakuSource { + + #region implemented abstract members of ProjectileSource + + protected override void UpdateSourcePoints (Vector2 position, float rotation) { + if (sourcePoints.Count <= 0 || sourcePoints.Count > 1) { + sourcePoints.Clear(); + sourcePoints.Add(new SourcePoint(position, rotation)); + Debug.Log(sourcePoints.Count); + } + if(sourcePoints[0] == null) { + sourcePoints[0] = new SourcePoint(position, rotation); + } + sourcePoints [0].Position = position; + sourcePoints [0].BaseRotation = rotation; + } + + #endregion + + } + +} diff --git a/Assets/Plugins/DanmakuUnity2D/NoScript/Sources/PointSource.cs.meta b/Assets/External/DanmakuUnity2D/NoScript/Sources/PointSource.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/NoScript/Sources/PointSource.cs.meta rename to Assets/External/DanmakuUnity2D/NoScript/Sources/PointSource.cs.meta index e4e0e407..aaca73bd 100644 --- a/Assets/Plugins/DanmakuUnity2D/NoScript/Sources/PointSource.cs.meta +++ b/Assets/External/DanmakuUnity2D/NoScript/Sources/PointSource.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 172d150a45fe41040a0db77aa245b44b -timeCreated: 1427120967 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 172d150a45fe41040a0db77aa245b44b +timeCreated: 1427120967 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/DanmakuUnity2D/NoScript/Sources/PolygonSource.cs b/Assets/External/DanmakuUnity2D/NoScript/Sources/PolygonSource.cs new file mode 100644 index 00000000..ad2cb67f --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Sources/PolygonSource.cs @@ -0,0 +1,15 @@ +using UnityEngine; +using System.Collections; + +public class PolygonSource : MonoBehaviour { + + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update () { + + } +} diff --git a/Assets/External/DanmakuUnity2D/NoScript/Sources/PolygonSource.cs.meta b/Assets/External/DanmakuUnity2D/NoScript/Sources/PolygonSource.cs.meta new file mode 100644 index 00000000..b532dbf2 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Sources/PolygonSource.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 13223993818f07f45bd2acba3df6658a +timeCreated: 1427669443 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/DanmakuUnity2D/NoScript/Triggers.meta b/Assets/External/DanmakuUnity2D/NoScript/Triggers.meta new file mode 100644 index 00000000..df772a45 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Triggers.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d0f9fdc11157a2a4aae40d00c3c159b7 +folderAsset: yes +timeCreated: 1427734773 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/DanmakuUnity2D/NoScript/Triggers/ColliderTrigger.cs b/Assets/External/DanmakuUnity2D/NoScript/Triggers/ColliderTrigger.cs new file mode 100644 index 00000000..5b66c660 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Triggers/ColliderTrigger.cs @@ -0,0 +1,30 @@ +using UnityEngine; +using System.Collections.Generic; + +namespace Danmaku2D { + + public class ColliderTrigger : DanmakuTrigger { + + [SerializeField] + private string[] tagFilter; + + void OnCollisionEnter2D(Collision2D collision) { + TriggerCheck (collision.gameObject); + } + + void OnTriggerEnter2D(Collider2D other) { + TriggerCheck (other.gameObject); + } + + void TriggerCheck(GameObject gameObject) { + for(int i = 0; i < tagFilter.Length; i++) { + if(gameObject.CompareTag(tagFilter[i])) { + FireTrigger(); + break; + } + } + } + + } + +} diff --git a/Assets/External/DanmakuUnity2D/NoScript/Triggers/ColliderTrigger.cs.meta b/Assets/External/DanmakuUnity2D/NoScript/Triggers/ColliderTrigger.cs.meta new file mode 100644 index 00000000..3ddc8aa5 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Triggers/ColliderTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 650164fd1284a9f41a498d6c338671a0 +timeCreated: 1427677898 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/DanmakuUnity2D/NoScript/Triggers/ProjectileColliderTrigger.cs b/Assets/External/DanmakuUnity2D/NoScript/Triggers/ProjectileColliderTrigger.cs new file mode 100644 index 00000000..00d6c54c --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Triggers/ProjectileColliderTrigger.cs @@ -0,0 +1,27 @@ +using UnityEngine; +using System.Collections.Generic; + +namespace Danmaku2D { + + [RequireComponent(typeof(Collider2D))] + public class ProjectileColliderTrigger : DanmakuTrigger, IDanmakuCollider { + + [SerializeField] + private List tagFilter; + + #region IDanmakuCollider implementation + public void OnProjectileCollision (Danmaku proj) { + for(int i = 0; i < tagFilter.Count; i++) { + if(proj.CompareTag(tagFilter[i])) { + FireTrigger(); + break; + } + } + } + #endregion + + + + + } +} diff --git a/Assets/External/DanmakuUnity2D/NoScript/Triggers/ProjectileColliderTrigger.cs.meta b/Assets/External/DanmakuUnity2D/NoScript/Triggers/ProjectileColliderTrigger.cs.meta new file mode 100644 index 00000000..5e63e8e3 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Triggers/ProjectileColliderTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0b3284331956b61429ad4b64a7a8ac8d +timeCreated: 1427677888 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/External/DanmakuUnity2D/NoScript/Triggers/TimedTrigger.cs b/Assets/External/DanmakuUnity2D/NoScript/Triggers/TimedTrigger.cs new file mode 100644 index 00000000..94b21cb4 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Triggers/TimedTrigger.cs @@ -0,0 +1,29 @@ +using UnityEngine; +using System.Collections; +using UnityUtilLib; + +namespace Danmaku2D { + + public class TimedTrigger : DanmakuTrigger, IPausable { + + #region IPausable implementation + public bool Paused { + get; + set; + } + #endregion + + [SerializeField] + private FrameCounter delay; + + public void Update() { + if(!Paused) { + if(delay.Tick()) { + FireTrigger(); + } + } + } + + } + +} diff --git a/Assets/External/DanmakuUnity2D/NoScript/Triggers/TimedTrigger.cs.meta b/Assets/External/DanmakuUnity2D/NoScript/Triggers/TimedTrigger.cs.meta new file mode 100644 index 00000000..8c4bcda7 --- /dev/null +++ b/Assets/External/DanmakuUnity2D/NoScript/Triggers/TimedTrigger.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: dfdecd5616104c845ba3f36d424dc9d8 +timeCreated: 1427666476 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria.meta b/Assets/External/DanmakuUnity2D/Phantasmagoria.meta similarity index 67% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria.meta rename to Assets/External/DanmakuUnity2D/Phantasmagoria.meta index 7e920f3f..68c2ea43 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria.meta +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 9d0662f6d910813478af147c5ccf2f45 +guid: c1e72b021b17c5d43bac2203d70d3f8b folderAsset: yes -timeCreated: 1427611179 +timeCreated: 1427734773 licenseType: Free DefaultImporter: userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/BulletTransferArea.cs b/Assets/External/DanmakuUnity2D/Phantasmagoria/BulletTransferArea.cs similarity index 97% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/BulletTransferArea.cs rename to Assets/External/DanmakuUnity2D/Phantasmagoria/BulletTransferArea.cs index 0fa90019..43526eb5 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/BulletTransferArea.cs +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/BulletTransferArea.cs @@ -1,36 +1,36 @@ -using UnityEngine; -using UnityUtilLib; -using System.Collections; - -namespace Danmaku2D.Phantasmagoria { - - [DisallowMultipleComponent] - [RequireComponent(typeof(ProjectileTransferBoundary))] - [RequireComponent(typeof(Collider2D))] - public class BulletTransferArea : PausableGameObject { - - public void Run(float duration, float maxScale, DanmakuField origin) { - ProjectileTransferBoundary ptb = GetComponent (); - ptb.Field = origin; - StartCoroutine (Execute (duration, maxScale)); - } - - private IEnumerator Execute(float duration, float maxScale) { - SpriteRenderer rend = GetComponent (); - Vector3 maxScaleV = Vector3.one * maxScale; - Vector3 startScale = transform.localScale; - Color spriteColor = rend.color; - Color targetColor = spriteColor; - targetColor.a = 0; - float dt = Util.TargetDeltaTime; - float t = 0; - while (t < 1f) { - transform.localScale = Vector3.Lerp(startScale, maxScaleV, t); - rend.color = Color.Lerp(spriteColor, targetColor, t); - yield return UtilCoroutines.WaitForUnpause(this); - t += dt / duration; - } - Destroy (gameObject); - } - } +using UnityEngine; +using UnityUtilLib; +using System.Collections; + +namespace Danmaku2D.Phantasmagoria { + + [DisallowMultipleComponent] + [RequireComponent(typeof(ProjectileTransferBoundary))] + [RequireComponent(typeof(Collider2D))] + public class BulletTransferArea : PausableGameObject { + + public void Run(float duration, float maxScale, DanmakuField origin) { + ProjectileTransferBoundary ptb = GetComponent (); + ptb.Field = origin; + StartCoroutine (Execute (duration, maxScale)); + } + + private IEnumerator Execute(float duration, float maxScale) { + SpriteRenderer rend = GetComponent (); + Vector3 maxScaleV = Vector3.one * maxScale; + Vector3 startScale = transform.localScale; + Color spriteColor = rend.color; + Color targetColor = spriteColor; + targetColor.a = 0; + float dt = Util.TargetDeltaTime; + float t = 0; + while (t < 1f) { + transform.localScale = Vector3.Lerp(startScale, maxScaleV, t); + rend.color = Color.Lerp(spriteColor, targetColor, t); + yield return UtilCoroutines.WaitForUnpause(this); + t += dt / duration; + } + Destroy (gameObject); + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/BulletTransferArea.cs.meta b/Assets/External/DanmakuUnity2D/Phantasmagoria/BulletTransferArea.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/BulletTransferArea.cs.meta rename to Assets/External/DanmakuUnity2D/Phantasmagoria/BulletTransferArea.cs.meta index d3701315..2563b29e 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/BulletTransferArea.cs.meta +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/BulletTransferArea.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 3e84a3f53a1e09f4f97820601275257b -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: 3e84a3f53a1e09f4f97820601275257b +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI.meta b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI.meta similarity index 67% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI.meta rename to Assets/External/DanmakuUnity2D/Phantasmagoria/GUI.meta index 00885ca4..0147aab4 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI.meta +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: c16b88c981971484f8c9d4c8130d68eb +guid: 80070fe8814c0784e81bb9f7cc288adb folderAsset: yes -timeCreated: 1427611179 +timeCreated: 1427734773 licenseType: Free DefaultImporter: userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/ChargeBarGUI.cs b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/ChargeBarGUI.cs similarity index 96% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/ChargeBarGUI.cs rename to Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/ChargeBarGUI.cs index de3c62ec..e9a8fae0 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/ChargeBarGUI.cs +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/ChargeBarGUI.cs @@ -1,47 +1,47 @@ -using UnityEngine; -using System.Collections; -using Danmaku2D.Phantasmagoria; -using UnityUtilLib; - -namespace Danmaku2D.Phantasmagoria.GUI { - - public class ChargeBarGUI : MonoBehaviour { - - [SerializeField] - private DanmakuField field; - private PhantasmagoriaPlayableCharacter player; - - [SerializeField] - private Transform chargeCapacity; - - [SerializeField] - private Transform chargeLevel; - - [SerializeField] - private GameObject indicator; - - void Start() { - player = (PhantasmagoriaPlayableCharacter)field.Player; - int maxIndicatorLevel = player.MaxChargeLevel - 1; - float inc = 0.5f / (float)player.MaxChargeLevel; - Vector3 ls = indicator.transform.localScale; - for(int i = -maxIndicatorLevel; i <= maxIndicatorLevel; i++) { - if(i != 0) { - GameObject newIndicator = (GameObject)Instantiate(indicator); - newIndicator.transform.parent = transform; - newIndicator.transform.localPosition = Vector3.right * inc * i + Vector3.forward * indicator.transform.localPosition.z; - newIndicator.transform.localScale = new Vector3(ls.x / 2f, ls.y, ls.z); - } - } - } - - void Update () { - Vector3 capacityScale = chargeCapacity.localScale; - Vector3 levelScale = chargeCapacity.localScale; - capacityScale.x = player.CurrentChargeCapacity / (float)player.MaxChargeLevel; - levelScale.x = player.CurrentChargeLevel / (float)player.MaxChargeLevel; - chargeCapacity.localScale = capacityScale; - chargeLevel.localScale = levelScale; - } - } +using UnityEngine; +using System.Collections; +using Danmaku2D.Phantasmagoria; +using UnityUtilLib; + +namespace Danmaku2D.Phantasmagoria.GUI { + + public class ChargeBarGUI : MonoBehaviour { + + [SerializeField] + private DanmakuField field; + private PhantasmagoriaPlayableCharacter player; + + [SerializeField] + private Transform chargeCapacity; + + [SerializeField] + private Transform chargeLevel; + + [SerializeField] + private GameObject indicator; + + void Start() { + player = (PhantasmagoriaPlayableCharacter)field.Player; + int maxIndicatorLevel = player.MaxChargeLevel - 1; + float inc = 0.5f / (float)player.MaxChargeLevel; + Vector3 ls = indicator.transform.localScale; + for(int i = -maxIndicatorLevel; i <= maxIndicatorLevel; i++) { + if(i != 0) { + GameObject newIndicator = (GameObject)Instantiate(indicator); + newIndicator.transform.parent = transform; + newIndicator.transform.localPosition = Vector3.right * inc * i + Vector3.forward * indicator.transform.localPosition.z; + newIndicator.transform.localScale = new Vector3(ls.x / 2f, ls.y, ls.z); + } + } + } + + void Update () { + Vector3 capacityScale = chargeCapacity.localScale; + Vector3 levelScale = chargeCapacity.localScale; + capacityScale.x = player.CurrentChargeCapacity / (float)player.MaxChargeLevel; + levelScale.x = player.CurrentChargeLevel / (float)player.MaxChargeLevel; + chargeCapacity.localScale = capacityScale; + chargeLevel.localScale = levelScale; + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/ChargeBarGUI.cs.meta b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/ChargeBarGUI.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/ChargeBarGUI.cs.meta rename to Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/ChargeBarGUI.cs.meta index 7ea4c204..2528f24b 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/ChargeBarGUI.cs.meta +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/ChargeBarGUI.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 1caa3cd050dcf534dbf0568021c0c20d -timeCreated: 1426399686 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 32000 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 1caa3cd050dcf534dbf0568021c0c20d +timeCreated: 1426399686 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 32000 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/PlayerLifeIndicator.cs b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/PlayerLifeIndicator.cs similarity index 96% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/PlayerLifeIndicator.cs rename to Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/PlayerLifeIndicator.cs index 5f983c57..acd7371c 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/PlayerLifeIndicator.cs +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/PlayerLifeIndicator.cs @@ -1,24 +1,24 @@ -using UnityEngine; -using System.Collections; -using UnityUtilLib.GUI; -using Danmaku2D.Phantasmagoria; - -namespace Danmaku2D.Phantasmagoria.GUI { - - public class PlayerLifeIndicator : MultiObjectValueIndicator { - - private PhantasmagoriaGameController gameControl; - - void Awake() { - gameControl = (PhantasmagoriaGameController)GameController; - } - - protected override int GetMaxValue () { - return DanmakuGameController.MaximumLives; - } - - protected override int GetValue () { - return ((player) ? gameControl.player1 : gameControl.player2).Field.Player.LivesRemaining; - } - } +using UnityEngine; +using System.Collections; +using UnityUtilLib.GUI; +using Danmaku2D.Phantasmagoria; + +namespace Danmaku2D.Phantasmagoria.GUI { + + public class PlayerLifeIndicator : MultiObjectValueIndicator { + + private PhantasmagoriaGameController gameControl; + + void Awake() { + gameControl = (PhantasmagoriaGameController)GameController; + } + + protected override int GetMaxValue () { + return DanmakuGameController.MaximumLives; + } + + protected override int GetValue () { + return ((player) ? gameControl.player1 : gameControl.player2).Field.Player.LivesRemaining; + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/PlayerLifeIndicator.cs.meta b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/PlayerLifeIndicator.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/PlayerLifeIndicator.cs.meta rename to Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/PlayerLifeIndicator.cs.meta index d65217c7..b35c87f0 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/PlayerLifeIndicator.cs.meta +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/PlayerLifeIndicator.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: d7f38eba429815d47a566e5beea12c5a -timeCreated: 1426400112 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 32000 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: d7f38eba429815d47a566e5beea12c5a +timeCreated: 1426400112 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 32000 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/PlayerScoreIndicator.cs b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/PlayerScoreIndicator.cs similarity index 96% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/PlayerScoreIndicator.cs rename to Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/PlayerScoreIndicator.cs index e609b502..38af5799 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/PlayerScoreIndicator.cs +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/PlayerScoreIndicator.cs @@ -1,22 +1,22 @@ -using UnityEngine; -using System.Collections; -using UnityUtilLib.GUI; - -namespace Danmaku2D.Phantasmagoria.GUI { - public class PlayerScoreIndicator : MultiObjectValueIndicator { - - private PhantasmagoriaGameController gameControl; - - void Awake() { - gameControl = (PhantasmagoriaGameController)GameController; - } - - protected override int GetMaxValue () { - return gameControl.WinningScore; - } - - protected override int GetValue() { - return ((player) ? gameControl.player1 : gameControl.player2).score; - } - } +using UnityEngine; +using System.Collections; +using UnityUtilLib.GUI; + +namespace Danmaku2D.Phantasmagoria.GUI { + public class PlayerScoreIndicator : MultiObjectValueIndicator { + + private PhantasmagoriaGameController gameControl; + + void Awake() { + gameControl = (PhantasmagoriaGameController)GameController; + } + + protected override int GetMaxValue () { + return gameControl.WinningScore; + } + + protected override int GetValue() { + return ((player) ? gameControl.player1 : gameControl.player2).score; + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/PlayerScoreIndicator.cs.meta b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/PlayerScoreIndicator.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/PlayerScoreIndicator.cs.meta rename to Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/PlayerScoreIndicator.cs.meta index fa8215a3..31dde857 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/PlayerScoreIndicator.cs.meta +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/PlayerScoreIndicator.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 9fd7c15c8bef28b4cbe718ddf624796c -timeCreated: 1426132678 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 9fd7c15c8bef28b4cbe718ddf624796c +timeCreated: 1426132678 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/RoundTimer.cs b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/RoundTimer.cs similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/RoundTimer.cs rename to Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/RoundTimer.cs index ae46197f..f4af85f2 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/RoundTimer.cs +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/RoundTimer.cs @@ -1,49 +1,49 @@ -using UnityEngine; -using System.Collections; -using UnityUtilLib; - -namespace Danmaku2D.Phantasmagoria.GUI { - - [RequireComponent(typeof(GUIText))] - public class RoundTimer : MonoBehaviour { - - [SerializeField] - private PhantasmagoriaGameController gameController; - - [SerializeField] - private Color flashColor; - - [SerializeField] - private FrameCounter flashInterval; - - [SerializeField] - private float flashThreshold; - - private Color normalColor; - private bool flashState; - private GUIText label; - - void Start() { - label = GetComponent(); - normalColor = label.color; - flashState = false; - } - - void Update() { - int timeSec = Mathf.FloorToInt (gameController.RemainingRoundTime); - int seconds = timeSec % 60; - int minutes = timeSec / 60; - label.text = minutes.ToString ("D2") + ":" + seconds.ToString ("D2");; - if (timeSec < flashThreshold) { - if(flashInterval.Tick()) { - label.color = (flashState) ? flashColor : normalColor; - flashState = !flashState; - } - } else { - label.color = normalColor; - flashState = false; - flashInterval.ForceReady(); - } - } - } +using UnityEngine; +using System.Collections; +using UnityUtilLib; + +namespace Danmaku2D.Phantasmagoria.GUI { + + [RequireComponent(typeof(GUIText))] + public class RoundTimer : MonoBehaviour { + + [SerializeField] + private PhantasmagoriaGameController gameController; + + [SerializeField] + private Color flashColor; + + [SerializeField] + private FrameCounter flashInterval; + + [SerializeField] + private float flashThreshold; + + private Color normalColor; + private bool flashState; + private GUIText label; + + void Start() { + label = GetComponent(); + normalColor = label.color; + flashState = false; + } + + void Update() { + int timeSec = Mathf.FloorToInt (gameController.RemainingRoundTime); + int seconds = timeSec % 60; + int minutes = timeSec / 60; + label.text = minutes.ToString ("D2") + ":" + seconds.ToString ("D2");; + if (timeSec < flashThreshold) { + if(flashInterval.Tick()) { + label.color = (flashState) ? flashColor : normalColor; + flashState = !flashState; + } + } else { + label.color = normalColor; + flashState = false; + flashInterval.ForceReady(); + } + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/RoundTimer.cs.meta b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/RoundTimer.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/RoundTimer.cs.meta rename to Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/RoundTimer.cs.meta index 8aad4614..d0cb5594 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/GUI/RoundTimer.cs.meta +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/GUI/RoundTimer.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: f8f533f227f6ddd44977113569d256d3 -timeCreated: 1426400111 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 32000 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: f8f533f227f6ddd44977113569d256d3 +timeCreated: 1426400111 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 32000 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaControlledAgent.cs b/Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaControlledAgent.cs similarity index 97% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaControlledAgent.cs rename to Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaControlledAgent.cs index c1079174..c4e4b23c 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaControlledAgent.cs +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaControlledAgent.cs @@ -1,43 +1,43 @@ -using UnityEngine; -using UnityUtilLib; -using System.Collections; - -namespace Danmaku2D.Phantasmagoria { - public class PhantasmagoriaControlledAgent : PlayerAgent { - private string horizontalMoveAxis; - private string verticalMoveAxis; - private string fireButton; - private string focusButton; - private string chargeButton; - - public PhantasmagoriaControlledAgent(int playerNumber) { - string strPlay = "Player "; - horizontalMoveAxis = "Horizontal Movement " + strPlay + playerNumber; - verticalMoveAxis = "Vertical Movement " + strPlay + playerNumber; - focusButton = "Focus " + strPlay + playerNumber; - fireButton = "Fire " + strPlay + playerNumber; - chargeButton = "Charge " + strPlay + playerNumber; - } - - /// - /// Update the specified dt. - /// - /// Dt. - public override void Update () { - PhantasmagoriaPlayableCharacter player = (PhantasmagoriaPlayableCharacter)Player; - Vector2 movementVector = Vector2.zero; - movementVector.x = Util.Sign(Input.GetAxis (horizontalMoveAxis)); - movementVector.y = Util.Sign(Input.GetAxis (verticalMoveAxis)); - //print (horizontalMoveAxis + " : " + Input.GetAxis (horizontalMoveAxis)); - //print ("movement vector: " + movementVector.ToString ()); - bool focus = Input.GetButton (focusButton); - bool fire = Input.GetButton (fireButton); - bool charge = Input.GetButton (chargeButton); - - player.IsFiring = fire; - player.IsCharging = charge; - - Player.Move (movementVector.x, movementVector.y, focus); - } - } +using UnityEngine; +using UnityUtilLib; +using System.Collections; + +namespace Danmaku2D.Phantasmagoria { + public class PhantasmagoriaControlledAgent : PlayerAgent { + private string horizontalMoveAxis; + private string verticalMoveAxis; + private string fireButton; + private string focusButton; + private string chargeButton; + + public PhantasmagoriaControlledAgent(int playerNumber) { + string strPlay = "Player "; + horizontalMoveAxis = "Horizontal Movement " + strPlay + playerNumber; + verticalMoveAxis = "Vertical Movement " + strPlay + playerNumber; + focusButton = "Focus " + strPlay + playerNumber; + fireButton = "Fire " + strPlay + playerNumber; + chargeButton = "Charge " + strPlay + playerNumber; + } + + /// + /// Update the specified dt. + /// + /// Dt. + public override void Update () { + PhantasmagoriaPlayableCharacter player = (PhantasmagoriaPlayableCharacter)Player; + Vector2 movementVector = Vector2.zero; + movementVector.x = Util.Sign(Input.GetAxis (horizontalMoveAxis)); + movementVector.y = Util.Sign(Input.GetAxis (verticalMoveAxis)); + //print (horizontalMoveAxis + " : " + Input.GetAxis (horizontalMoveAxis)); + //print ("movement vector: " + movementVector.ToString ()); + bool focus = Input.GetButton (focusButton); + bool fire = Input.GetButton (fireButton); + bool charge = Input.GetButton (chargeButton); + + player.IsFiring = fire; + player.IsCharging = charge; + + Player.Move (movementVector.x, movementVector.y, focus); + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaControlledAgent.cs.meta b/Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaControlledAgent.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaControlledAgent.cs.meta rename to Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaControlledAgent.cs.meta index 49f22d02..f261681c 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaControlledAgent.cs.meta +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaControlledAgent.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: ee7fc36e9121cde4ab7cabb8ff564ae9 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: ee7fc36e9121cde4ab7cabb8ff564ae9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaEnemy.cs b/Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaEnemy.cs similarity index 96% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaEnemy.cs rename to Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaEnemy.cs index 9500810c..aa59bdbb 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaEnemy.cs +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaEnemy.cs @@ -1,22 +1,22 @@ -using UnityEngine; -using System.Collections; -using UnityUtilLib; - -namespace Danmaku2D.Phantasmagoria { - public class PhantasmagoriaEnemy : BasicEnemy { - - [SerializeField] - private float deathReflectDuration; - - [SerializeField] - private float deathReflectRadius; - - [SerializeField] - private BulletTransferArea bulletTransferPrefab; - - protected override void OnDeath () { - BulletTransferArea transferArea = (BulletTransferArea)Instantiate (bulletTransferPrefab, transform.position, Quaternion.identity); - transferArea.Run (deathReflectDuration, deathReflectRadius, Field); - } - } +using UnityEngine; +using System.Collections; +using UnityUtilLib; + +namespace Danmaku2D.Phantasmagoria { + public class PhantasmagoriaEnemy : BasicEnemy { + + [SerializeField] + private float deathReflectDuration; + + [SerializeField] + private float deathReflectRadius; + + [SerializeField] + private BulletTransferArea bulletTransferPrefab; + + protected override void OnDeath () { + BulletTransferArea transferArea = (BulletTransferArea)Instantiate (bulletTransferPrefab, transform.position, Quaternion.identity); + transferArea.Run (deathReflectDuration, deathReflectRadius, Field); + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaEnemy.cs.meta b/Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaEnemy.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaEnemy.cs.meta rename to Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaEnemy.cs.meta index 063b6a08..68208ed5 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaEnemy.cs.meta +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaEnemy.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: b57b899a3c41f2541a07ea38c90df340 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: b57b899a3c41f2541a07ea38c90df340 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaGameController.cs b/Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaGameController.cs similarity index 94% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaGameController.cs rename to Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaGameController.cs index 99492397..3855ef2c 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaGameController.cs +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaGameController.cs @@ -1,167 +1,167 @@ -using UnityEngine; -using System; -using System.Collections; -using UnityUtilLib; - -namespace Danmaku2D.Phantasmagoria { - public class PhantasmagoriaGameController : DanmakuGameController { - - [Serializable] - public class PlayerData { - - [SerializeField] - private DanmakuField field; - public DanmakuField Field { - get { - return field; - } - } - - public int score = 0; - } - - public PlayerData player1; - public PlayerData player2; - - [SerializeField] - private int winningScore = 3; - public int WinningScore { - get { - return winningScore; - } - } - - [SerializeField] - private float roundTime; - - private float roundTimeRemaining; - public float RemainingRoundTime { - get { - return roundTimeRemaining; - } - } - - [SerializeField] - private float closureDuration; - - [SerializeField] - private Transform closureTop; - - [SerializeField] - private Transform closureBottom; - - private bool reseting = false; - - public override void Awake() { - base.Awake (); - Physics2D.raycastsHitTriggers = true; - if(player1.Field != null && player2.Field != null) { - player1.Field.TargetField = player2.Field; - player2.Field.TargetField = player1.Field; - StartRound(); - } - } - - public override void Update() { - base.Update (); - if (!reseting && (player1.Field.Player.LivesRemaining <= 0 || player2.Field.Player.LivesRemaining <= 0)) { - StartCoroutine(RoundReset ()); - } - roundTimeRemaining -= Util.TargetDeltaTime; - } - - public void StartRound() { - roundTimeRemaining = roundTime; - } - - private int playerNumber = 1; - public int PlayerNumber { - get { - return playerNumber; - } - set { - playerNumber = value; - } - } - - public static void Transfer(Projectile projectile) { - DanmakuField field = projectile.Field; - Vector2 relativePos = field.ViewPoint (projectile.Position); - projectile.Position = field.TargetField.WorldPoint (relativePos); - } - - public IEnumerator RoundReset() { - if(reseting) - yield break; - reseting = true; - WaitForEndOfFrame wfeof = new WaitForEndOfFrame (); - float duration = closureDuration / 2f; - Vector3 scale = closureTop.localScale; - Vector3 oldScale = scale; - float dt = Util.TargetDeltaTime; - float t = 0; - scale.y = t; - PauseGame (); - while (t <= 1f) { - scale.y = t; - closureTop.localScale = scale; - closureBottom.localScale = scale; - yield return wfeof; - t += dt / duration; - } - scale.y = 1f; - closureTop.localScale = scale; - closureBottom.localScale = scale; - bool p1dead = player1.Field.Player.LivesRemaining <= 0; - bool p2dead = player2.Field.Player.LivesRemaining <= 0; - player1.score += (p2dead && !p1dead) ? 1 : 0; - player2.score += (p1dead && !p2dead) ? 1 : 0; - bool p1win = player1.score >= winningScore; - bool p2win = player2.score >= winningScore; - if(p1win && p2win) { - //Signal Sudden Death - player1.score = player2.score = 0; - winningScore = 1; - } else if(p1win) { - //Declare Player 1 the winner - } else if(p2win) { - //Declare Player 2 the winner - } - player1.Field.Player.Reset (MaximumLives); - player2.Field.Player.Reset (MaximumLives); - player1.Field.Camera2DRotation = 0f; - player2.Field.Camera2DRotation = 0f; - Projectile.DeactivateAll (); - Enemy[] allEnemies = FindObjectsOfType (); - for(int i = 0; i < allEnemies.Length; i++) { - Destroy (allEnemies[i].gameObject); - } - BulletCancelArea[] bcas = FindObjectsOfType (); - for(int i = 0; i < bcas.Length; i++) { - Destroy (bcas[i].gameObject); - } - AttackPattern[] attackPatterns = FindObjectsOfType (); - for (int i = 0; i < attackPatterns.Length; i++) { - attackPatterns[i].Active = false; - } - while (t > 0f) { - scale.y = t; - closureTop.localScale = scale; - closureBottom.localScale = scale; - yield return wfeof; - t -= dt / duration; - } - closureTop.localScale = oldScale; - closureBottom.localScale = oldScale; - UnpauseGame (); - reseting = false; - } - -// public override void SpawnEnemy(Enemy prefab, Vector2 relativeLocations) { -// if(player1.Field != null && player2.Field != null) { -// player1.Field.SpawnEnemy(prefab, relativeLocations); -// player2.Field.SpawnEnemy(prefab, relativeLocations); -// } -// } - } +using UnityEngine; +using System; +using System.Collections; +using UnityUtilLib; + +namespace Danmaku2D.Phantasmagoria { + public class PhantasmagoriaGameController : DanmakuGameController { + + [Serializable] + public class PlayerData { + + [SerializeField] + private DanmakuField field; + public DanmakuField Field { + get { + return field; + } + } + + public int score = 0; + } + + public PlayerData player1; + public PlayerData player2; + + [SerializeField] + private int winningScore = 3; + public int WinningScore { + get { + return winningScore; + } + } + + [SerializeField] + private float roundTime; + + private float roundTimeRemaining; + public float RemainingRoundTime { + get { + return roundTimeRemaining; + } + } + + [SerializeField] + private float closureDuration; + + [SerializeField] + private Transform closureTop; + + [SerializeField] + private Transform closureBottom; + + private bool reseting = false; + + public override void Awake() { + base.Awake (); + Physics2D.raycastsHitTriggers = true; + if(player1.Field != null && player2.Field != null) { + player1.Field.TargetField = player2.Field; + player2.Field.TargetField = player1.Field; + StartRound(); + } + } + + public override void Update() { + base.Update (); + if (!reseting && (player1.Field.Player.LivesRemaining <= 0 || player2.Field.Player.LivesRemaining <= 0)) { + StartCoroutine(RoundReset ()); + } + roundTimeRemaining -= Util.TargetDeltaTime; + } + + public void StartRound() { + roundTimeRemaining = roundTime; + } + + private int playerNumber = 1; + public int PlayerNumber { + get { + return playerNumber; + } + set { + playerNumber = value; + } + } + + public static void Transfer(Danmaku projectile) { + DanmakuField field = projectile.Field; + Vector2 relativePos = field.ViewPoint (projectile.Position); + projectile.Position = field.TargetField.WorldPoint (relativePos); + } + + public IEnumerator RoundReset() { + if(reseting) + yield break; + reseting = true; + WaitForEndOfFrame wfeof = new WaitForEndOfFrame (); + float duration = closureDuration / 2f; + Vector3 scale = closureTop.localScale; + Vector3 oldScale = scale; + float dt = Util.TargetDeltaTime; + float t = 0; + scale.y = t; + PauseGame (); + while (t <= 1f) { + scale.y = t; + closureTop.localScale = scale; + closureBottom.localScale = scale; + yield return wfeof; + t += dt / duration; + } + scale.y = 1f; + closureTop.localScale = scale; + closureBottom.localScale = scale; + bool p1dead = player1.Field.Player.LivesRemaining <= 0; + bool p2dead = player2.Field.Player.LivesRemaining <= 0; + player1.score += (p2dead && !p1dead) ? 1 : 0; + player2.score += (p1dead && !p2dead) ? 1 : 0; + bool p1win = player1.score >= winningScore; + bool p2win = player2.score >= winningScore; + if(p1win && p2win) { + //Signal Sudden Death + player1.score = player2.score = 0; + winningScore = 1; + } else if(p1win) { + //Declare Player 1 the winner + } else if(p2win) { + //Declare Player 2 the winner + } + player1.Field.Player.Reset (MaximumLives); + player2.Field.Player.Reset (MaximumLives); + player1.Field.Camera2DRotation = 0f; + player2.Field.Camera2DRotation = 0f; + Danmaku.DeactivateAll (); + Enemy[] allEnemies = FindObjectsOfType (); + for(int i = 0; i < allEnemies.Length; i++) { + Destroy (allEnemies[i].gameObject); + } + BulletCancelArea[] bcas = FindObjectsOfType (); + for(int i = 0; i < bcas.Length; i++) { + Destroy (bcas[i].gameObject); + } + AttackPattern[] attackPatterns = FindObjectsOfType (); + for (int i = 0; i < attackPatterns.Length; i++) { + attackPatterns[i].Active = false; + } + while (t > 0f) { + scale.y = t; + closureTop.localScale = scale; + closureBottom.localScale = scale; + yield return wfeof; + t -= dt / duration; + } + closureTop.localScale = oldScale; + closureBottom.localScale = oldScale; + UnpauseGame (); + reseting = false; + } + +// public override void SpawnEnemy(Enemy prefab, Vector2 relativeLocations) { +// if(player1.Field != null && player2.Field != null) { +// player1.Field.SpawnEnemy(prefab, relativeLocations); +// player2.Field.SpawnEnemy(prefab, relativeLocations); +// } +// } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaGameController.cs.meta b/Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaGameController.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaGameController.cs.meta rename to Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaGameController.cs.meta index 171a731d..3e68b5d3 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaGameController.cs.meta +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaGameController.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: c445228d2a6cfa040914668b6232beab -timeCreated: 1426400523 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: -28000 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: c445228d2a6cfa040914668b6232beab +timeCreated: 1426400523 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: -28000 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaPlayableCharacter.cs b/Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaPlayableCharacter.cs similarity index 88% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaPlayableCharacter.cs rename to Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaPlayableCharacter.cs index 82c4ee9c..1facd7a5 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaPlayableCharacter.cs +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaPlayableCharacter.cs @@ -1,166 +1,166 @@ -using UnityEngine; -using System.Collections; -using UnityUtilLib; - -namespace Danmaku2D.Phantasmagoria { - public class PhantasmagoriaPlayableCharacter : DanmakuPlayer { - - [SerializeField] - private AttackPattern[] attackPatterns; - - [SerializeField] - private Vector2 shotOffset; - - [SerializeField] - private float shotVelocity; - - [SerializeField] - private float chargeRate = 1.0f; - - [SerializeField] - private float chargeCapacityRegen; - - [SerializeField] - private float currentChargeCapacity; - - [SerializeField] - private ProjectilePrefab shotType; - - [SerializeField] - private int shotDamage = 5; - - private bool charging; - public bool IsCharging { - get { - return charging; - } - set { - if(charging && !value) { - SpecialAttack(Mathf.FloorToInt(CurrentChargeLevel)); - } - charging = value; - } - } - - public override bool IsFiring { - get { - return base.IsFiring && !IsCharging; - } - } - - private float chargeLevel = 0f; - public float CurrentChargeLevel { - get { - return chargeLevel; - } - } - - public int MaxChargeLevel { - get { - return attackPatterns.Length + 1; - } - } - - public float CurrentChargeCapacity { - get { - return currentChargeCapacity; - } - } - - [SerializeField] - private BulletCancelArea cancelPrefab; - - [SerializeField] - private float deathCancelDuration; - - [SerializeField] - private float deathCancelRadius; - - [SerializeField] - private FrameCounter deathInvincibiiltyPeriod; - - [SerializeField] - private FrameCounter invincibiltyFlash; - - private bool invincible; - - public override DanmakuField Field { - get { - return base.Field; - } - set { - base.Field = value; - for(int i = 0; i < attackPatterns.Length; i++) - if(attackPatterns[i] != null) - attackPatterns[i].TargetField = base.Field.TargetField; - } - } - - public override void Hit(Projectile proj) { - if(!invincible) { - base.Hit (proj); - BulletCancelArea cancelArea = (BulletCancelArea)Instantiate (cancelPrefab, transform.position, Quaternion.identity); - cancelArea.Run(deathCancelDuration, deathCancelRadius); - invincible = true; - StartCoroutine(DeathInvincibiilty()); - } - } - - private IEnumerator DeathInvincibiilty() { - deathInvincibiiltyPeriod.Reset (); - invincibiltyFlash.Reset (); - WaitForEndOfFrame wfeof = new WaitForEndOfFrame(); - SpriteRenderer render = GetComponent (); - bool flash = false; - Color normalColor = render.color; - Color flashColor = normalColor; - flashColor.a = 0; - while(!deathInvincibiiltyPeriod.Tick()) { - if(invincibiltyFlash.Tick()) { - flash = !flash; - render.color = (flash) ? flashColor : normalColor; - } - yield return wfeof; - } - invincible = false; - render.color = normalColor; - } - - public virtual void SpecialAttack(int level) { - int index = level - 1; - if (index >= 0 && index < attackPatterns.Length) { - if(attackPatterns[index] != null) { - attackPatterns[index].Fire(); - } else { - print("Null AttackPattern triggered. Make Sure all AttackPatterns are fully implemented"); - } - } - chargeLevel -= level; - currentChargeCapacity -= level; - } - - public override void NormalUpdate () { - base.NormalUpdate (); - float dt = Util.TargetDeltaTime; - currentChargeCapacity += chargeCapacityRegen * dt; - if(currentChargeCapacity > MaxChargeLevel) { - currentChargeCapacity = MaxChargeLevel; - } - if(charging) { - chargeLevel += chargeRate * dt; - if(chargeLevel > currentChargeCapacity) - chargeLevel = currentChargeCapacity; - } else { - FireCheck(dt); - } - } - - public override void Fire () { - Vector2 location; - location = transform.position; - Projectile proj1 = Field.FireLinear (shotType, location + shotOffset, 0f, shotVelocity, DanmakuField.CoordinateSystem.World); - Projectile proj2 = Field.FireLinear (shotType, location - shotOffset, 0f, shotVelocity, DanmakuField.CoordinateSystem.World); - proj1.Damage = proj2.Damage = shotDamage; - } - } +using UnityEngine; +using System.Collections; +using UnityUtilLib; + +namespace Danmaku2D.Phantasmagoria { + public class PhantasmagoriaPlayableCharacter : DanmakuPlayer { + + [SerializeField] + private AttackPattern[] attackPatterns; + + [SerializeField] + private Vector2 shotOffset; + + [SerializeField] + private float shotVelocity; + + [SerializeField] + private float chargeRate = 1.0f; + + [SerializeField] + private float chargeCapacityRegen; + + [SerializeField] + private float currentChargeCapacity; + + [SerializeField] + private DanmakuPrefab shotType; + + [SerializeField] + private int shotDamage = 5; + + private bool charging; + public bool IsCharging { + get { + return charging; + } + set { + if(charging && !value) { + SpecialAttack(Mathf.FloorToInt(CurrentChargeLevel)); + } + charging = value; + } + } + + public override bool IsFiring { + get { + return base.IsFiring && !IsCharging; + } + } + + private float chargeLevel = 0f; + public float CurrentChargeLevel { + get { + return chargeLevel; + } + } + + public int MaxChargeLevel { + get { + return attackPatterns.Length + 1; + } + } + + public float CurrentChargeCapacity { + get { + return currentChargeCapacity; + } + } + + [SerializeField] + private BulletCancelArea cancelPrefab; + + [SerializeField] + private float deathCancelDuration; + + [SerializeField] + private float deathCancelRadius; + + [SerializeField] + private FrameCounter deathInvincibiiltyPeriod; + + [SerializeField] + private FrameCounter invincibiltyFlash; + + private bool invincible; + + public override DanmakuField Field { + get { + return base.Field; + } + set { + base.Field = value; + for(int i = 0; i < attackPatterns.Length; i++) + if(attackPatterns[i] != null) + attackPatterns[i].TargetField = base.Field.TargetField; + } + } + + public override void Hit(Danmaku proj) { + if(!invincible) { + base.Hit (proj); + BulletCancelArea cancelArea = (BulletCancelArea)Instantiate (cancelPrefab, transform.position, Quaternion.identity); + cancelArea.Run(deathCancelDuration, deathCancelRadius); + invincible = true; + StartCoroutine(DeathInvincibiilty()); + } + } + + private IEnumerator DeathInvincibiilty() { + deathInvincibiiltyPeriod.Reset (); + invincibiltyFlash.Reset (); + WaitForEndOfFrame wfeof = new WaitForEndOfFrame(); + SpriteRenderer render = GetComponent (); + bool flash = false; + Color normalColor = render.color; + Color flashColor = normalColor; + flashColor.a = 0; + while(!deathInvincibiiltyPeriod.Tick()) { + if(invincibiltyFlash.Tick()) { + flash = !flash; + render.color = (flash) ? flashColor : normalColor; + } + yield return wfeof; + } + invincible = false; + render.color = normalColor; + } + + public virtual void SpecialAttack(int level) { + int index = level - 1; + if (index >= 0 && index < attackPatterns.Length) { + if(attackPatterns[index] != null) { + attackPatterns[index].Fire(); + } else { + print("Null AttackPattern triggered. Make Sure all AttackPatterns are fully implemented"); + } + } + chargeLevel -= level; + currentChargeCapacity -= level; + } + + public override void NormalUpdate () { + base.NormalUpdate (); + float dt = Util.TargetDeltaTime; + currentChargeCapacity += chargeCapacityRegen * dt; + if(currentChargeCapacity > MaxChargeLevel) { + currentChargeCapacity = MaxChargeLevel; + } + if(charging) { + chargeLevel += chargeRate * dt; + if(chargeLevel > currentChargeCapacity) + chargeLevel = currentChargeCapacity; + } else { + FireCheck(dt); + } + } + + public override void Fire () { + Vector2 location; + location = transform.position; + Danmaku proj1 = Field.FireLinear (shotType, location + shotOffset, 0f, shotVelocity, DanmakuField.CoordinateSystem.World); + Danmaku proj2 = Field.FireLinear (shotType, location - shotOffset, 0f, shotVelocity, DanmakuField.CoordinateSystem.World); + proj1.Damage = proj2.Damage = shotDamage; + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaPlayableCharacter.cs.meta b/Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaPlayableCharacter.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaPlayableCharacter.cs.meta rename to Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaPlayableCharacter.cs.meta index c3c33fda..06e0c02b 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaPlayableCharacter.cs.meta +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/PhantasmagoriaPlayableCharacter.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 7ebcec34caf3f5e44a0354dd374d66b0 -timeCreated: 1426400298 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: -4000 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 7ebcec34caf3f5e44a0354dd374d66b0 +timeCreated: 1426400298 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: -4000 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/ProjectileTransferBoundary.cs b/Assets/External/DanmakuUnity2D/Phantasmagoria/ProjectileTransferBoundary.cs similarity index 82% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/ProjectileTransferBoundary.cs rename to Assets/External/DanmakuUnity2D/Phantasmagoria/ProjectileTransferBoundary.cs index 16ca243b..58ae5a24 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/ProjectileTransferBoundary.cs +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/ProjectileTransferBoundary.cs @@ -1,24 +1,24 @@ -using UnityEngine; -using System.Collections; - -namespace Danmaku2D.Phantasmagoria { - public class ProjectileTransferBoundary : ProjectileBoundary { - - [SerializeField] - private DanmakuField field; - public DanmakuField Field { - get { - return field; - } - set { - field = value; - } - } - - protected override void ProcessProjectile (Projectile proj) { - if (field != null) { - PhantasmagoriaGameController.Transfer(proj); - } - } - } +using UnityEngine; +using System.Collections; + +namespace Danmaku2D.Phantasmagoria { + public class ProjectileTransferBoundary : ProjectileBoundary { + + [SerializeField] + private DanmakuField field; + public DanmakuField Field { + get { + return field; + } + set { + field = value; + } + } + + protected override void ProcessProjectile (Danmaku proj) { + if (field != null) { + PhantasmagoriaGameController.Transfer(proj); + } + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/ProjectileTransferBoundary.cs.meta b/Assets/External/DanmakuUnity2D/Phantasmagoria/ProjectileTransferBoundary.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/ProjectileTransferBoundary.cs.meta rename to Assets/External/DanmakuUnity2D/Phantasmagoria/ProjectileTransferBoundary.cs.meta index 61b75be2..9c29f821 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/ProjectileTransferBoundary.cs.meta +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/ProjectileTransferBoundary.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 691f89f3381e4784ea7e3bc7b135075e -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: 691f89f3381e4784ea7e3bc7b135075e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/TestSpawnPlayer.cs b/Assets/External/DanmakuUnity2D/Phantasmagoria/TestSpawnPlayer.cs similarity index 97% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/TestSpawnPlayer.cs rename to Assets/External/DanmakuUnity2D/Phantasmagoria/TestSpawnPlayer.cs index 14aedc2a..ee409dd6 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/TestSpawnPlayer.cs +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/TestSpawnPlayer.cs @@ -1,20 +1,20 @@ -using UnityEngine; -using UnityUtilLib; -using System.Collections; - -namespace Danmaku2D.Phantasmagoria { - - [RequireComponent(typeof(PhantasmagoriaGameController))] - public class TestSpawnPlayer : TestScript { - public PhantasmagoriaPlayableCharacter character1; - public PhantasmagoriaPlayableCharacter character2; - - void Start() { - PhantasmagoriaGameController controller = GetComponent (); - PhantasmagoriaPlayableCharacter player1 = (PhantasmagoriaPlayableCharacter) controller.player1.Field.SpawnPlayer (character1); - PhantasmagoriaPlayableCharacter player2 = (PhantasmagoriaPlayableCharacter) controller.player2.Field.SpawnPlayer (character2); - player1.Agent = new PhantasmagoriaControlledAgent(1); - player2.Agent = new PhantasmagoriaControlledAgent(2); - } - } +using UnityEngine; +using UnityUtilLib; +using System.Collections; + +namespace Danmaku2D.Phantasmagoria { + + [RequireComponent(typeof(PhantasmagoriaGameController))] + public class TestSpawnPlayer : TestScript { + public PhantasmagoriaPlayableCharacter character1; + public PhantasmagoriaPlayableCharacter character2; + + void Start() { + PhantasmagoriaGameController controller = GetComponent (); + PhantasmagoriaPlayableCharacter player1 = (PhantasmagoriaPlayableCharacter) controller.player1.Field.SpawnPlayer (character1); + PhantasmagoriaPlayableCharacter player2 = (PhantasmagoriaPlayableCharacter) controller.player2.Field.SpawnPlayer (character2); + player1.Agent = new PhantasmagoriaControlledAgent(1); + player2.Agent = new PhantasmagoriaControlledAgent(2); + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/TestSpawnPlayer.cs.meta b/Assets/External/DanmakuUnity2D/Phantasmagoria/TestSpawnPlayer.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Phantasmagoria/TestSpawnPlayer.cs.meta rename to Assets/External/DanmakuUnity2D/Phantasmagoria/TestSpawnPlayer.cs.meta index 58afd5ab..980b9057 100644 --- a/Assets/Plugins/DanmakuUnity2D/Phantasmagoria/TestSpawnPlayer.cs.meta +++ b/Assets/External/DanmakuUnity2D/Phantasmagoria/TestSpawnPlayer.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: 5314b63a06c652f44a6e992b74158c81 -timeCreated: 1426400298 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: -24000 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: 5314b63a06c652f44a6e992b74158c81 +timeCreated: 1426400298 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: -24000 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/PlayerMovementLimit.cs b/Assets/External/DanmakuUnity2D/PlayerMovementLimit.cs similarity index 96% rename from Assets/Plugins/DanmakuUnity2D/PlayerMovementLimit.cs rename to Assets/External/DanmakuUnity2D/PlayerMovementLimit.cs index a9322dc7..66098b22 100644 --- a/Assets/Plugins/DanmakuUnity2D/PlayerMovementLimit.cs +++ b/Assets/External/DanmakuUnity2D/PlayerMovementLimit.cs @@ -1,35 +1,35 @@ -using UnityEngine; -using UnityUtilLib; - -/// -/// A development kit for quick development of 2D Danmaku games -/// -namespace Danmaku2D { - [RequireComponent(typeof(ScreenBoundary))] - public class PlayerMovementLimit : MonoBehaviour { - - [SerializeField] - private string tagCheck; - - [SerializeField] - private Vector2 lockedMovementVector; - - void OnTriggerEnter2D(Collider2D other) { - if(other.CompareTag(tagCheck)) { - DanmakuPlayer player = other.gameObject.GetComponent (); - if(player != null) { - player.ForbidMovement(lockedMovementVector); - } - } - } - - void OnTriggerExit2D(Collider2D other) { - if(other.CompareTag(tagCheck)) { - DanmakuPlayer player = other.gameObject.GetComponent (); - if(player != null) { - player.AllowMovement(lockedMovementVector); - } - } - } - } +using UnityEngine; +using UnityUtilLib; + +/// +/// A development kit for quick development of 2D Danmaku games +/// +namespace Danmaku2D { + [RequireComponent(typeof(ScreenBoundary))] + public class PlayerMovementLimit : MonoBehaviour { + + [SerializeField] + private string tagCheck; + + [SerializeField] + private Vector2 lockedMovementVector; + + void OnTriggerEnter2D(Collider2D other) { + if(other.CompareTag(tagCheck)) { + DanmakuPlayer player = other.gameObject.GetComponent (); + if(player != null) { + player.ForbidMovement(lockedMovementVector); + } + } + } + + void OnTriggerExit2D(Collider2D other) { + if(other.CompareTag(tagCheck)) { + DanmakuPlayer player = other.gameObject.GetComponent (); + if(player != null) { + player.AllowMovement(lockedMovementVector); + } + } + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/PlayerMovementLimit.cs.meta b/Assets/External/DanmakuUnity2D/PlayerMovementLimit.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/PlayerMovementLimit.cs.meta rename to Assets/External/DanmakuUnity2D/PlayerMovementLimit.cs.meta index d2d652a5..9253a320 100644 --- a/Assets/Plugins/DanmakuUnity2D/PlayerMovementLimit.cs.meta +++ b/Assets/External/DanmakuUnity2D/PlayerMovementLimit.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: 71b33ba592148d04cb0f9a0b38f23352 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: 71b33ba592148d04cb0f9a0b38f23352 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Pose.cs b/Assets/External/DanmakuUnity2D/Pose.cs similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Pose.cs rename to Assets/External/DanmakuUnity2D/Pose.cs index c79fd18b..8cee13a6 100644 --- a/Assets/Plugins/DanmakuUnity2D/Pose.cs +++ b/Assets/External/DanmakuUnity2D/Pose.cs @@ -1,102 +1,102 @@ -using System; -using UnityUtilLib; -using UnityEngine; - -namespace Danmaku2D { - - public struct Pose2D { - - public Vector2 Position; - public float Rotation; - - public Pose2D(Vector2 position) { - Position = position; - Rotation = 0f; - } - - public Pose2D(float rotation) { - Position = Vector2.zero; - Rotation = rotation; - } - - public Pose2D(Vector2 position, float rotation) { - Position = position; - Rotation = rotation; - } - - public Pose2D(Transform transform) { - Position = transform.position; - Rotation = transform.eulerAngles.z; - } - - public Pose2D(Transform2D transform) { - Position = transform.Position; - Rotation = transform.Rotation; - } - - public static explicit operator Pose2D(Vector2 position) { - return new Pose2D (position); - } - - public static explicit operator Pose2D(float rotation) { - return new Pose2D (rotation); - } - - public static explicit operator Pose2D(Transform transform) { - return new Pose2D (transform); - } - - public static explicit operator Pose2D(Transform2D transform) { - return new Pose2D (transform); - } - - public static Pose2D operator + (Pose2D p1, Pose2D p2) { - return new Pose2D (p1.Position + p2.Position, p1.Rotation + p2.Rotation); - } - - public static Pose2D operator - (Pose2D p1, Pose2D p2) { - return new Pose2D (p1.Position - p2.Position, p1.Rotation - p2.Rotation); - } - - public static Pose2D operator -(Pose2D pose) { - return new Pose2D (-pose.Position, pose.Rotation + 180f); - } - -// public Pose2D(Pose3D pose) { -// Position = pose.Position; -// Rotation = pose.Rotation.z; -// } - } - -// public struct Pose3D { -// -// public Vector3 Position; -// public Quaternion Rotation; -// -// public Pose3D(Vector3 position) { -// Position = position; -// Rotation = Quaternion.identity; -// } -// -// public Pose3D(Vector3 position, Quaternion rotation) { -// Position = position; -// Rotation = rotation; -// } -// -// public Pose3D(Pose2D pose) { -// Position = pose.Position; -// Rotation = Quaternion.Euler (0f, 0f, pose.Rotation); -// } -// -// public Pose3D(Transform transform) { -// Position = transform.position; -// Rotation = transform.rotation; -// } -// -// public Pose3D(Transform2D transform) { -// Position = transform.Position; -// Rotation = transform.transform.rotation; -// } -// } -} - +using System; +using UnityUtilLib; +using UnityEngine; + +namespace Danmaku2D { + + public struct Pose2D { + + public Vector2 Position; + public float Rotation; + + public Pose2D(Vector2 position) { + Position = position; + Rotation = 0f; + } + + public Pose2D(float rotation) { + Position = Vector2.zero; + Rotation = rotation; + } + + public Pose2D(Vector2 position, float rotation) { + Position = position; + Rotation = rotation; + } + + public Pose2D(Transform transform) { + Position = transform.position; + Rotation = transform.eulerAngles.z; + } + + public Pose2D(Transform2D transform) { + Position = transform.Position; + Rotation = transform.Rotation; + } + + public static explicit operator Pose2D(Vector2 position) { + return new Pose2D (position); + } + + public static explicit operator Pose2D(float rotation) { + return new Pose2D (rotation); + } + + public static explicit operator Pose2D(Transform transform) { + return new Pose2D (transform); + } + + public static explicit operator Pose2D(Transform2D transform) { + return new Pose2D (transform); + } + + public static Pose2D operator + (Pose2D p1, Pose2D p2) { + return new Pose2D (p1.Position + p2.Position, p1.Rotation + p2.Rotation); + } + + public static Pose2D operator - (Pose2D p1, Pose2D p2) { + return new Pose2D (p1.Position - p2.Position, p1.Rotation - p2.Rotation); + } + + public static Pose2D operator -(Pose2D pose) { + return new Pose2D (-pose.Position, pose.Rotation + 180f); + } + +// public Pose2D(Pose3D pose) { +// Position = pose.Position; +// Rotation = pose.Rotation.z; +// } + } + +// public struct Pose3D { +// +// public Vector3 Position; +// public Quaternion Rotation; +// +// public Pose3D(Vector3 position) { +// Position = position; +// Rotation = Quaternion.identity; +// } +// +// public Pose3D(Vector3 position, Quaternion rotation) { +// Position = position; +// Rotation = rotation; +// } +// +// public Pose3D(Pose2D pose) { +// Position = pose.Position; +// Rotation = Quaternion.Euler (0f, 0f, pose.Rotation); +// } +// +// public Pose3D(Transform transform) { +// Position = transform.position; +// Rotation = transform.rotation; +// } +// +// public Pose3D(Transform2D transform) { +// Position = transform.Position; +// Rotation = transform.transform.rotation; +// } +// } +} + diff --git a/Assets/Plugins/DanmakuUnity2D/Pose.cs.meta b/Assets/External/DanmakuUnity2D/Pose.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/Pose.cs.meta rename to Assets/External/DanmakuUnity2D/Pose.cs.meta index b80c527c..b735ec07 100644 --- a/Assets/Plugins/DanmakuUnity2D/Pose.cs.meta +++ b/Assets/External/DanmakuUnity2D/Pose.cs.meta @@ -1,12 +1,12 @@ -fileFormatVersion: 2 -guid: aec9b229ed6c8e641a6b6444f6cde0a4 -timeCreated: 1427577854 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +fileFormatVersion: 2 +guid: aec9b229ed6c8e641a6b6444f6cde0a4 +timeCreated: 1427577854 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/ProjectileBoundary.cs b/Assets/External/DanmakuUnity2D/ProjectileBoundary.cs similarity index 85% rename from Assets/Plugins/DanmakuUnity2D/ProjectileBoundary.cs rename to Assets/External/DanmakuUnity2D/ProjectileBoundary.cs index 49dde67c..89dcf950 100644 --- a/Assets/Plugins/DanmakuUnity2D/ProjectileBoundary.cs +++ b/Assets/External/DanmakuUnity2D/ProjectileBoundary.cs @@ -1,54 +1,54 @@ -using UnityEngine; -using System.Collections; -using System.Collections.Generic; - -/// -/// A development kit for quick development of 2D Danmaku games -/// -namespace Danmaku2D { - - /// - /// A script for defining boundaries for detecting collision with Projectiles - /// - [RequireComponent(typeof(Collider2D))] - public class ProjectileBoundary : MonoBehaviour, IProjectileCollider { - - /// - /// A filter for a set of tags, delimited by "|" for selecting which bullets to affect - /// Leaving this blank will affect all bullets - /// - [SerializeField] - private string tagFilter; - - private HashSet validTags; - - /// - /// Called on Component instantiation - /// - void Awake() { - if(tagFilter == null) - tagFilter = ""; - validTags = new HashSet(tagFilter.Split ('|')); - } - - /// - /// Called on collision with any Projectile - /// - /// Proj. - public void OnProjectileCollision(Projectile proj) { - if(validTags.Count <= 0 || validTags.Contains(proj.Tag)) { - ProcessProjectile(proj); - } - } - - /// - /// Processes a projectile. - /// By default, this deactivates all Projectiles that come in contact with the ProjectileBoundary - /// Override this in subclasses for alternative behavior. - /// - /// the projectile to process - protected virtual void ProcessProjectile(Projectile proj) { - proj.Deactivate(); - } - } +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + +/// +/// A development kit for quick development of 2D Danmaku games +/// +namespace Danmaku2D { + + /// + /// A script for defining boundaries for detecting collision with Projectiles + /// + [RequireComponent(typeof(Collider2D))] + public class ProjectileBoundary : MonoBehaviour, IDanmakuCollider { + + /// + /// A filter for a set of tags, delimited by "|" for selecting which bullets to affect + /// Leaving this blank will affect all bullets + /// + [SerializeField] + private string tagFilter; + + private HashSet validTags; + + /// + /// Called on Component instantiation + /// + void Awake() { + if(tagFilter == null) + tagFilter = ""; + validTags = new HashSet(tagFilter.Split ('|')); + } + + /// + /// Called on collision with any Projectile + /// + /// Proj. + public void OnProjectileCollision(Danmaku proj) { + if(validTags.Count <= 0 || validTags.Contains(proj.Tag)) { + ProcessProjectile(proj); + } + } + + /// + /// Processes a projectile. + /// By default, this deactivates all Projectiles that come in contact with the ProjectileBoundary + /// Override this in subclasses for alternative behavior. + /// + /// the projectile to process + protected virtual void ProcessProjectile(Danmaku proj) { + proj.Deactivate(); + } + } } \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/ProjectileBoundary.cs.meta b/Assets/External/DanmakuUnity2D/ProjectileBoundary.cs.meta similarity index 95% rename from Assets/Plugins/DanmakuUnity2D/ProjectileBoundary.cs.meta rename to Assets/External/DanmakuUnity2D/ProjectileBoundary.cs.meta index 723df683..3c1b4765 100644 --- a/Assets/Plugins/DanmakuUnity2D/ProjectileBoundary.cs.meta +++ b/Assets/External/DanmakuUnity2D/ProjectileBoundary.cs.meta @@ -1,8 +1,8 @@ -fileFormatVersion: 2 -guid: f3398acc99d91cf4f99566c3f852530e -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: +fileFormatVersion: 2 +guid: f3398acc99d91cf4f99566c3f852530e +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/External/UnityUtilLib b/Assets/External/UnityUtilLib new file mode 160000 index 00000000..7081f735 --- /dev/null +++ b/Assets/External/UnityUtilLib @@ -0,0 +1 @@ +Subproject commit 7081f735b1f0a13079827927123a1a8a1a7244ab diff --git a/Assets/Plugins/UnityUtilLib.meta b/Assets/External/UnityUtilLib.meta similarity index 67% rename from Assets/Plugins/UnityUtilLib.meta rename to Assets/External/UnityUtilLib.meta index 42f19f61..e2ffc556 100644 --- a/Assets/Plugins/UnityUtilLib.meta +++ b/Assets/External/UnityUtilLib.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 -guid: 905a39906ead01b4f88c6c0fb4462625 +guid: c2b7099b4fde3fa448939bc11b18038e folderAsset: yes -timeCreated: 1427611698 +timeCreated: 1427734720 licenseType: Free DefaultImporter: userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers.meta b/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers.meta deleted file mode 100644 index c294bbbe..00000000 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/PlayerControllers.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 5f6a95d957e09934bb7942c31903469f -folderAsset: yes -timeCreated: 1427611179 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers.meta b/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers.meta deleted file mode 100644 index b9a93b32..00000000 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 531d1843896cf4e4b8dad31f377066b3 -folderAsset: yes -timeCreated: 1427611179 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AnimationCurveControl.cs b/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AnimationCurveControl.cs deleted file mode 100644 index 047aad0c..00000000 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/AnimationCurveControl.cs +++ /dev/null @@ -1,50 +0,0 @@ -using UnityEngine; -using Danmaku2D.ProjectileControllers; - -namespace Danmaku2D { - - public class AnimationCurveControl : ControllerWrapperBehavior { - [SerializeField] - private AnimationCurveController controller; - - #region implemented abstract members of ControllerWrapperBehavior - protected override AnimationCurveController CreateController () { - return controller; - } - #endregion - } - - [System.Serializable] - public class AnimationCurveController : IProjectileController { - - [SerializeField] - private AnimationCurve velocityCurve; - - #region IProjectileController implementation - - public virtual void UpdateProjectile (Projectile projectile, float dt) { - // if(acceleration != 0) { - // float accelSign = Util.Sign(acceleration); - // if(accelSign == Util.Sign(capSpeed - velocity)) { - // velocity += acceleration * dt; - // if((accelSign < 0 && velocity < capSpeed) || (accelSign > 0 && velocity > capSpeed)) { - // velocity = capSpeed; - // } - // } else { - // velocity = capSpeed; - // acceleration = 0; - // } - // } - float velocity = velocityCurve.Evaluate (projectile.Time); - if (velocity != 0) - projectile.Position += projectile.Direction * velocity * dt; - } - - #endregion - - - - - } -} - diff --git a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/IProjectileController.cs.meta b/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/IProjectileController.cs.meta deleted file mode 100644 index 9bfd3fee..00000000 --- a/Assets/Plugins/DanmakuUnity2D/Controllers/Projectile Cotnrollers/IProjectileController.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e8b0d6a8a922dd946a93a548be9b469f -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Core/IProjectileCollider.cs b/Assets/Plugins/DanmakuUnity2D/Core/IProjectileCollider.cs deleted file mode 100644 index ce58c4df..00000000 --- a/Assets/Plugins/DanmakuUnity2D/Core/IProjectileCollider.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace Danmaku2D { - public interface IProjectileCollider { - void OnProjectileCollision(Projectile proj); - } -} - diff --git a/Assets/Plugins/DanmakuUnity2D/Core/Projectile.cs.meta b/Assets/Plugins/DanmakuUnity2D/Core/Projectile.cs.meta deleted file mode 100644 index 8936a681..00000000 --- a/Assets/Plugins/DanmakuUnity2D/Core/Projectile.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e58d8919c65fca8419a0ac6cdeb34185 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Core/ProjectileGroup.cs b/Assets/Plugins/DanmakuUnity2D/Core/ProjectileGroup.cs deleted file mode 100644 index fe989e32..00000000 --- a/Assets/Plugins/DanmakuUnity2D/Core/ProjectileGroup.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -namespace Danmaku2D { - - public sealed class ProjectileGroup : ICollection { - - internal HashSet group; - - internal HashSet controllers; - - public ProjectileGroup() { - group = new HashSet (); - controllers = new HashSet (); - } - - public void AddController(IProjectileController controller) { - if (controllers.Add (controller)) { - foreach(Projectile proj in group) { - proj.AddController(controller); - } - } - } - - public void RemoveController(IProjectileController controller) { - if (controllers.Remove (controller)) { - foreach(Projectile proj in group) { - proj.RemoveController(controller); - } - } - } - - public void ClearControllers() { - foreach (IProjectileController controller in controllers) { - foreach(Projectile proj in group) { - proj.RemoveController(controller); - } - } - controllers.Clear (); - } - - public bool UsesController(IProjectileController controller) { - return controllers.Contains (controller); - } - - public int ControllerCount { - get { - return controllers.Count; - } - } - - #region ICollection implementation - - public void Add (Projectile item) { - bool added = group.Add(item); - if (added) { - item.groups.Add (this); - item.groupCountCache++; - item.groupCheck = item.groups.Count > 0; - foreach(IProjectileController controller in controllers) { - item.AddController(controller); - } - } - } - - public void Clear () { - foreach(Projectile proj in group) { - proj.RemoveFromGroup(this); - } - } - - public bool Contains (Projectile item) { - return group.Contains (item); - } - - public void CopyTo (Projectile[] array, int arrayIndex) { - group.CopyTo (array, arrayIndex); - } - - public bool Remove (Projectile item) { - bool success = false; - success = group.Remove(item); - if (success) { - item.groups.Remove (this); - item.groupCountCache--; - item.groupCheck = item.groups.Count > 0; - foreach(IProjectileController controller in controllers) { - item.RemoveController(controller); - } - } - return success; - } - - public int Count { - get { - return group.Count; - } - } - - public bool IsReadOnly { - get { - return false; - } - } - - #endregion - - #region IEnumerable implementation - - public IEnumerator GetEnumerator () { - return group.GetEnumerator (); - } - - #endregion - - #region IEnumerable implementation - - IEnumerator IEnumerable.GetEnumerator () { - return group.GetEnumerator (); - } - - #endregion - - - - - } -} - diff --git a/Assets/Plugins/DanmakuUnity2D/Core/ProjectileGroup.cs.meta b/Assets/Plugins/DanmakuUnity2D/Core/ProjectileGroup.cs.meta deleted file mode 100644 index 0771f5bb..00000000 --- a/Assets/Plugins/DanmakuUnity2D/Core/ProjectileGroup.cs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 23cca558cef155c43acdde4763e2c2f5 -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: diff --git a/Assets/Plugins/DanmakuUnity2D/Modifiers/BurstModifier.cs b/Assets/Plugins/DanmakuUnity2D/Modifiers/BurstModifier.cs deleted file mode 100644 index 5f6ef4ba..00000000 --- a/Assets/Plugins/DanmakuUnity2D/Modifiers/BurstModifier.cs +++ /dev/null @@ -1,39 +0,0 @@ -using UnityEngine; -using System.Collections; - -namespace Danmaku2D { - - [System.Serializable] - public class BurstModifier : FireModifier { - - public float Range = 360f; - public int Count = 1; - public float DeltaVelocity = 0f; - public float DeltaAngularVelocity = 0f; - - #region implemented abstract members of FireModifier - - public override void Fire (Vector2 position, float rotation) { - - Count = Mathf.Abs (Count); - - float start = rotation - Range * 0.5f; - float delta = Range / (Count - 1); - - for (int i = 0; i < Count; i++) { - Velocity += DeltaVelocity; - AngularVelocity += DeltaAngularVelocity; - FireSingle(position, start + i * delta); - } - - } - - #endregion - - } -} - -namespace Danmaku2D.Wrapper { - public class BurstModifier : ModifierWrapper { - } -} \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Modifiers/LineModifier.cs b/Assets/Plugins/DanmakuUnity2D/Modifiers/LineModifier.cs deleted file mode 100644 index 1207f5c4..00000000 --- a/Assets/Plugins/DanmakuUnity2D/Modifiers/LineModifier.cs +++ /dev/null @@ -1,33 +0,0 @@ -using UnityEngine; -using System.Collections; - -namespace Danmaku2D { - - [System.Serializable] - public class LineModifier : FireModifier { - - public int Depth = 1; - public float DeltaVelocity = 0f; - public float DeltaAngularVelocity = 0f; - - #region implemented abstract members of FireModifier - public override void Fire (Vector2 position, float rotation) { - - for(int i = 0; i < Depth; i++) { - Velocity += DeltaVelocity; - AngularVelocity += DeltaAngularVelocity; - FireSingle(position, rotation); - } - - } - #endregion - - } - -} - -namespace Danmaku2D.Wrapper { - - public class LineModifier : ModifierWrapper { - } -} \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/Modifiers/ModifierWrapper.cs b/Assets/Plugins/DanmakuUnity2D/Modifiers/ModifierWrapper.cs deleted file mode 100644 index a0f348f0..00000000 --- a/Assets/Plugins/DanmakuUnity2D/Modifiers/ModifierWrapper.cs +++ /dev/null @@ -1,45 +0,0 @@ -using UnityEngine; -using System.Collections; - -namespace Danmaku2D { - - public abstract class ModifierWrapper : MonoBehaviour { - - public abstract FireModifier Modifier { - get; - } - - } - - public abstract class ModifierWrapper : ModifierWrapper where T : FireModifier { - - [SerializeField] - private T modifier; - - public override FireModifier Modifier { - get { - return modifier; - } - } - - [SerializeField] - private ModifierWrapper subModifier; - - public ModifierWrapper SubModifier { - get { - return subModifier; - } - set { - subModifier = value; - if(subModifier != null) - modifier.SubModifier = subModifier.Modifier; - } - } - - public void Awake() { - if(subModifier != null) - modifier.SubModifier = subModifier.Modifier; - } - - } -} diff --git a/Assets/Plugins/DanmakuUnity2D/NoScript/Emitters.meta b/Assets/Plugins/DanmakuUnity2D/NoScript/Emitters.meta deleted file mode 100644 index c1a8be04..00000000 --- a/Assets/Plugins/DanmakuUnity2D/NoScript/Emitters.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 074989720ae86484189cfa51077d280d -folderAsset: yes -timeCreated: 1427611179 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/NoScript/Emitters/StreamEmitter.cs b/Assets/Plugins/DanmakuUnity2D/NoScript/Emitters/StreamEmitter.cs deleted file mode 100644 index dd818310..00000000 --- a/Assets/Plugins/DanmakuUnity2D/NoScript/Emitters/StreamEmitter.cs +++ /dev/null @@ -1,27 +0,0 @@ -using UnityEngine; -using System.Collections; - -namespace Danmaku2D.NoScript { - - internal class StreamEmitter : ProjectileEmitter { - - #pragma warning disable 0649 - public FireBuilder fireData; - public ProjectileControlBehavior controller; - #pragma warning restore 0649 - - #region implemented abstract members of ProjectileEmitter - - protected override void FireProjectiles () { - if (controller != null) - fireData.Controller = controller.UpdateProjectile; - else - fireData.Controller = null; - fireData.Modifier = Modifier; - Source.Fire (fireData); - } - - #endregion - - } -} \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/NoScript/Emitters/StreamEmitter.cs.meta b/Assets/Plugins/DanmakuUnity2D/NoScript/Emitters/StreamEmitter.cs.meta deleted file mode 100644 index 54445ea7..00000000 --- a/Assets/Plugins/DanmakuUnity2D/NoScript/Emitters/StreamEmitter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5a2acc2ca3291e744b49187768faf8d2 -timeCreated: 1427133427 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/NoScript/ProjectileEmitter.cs b/Assets/Plugins/DanmakuUnity2D/NoScript/ProjectileEmitter.cs deleted file mode 100644 index 24557c17..00000000 --- a/Assets/Plugins/DanmakuUnity2D/NoScript/ProjectileEmitter.cs +++ /dev/null @@ -1,63 +0,0 @@ -using UnityEngine; -using UnityUtilLib; -using System.Collections; -using Danmaku2D.NoScript; - -namespace Danmaku2D { - - public abstract class ProjectileEmitter : PausableGameObject { - - [SerializeField] - private ProjectileSource source; - - protected ProjectileSource Source { - get { - return source; - } - } - - [SerializeField] - private FrameCounter delay; - - [SerializeField] - private ModifierWrapper modifier; - - public FireModifier Modifier { - get { - if(modifier == null) - return null; - return modifier.Modifier; - } - } - - public DanmakuField TargetField { - get { - return source.TargetField; - } - set { - source.TargetField = value; - } - } - - public override void Awake () { - base.Awake (); - if (source == null) - source = GetComponent (); - } - - public override void NormalUpdate () { - if(delay.Tick()) { - Fire (); - } - } - - public void Fire() { - if (source == null) - source = gameObject.AddComponent (); -// print ("fire"); - FireProjectiles (); - } - - protected abstract void FireProjectiles(); - } -} \ No newline at end of file diff --git a/Assets/Plugins/DanmakuUnity2D/NoScript/ProjectileEmitter.cs.meta b/Assets/Plugins/DanmakuUnity2D/NoScript/ProjectileEmitter.cs.meta deleted file mode 100644 index e7248b9e..00000000 --- a/Assets/Plugins/DanmakuUnity2D/NoScript/ProjectileEmitter.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ffe233db523780e44a86aa5929c44306 -timeCreated: 1426897776 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/DanmakuUnity2D/NoScript/ProjectileSource.cs.meta b/Assets/Plugins/DanmakuUnity2D/NoScript/ProjectileSource.cs.meta deleted file mode 100644 index 5a7dd887..00000000 --- a/Assets/Plugins/DanmakuUnity2D/NoScript/ProjectileSource.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a7410e235b50fb14887e48a1a51a80f6 -timeCreated: 1427120492 -licenseType: Free -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/UnityUtilLib b/Assets/Plugins/UnityUtilLib deleted file mode 160000 index af726b96..00000000 --- a/Assets/Plugins/UnityUtilLib +++ /dev/null @@ -1 +0,0 @@ -Subproject commit af726b965f64de5714be7a8c1584379d8e6c7821