Skip to content

Commit

Permalink
Dump from Dogfight
Browse files Browse the repository at this point in the history
  • Loading branch information
james7132 committed Mar 24, 2015
1 parent b992b8c commit b3351f3
Show file tree
Hide file tree
Showing 71 changed files with 873 additions and 243 deletions.
2 changes: 1 addition & 1 deletion Assets/External Libraries.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Assets/External Libraries/DanmakuUnity2D.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 21 additions & 20 deletions Assets/External Libraries/DanmakuUnity2D/Attack Patterns/Burst.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ public abstract class Burst : AttackPattern {
[SerializeField]
private int bulletCount;

/// <summary>
/// An overridable factory method for subclasses to control the various
/// </summary>
/// <value>The controller to be used with the bullets fired with this attack pattern</value>
protected abstract IProjectileController BurstController {
get;
}
[SerializeField]
private int burstDepth = 1;

[SerializeField]
private float burstRange = 360f;

[SerializeField]
private Counter burstCount;
Expand All @@ -47,13 +45,6 @@ protected abstract IProjectileController BurstController {
private float burstRotationDelta;

private Vector2 currentBurstSource;
private ProjectileGroup burstGroup;

public override void Awake () {
base.Awake ();
burstGroup = new ProjectileGroup ();
burstGroup.Controller = BurstController;
}

protected override bool IsFinished {
get {
Expand All @@ -63,16 +54,26 @@ protected override bool IsFinished {

protected override void OnExecutionStart () {
burstCount.Reset ();
currentBurstSource = spawnLocation - 0.5f * spawnArea + Util.RandomVect2 (spawnArea);
currentBurstSource = spawnLocation - 0.5f * spawnArea + spawnArea.Random();
}


/// <summary>
/// An overridable factory method for subclasses to control the various
/// </summary>
/// <value>The controller to be used with the bullets fired with this attack pattern</value>
protected abstract IProjectileController GetBurstController(int depth);

protected override void MainLoop () {
if(burstDelay.Tick()) {
float offset = (burstCount.MaxCount - burstCount.Count) * burstRotationDelta;
for(int i = 0; i < bulletCount; i++) {
Projectile temp = SpawnProjectile (prefab, currentBurstSource, offset + 360f / (float) bulletCount * (float)i);
burstGroup.Add(temp);
}
TargetField.SpawnBurst(prefab,
currentBurstSource,
burstInitialRotation + offset,
burstRange,
bulletCount,
null,
burstDepth,
GetBurstController);
burstCount.Tick();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@ public class ControlledBurst : Burst {

#region implemented abstract members of Burst

protected override IProjectileController BurstController {
get {
// if(controller is ControllerWrapperBehavior<ProjectileControlBehavior>) {
// return (controller as ControllerWrapperBehavior<ProjectileControlBehavior>).Controller;
// }
return controller;
}
protected override IProjectileController GetBurstController(int depth) {
return controller;
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ public class CurvedBurst : Burst {

#region implemented abstract members of Burst

protected override IProjectileController BurstController {
get {
return CurvedController;
}
protected override IProjectileController GetBurstController(int depth) {
return CurvedController;
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ public class LinearBurst : Burst {
[SerializeField]
private LinearProjectile LinearController;

[SerializeField]
private float deltaDepthVelocity;

#region implemented abstract members of Burst

protected override IProjectileController BurstController {
get {
protected override IProjectileController GetBurstController(int depth) {
if (deltaDepthVelocity == 0) {
return LinearController;
} else {
return new LinearProjectile(LinearController.Velocity + depth * deltaDepthVelocity);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Assets/External Libraries/DanmakuUnity2D/BasicEnemy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public override void Awake() {

protected override void Damage (float damage) {
currentHealth -= damage;
Debug.Log (currentHealth);
print (currentHealth);
}

public override bool IsDead {
Expand Down
2 changes: 1 addition & 1 deletion Assets/External Libraries/DanmakuUnity2D/Controllers.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Assets/External Libraries/DanmakuUnity2D/Core.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public virtual void Fire () {
if (!Active) {
StartCoroutine (Execute ());
} else {
Debug.Log("Tried Executing Already Running Attack Pattern");
print("Tried Executing Already Running Attack Pattern");
}
}

Expand Down
4 changes: 2 additions & 2 deletions Assets/External Libraries/DanmakuUnity2D/Core/DanmakuField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private void Resize() {

private void CameraSetup() {
if (camera2D == null) {
Debug.Log("Camera is null");
print("Camera is null");
GameObject camObj = gameObject.FindChild("Field Camera");
if(camObj == null) {
camObj = new GameObject ("Field Camera");
Expand Down Expand Up @@ -264,7 +264,7 @@ void Update() {
movementBounds.center = bounds.center = (Vector2)transform.position;
float size = camera2D.orthographicSize;
movementBounds.extents = new Vector2 (camera2D.aspect * size, size);
bounds.extents = movementBounds.extents + (Vector3)(Vector2.one * ClipBoundary * Util.MaxComponent2 (movementBounds.extents));
bounds.extents = movementBounds.extents + (Vector3)(Vector2.one * ClipBoundary * movementBounds.extents.Max());
#if UNITY_EDITOR
if(Application.isPlaying) {
#endif
Expand Down
4 changes: 2 additions & 2 deletions Assets/External Libraries/DanmakuUnity2D/Core/Projectile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ public void MatchPrefab(ProjectilePrefab prefab) {
sprite = renderer.sprite = runtime.Sprite;
renderer.sharedMaterial = runtime.Material;
renderer.sortingLayerID = renderer.sortingLayerID;
circleCenter = Util.HadamardProduct2(transform.lossyScale, runtime.ColliderOffset);
circleRaidus = runtime.ColliderRadius * Util.MaxComponent2(transform.lossyScale);
circleCenter = transform.lossyScale.Hadamard2(runtime.ColliderOffset);
circleRaidus = runtime.ColliderRadius * transform.lossyScale.Max();
tag = gameObject.tag = runtime.Tag;
layer = runtime.Layer;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public override void Awake () {
}

public void Start () {
Debug.Log (((int)defaultCollisionMask).ToString ("X8"));
print (((int)defaultCollisionMask).ToString ("X8"));
if(projectilePool == null) {
projectilePool = new ProjectilePool (initialCount, spawnOnEmpty);
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/External Libraries/DanmakuUnity2D/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ private static string GetProjectWindowFolder() {
if (Directory.Exists (path)) {
return path; // path is a folder
} else {
Debug.Log(path);
Debug.Log(Directory.GetParent(path).FullName);
// Debug.Log(path);
// Debug.Log(Directory.GetParent(path).FullName);
return Directory.GetParent(path).FullName;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ public override void OnInspectorGUI () {

size.floatValue = c_size.floatValue;
// cullingMask.intValue = c_cullingMask.intValue;
// Debug.Log(cullingMask.intValue);
// Debug.Log(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;
Expand Down
2 changes: 1 addition & 1 deletion Assets/External Libraries/DanmakuUnity2D/EnemyManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public override void Awake () {
registeredEnemies = new List<Enemy> ();
controller = GetComponent<DanmakuGameController> ();
if (controller == null) {
Debug.Log("Error: Enemy Manager without Game Controller");
print("Error: Enemy Manager without Game Controller");
}
}

Expand Down
6 changes: 3 additions & 3 deletions Assets/External Libraries/DanmakuUnity2D/FieldBoundary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public override void Awake () {
base.Awake ();
boundary = GetComponent<BoxCollider2D> ();
if (field == null) {
Debug.Log("No field provided, searching in ancestor GameObjects...");
print("No field provided, searching in ancestor GameObjects...");
field = GetComponentInParent<DanmakuField>();
}
if (field == null) {
Expand All @@ -63,8 +63,8 @@ void OnDrawGizmos() {
private void UpdatePosition() {
oldBounds = field.MovementBounds;

float size = Util.MaxComponent2 (oldBounds.size);
Vector2 newPosition = (Vector2)oldBounds.center + Util.HadamardProduct2(fixedPoints [(int)location], oldBounds.extents);
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;
Expand Down
2 changes: 1 addition & 1 deletion Assets/External Libraries/DanmakuUnity2D/Materials.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/External Libraries/DanmakuUnity2D/NoScript.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using UnityEngine;
using System.Collections;

namespace Danmaku2D.NoScript {

internal sealed class BurstEmitter : ProjectileEmitter {

#pragma warning disable 0649
public ProjectilePrefab prefab;
public float rotationOffset = 0f;
public float rotationRange = 360f;
public int count = 5;
public int depth = 1;
public ProjectileControlBehavior controller;
#pragma warning restore 0649

private IProjectileController BurstController(int depth) {
return controller;
}

#region implemented abstract members of ProjectileEmitter

protected override void FireFromSource (SourcePoint source) {
TargetField.SpawnBurst (prefab,
source.Location,
source.BaseRotation + rotationOffset,
rotationRange,
count,
null,
depth,
BurstController,
DanmakuField.CoordinateSystem.World);
}

#endregion




}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b3351f3

Please sign in to comment.