Refactor namespaces

This commit is contained in:
Jens Pitkänen 2019-08-14 17:17:48 +03:00
parent 4475fd4305
commit 3b865bbd13
34 changed files with 56 additions and 30 deletions

View File

@ -1,4 +1,5 @@
using UnityEngine;
using Saltosion.OneWeapon.Enemies;
namespace Saltosion.OneWeapon.AI {
public abstract class AIBehaviour : MonoBehaviour {

View File

@ -1,5 +1,6 @@
using System;
using UnityEngine;
using Saltosion.OneWeapon.Enemies;
namespace Saltosion.OneWeapon.AI {
[Serializable]

View File

@ -1,5 +1,6 @@
using System;
using UnityEngine;
using Saltosion.OneWeapon.Enemies;
namespace Saltosion.OneWeapon.AI {
[Serializable]

View File

@ -1,5 +1,6 @@
using System;
using UnityEngine;
using Saltosion.OneWeapon.Enemies;
namespace Saltosion.OneWeapon.AI {
[Serializable]

View File

@ -1,4 +1,5 @@
using UnityEngine;
using Saltosion.OneWeapon.Enemies;
namespace Saltosion.OneWeapon.AI.Behaviours {
public class Follow : AIBehaviour {

View File

@ -1,6 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Saltosion.OneWeapon.Player;
using Saltosion.OneWeapon.Enemies;
namespace Saltosion.OneWeapon.AI.Behaviours {
public class MeleeAttackFollowed : AIBehaviour {

View File

@ -1,4 +1,5 @@
using UnityEngine;
using Saltosion.OneWeapon.Enemies;
namespace Saltosion.OneWeapon.AI.Behaviours {
public class Wander : AIBehaviour {

View File

@ -1,7 +1,7 @@
using UnityEngine;
using Saltosion.OneWeapon.AI;
namespace Saltosion.OneWeapon {
namespace Saltosion.OneWeapon.AI {
[RequireComponent(typeof(AI.Behaviours.Follow), typeof(AI.Triggers.EnemySighted))]
public class EnemyFollower : MonoBehaviour {
public AI.Behaviours.Follow Follow;

View File

@ -1,7 +1,7 @@
using UnityEngine;
using Saltosion.OneWeapon.AI;
namespace Saltosion.OneWeapon {
namespace Saltosion.OneWeapon.AI {
[RequireComponent(typeof(AI.Behaviours.Follow), typeof(AI.Triggers.PlayerSighted))]
public class PlayerFollower : MonoBehaviour {
public AI.Behaviours.Follow Follow;

View File

@ -1,4 +1,5 @@
using UnityEngine;
using Saltosion.OneWeapon.Enemies;
namespace Saltosion.OneWeapon.AI {
public abstract class Trigger : MonoBehaviour {

View File

@ -1,5 +1,6 @@
using UnityEngine;
using Saltosion.OneWeapon.Utils;
using Saltosion.OneWeapon.Enemies;
namespace Saltosion.OneWeapon.AI.Triggers {
public class EnemySighted : Trigger {

View File

@ -1,13 +1,15 @@
using UnityEngine;
using Saltosion.OneWeapon.Utils;
using Saltosion.OneWeapon.Player;
using Saltosion.OneWeapon.Enemies;
namespace Saltosion.OneWeapon.AI.Triggers {
public class PlayerSighted : Trigger {
public float Radius;
public Player Player { get; private set; }
public PlayerController Player { get; private set; }
public override bool IsTriggered(Enemy subject) {
Player = Util.GetClosestTo<Player>(transform, Radius, true);
Player = Util.GetClosestTo<PlayerController>(transform, Radius, true);
return Player != null;
}

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
namespace Saltosion.OneWeapon {
namespace Saltosion.OneWeapon.Effects {
public class BloodDripper : MonoBehaviour {
public Vector2 DripOffset = new Vector2(0, -0.5f);
public int DripCount = 5;

View File

@ -1,8 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Saltosion.OneWeapon.Utils;
namespace Saltosion.OneWeapon {
namespace Saltosion.OneWeapon.Effects {
public class BloodLauncher : MonoBehaviour {
private static BloodLauncher Singleton;
public GameObject StructuralParticlePrefab;

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
namespace Saltosion.OneWeapon {
namespace Saltosion.OneWeapon.Effects {
public class BloodParticle : MonoBehaviour {
public SpriteRenderer Renderer;

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
namespace Saltosion.OneWeapon {
namespace Saltosion.OneWeapon.Effects {
public class CameraFX : MonoBehaviour {
public Transform Player;
public Transform ShakeHandle;

View File

@ -1,8 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Saltosion.OneWeapon.Utils;
using Saltosion.OneWeapon.Player;
using Saltosion.OneWeapon.Enemies;
namespace Saltosion.OneWeapon {
namespace Saltosion.OneWeapon.Effects {
public class Explodable : MonoBehaviour {
public GameObject[] BodypartPrefabs;
public bool DebugExplode = false;

View File

@ -1,7 +1,7 @@
using UnityEngine;
using Saltosion.OneWeapon.AI;
namespace Saltosion.OneWeapon {
namespace Saltosion.OneWeapon.Enemies {
[RequireComponent(typeof(Rigidbody2D))]
public class Enemy : MonoBehaviour {
[Header("Debug Info")]

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
namespace Saltosion.OneWeapon {
namespace Saltosion.OneWeapon.Enemies {
public class EnemySpawner : MonoBehaviour {
public GameObject[] EnemyPrefabs;
public float SpawnCooldown = 5.0f;

View File

@ -1,8 +1,10 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Saltosion.OneWeapon.Player;
using Saltosion.OneWeapon.Effects;
namespace Saltosion.OneWeapon {
namespace Saltosion.OneWeapon.Enemies {
public class Health : MonoBehaviour {
public float MaxHealth;
public float CurrentHealth;

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Saltosion.OneWeapon.Menus {
namespace Saltosion.OneWeapon.GUI {
public class BackToMainMenuButton : MonoBehaviour {
public int MainMenuScene;

View File

@ -1,8 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Saltosion.OneWeapon.Utils;
namespace Saltosion.OneWeapon.Menus {
namespace Saltosion.OneWeapon.GUI {
public class GoreToggler : MonoBehaviour {
public GameObject GoreObject;
public GameObject CensoredObject;

View File

@ -2,8 +2,9 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Saltosion.OneWeapon.Player;
namespace Saltosion.OneWeapon {
namespace Saltosion.OneWeapon.GUI {
public class HUDController : MonoBehaviour {
public PlayerFun PlayerFun;

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Saltosion.OneWeapon.Menus {
namespace Saltosion.OneWeapon.GUI {
public class MainMenuController : MonoBehaviour {
public int PlayGameScene;
public int OptionsMenuScene;

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
namespace Saltosion.OneWeapon {
namespace Saltosion.OneWeapon.Guns {
public class Bullet : MonoBehaviour {
public Vector2 Direction;

View File

@ -1,9 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Saltosion.OneWeapon.Player;
namespace Saltosion.OneWeapon {
namespace Saltosion.OneWeapon.Guns {
public class Gun : MonoBehaviour {
public Bullet Bullet;
@ -24,7 +24,7 @@ namespace Saltosion.OneWeapon {
if (IsHeld) {
return;
}
Player Player = collider.GetComponent<Player>();
PlayerController Player = collider.GetComponent<PlayerController>();
if (Player != null) {
IsHeld = true;
Player.SetGun(this);

View File

@ -1,8 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Saltosion.OneWeapon.Player;
using Saltosion.OneWeapon.Enemies;
using Saltosion.OneWeapon.Effects;
namespace Saltosion.OneWeapon.Bullets {
namespace Saltosion.OneWeapon.Guns {
[RequireComponent(typeof(Bullet))]
public class RevolverBullet : MonoBehaviour {
@ -32,7 +35,7 @@ namespace Saltosion.OneWeapon.Bullets {
}
void OnTriggerEnter2D(Collider2D collider) {
if (collider.GetComponent<Player>() != null) {
if (collider.GetComponent<PlayerController>() != null) {
// don't hit the player!
return;
}

View File

@ -4,9 +4,10 @@ using UnityEngine;
using UnityEngine.Animations;
using Saltosion.OneWeapon.Effects;
using Saltosion.OneWeapon.Utils;
using Saltosion.OneWeapon.Guns;
namespace Saltosion.OneWeapon {
public class Player : MonoBehaviour {
namespace Saltosion.OneWeapon.Player {
public class PlayerController : MonoBehaviour {
public Rigidbody2D Body;
public Transform Hand;

View File

@ -3,10 +3,10 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Saltosion.OneWeapon {
namespace Saltosion.OneWeapon.Player {
public class PlayerFun : MonoBehaviour {
public Player Player;
public PlayerController Player;
public float MaxFun = 100;
public float FunDegradeSpeed = 5;

View File

@ -1,8 +1,10 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Saltosion.OneWeapon.Enemies;
using Saltosion.OneWeapon.Effects;
namespace Saltosion.OneWeapon {
namespace Saltosion.OneWeapon.Player {
public class PunchingHand : MonoBehaviour {
public bool Punching = false;

View File

@ -2,7 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
namespace Saltosion.OneWeapon {
namespace Saltosion.OneWeapon.Utils {
public class CameraHelper : MonoBehaviour {
public Camera Camera;
[Range(1, 4)]

View File

@ -1,4 +1,4 @@
namespace Saltosion.OneWeapon {
namespace Saltosion.OneWeapon.Utils {
public class Options {
public static bool CensorGore = false;
}