Add namespaces

This commit is contained in:
Adam Ramberg 2020-03-18 02:04:33 +01:00
parent a90a336980
commit 60bfe01b84
8 changed files with 141 additions and 121 deletions

View File

@ -2,8 +2,10 @@
using UnityEngine.Assertions;
using UnityAtoms.BaseAtoms;
public class DestroyMe : MonoBehaviour
namespace UnityAtoms.Examples
{
public class DestroyMe : MonoBehaviour
{
[SerializeField]
FloatReference _delay = new FloatReference(-1f);
@ -25,4 +27,5 @@ public class DestroyMe : MonoBehaviour
DestroyImmediate();
}
}
}
}

View File

@ -1,7 +1,9 @@
using UnityEngine;
public static class Rigidbody2DExtensions
namespace UnityAtoms.Examples
{
public static class Rigidbody2DExtensions
{
public static void Move(this Rigidbody2D body, Vector2 input, float speed, float deltaTime)
{
var direction = input.normalized;
@ -14,4 +16,5 @@ public static class Rigidbody2DExtensions
body.transform.rotation = Quaternion.AngleAxis(lookAtTargetAngle, Vector3.forward);
}
}
}
}

View File

@ -1,11 +1,14 @@
using UnityEngine;
using UnityAtoms.BaseAtoms;
public class UnitHealth : MonoBehaviour
namespace UnityAtoms.Examples
{
public class UnitHealth : MonoBehaviour
{
public int Health { get => _health.Value; set => _health.Value = value; }
[SerializeField]
private IntReference _health;
}
}

View File

@ -1,8 +1,10 @@
using UnityEngine;
using UnityAtoms.FSM;
public class GameStateDispatcher : MonoBehaviour
namespace UnityAtoms.Examples
{
public class GameStateDispatcher : MonoBehaviour
{
[SerializeField]
private FiniteStateMachineReference _gameStateRef;
@ -13,4 +15,5 @@ public class GameStateDispatcher : MonoBehaviour
_gameStateRef.Machine.Dispatch("SetGameOver");
}
}
}
}

View File

@ -1,8 +1,10 @@
using UnityAtoms.BaseAtoms;
using UnityEngine;
public class PlayerShooting : MonoBehaviour
namespace UnityAtoms.Examples
{
public class PlayerShooting : MonoBehaviour
{
[SerializeField]
private GameObject _projectile;
@ -45,4 +47,5 @@ public class PlayerShooting : MonoBehaviour
projectile.GetComponent<DecreaseHealth>().TagsAffected.Remove(_playerTag); // Turn off friendly fire
}
}
}
}

View File

@ -1,13 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Assertions;
using UnityAtoms.BaseAtoms;
using UnityAtoms;
using UnityAtoms.Tags;
public class DecreaseHealth : MonoBehaviour
namespace UnityAtoms.Examples
{
public class DecreaseHealth : MonoBehaviour
{
public List<StringConstant> TagsAffected { get => _tags; }
[SerializeField]
@ -39,4 +39,5 @@ public class DecreaseHealth : MonoBehaviour
_didCollide.Event.Raise();
}
}
}
}

View File

@ -1,11 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine;
using UnityAtoms.BaseAtoms;
[RequireComponent(typeof(Rigidbody2D))]
public class MoveInDirection : MonoBehaviour
namespace UnityAtoms.Examples
{
[RequireComponent(typeof(Rigidbody2D))]
public class MoveInDirection : MonoBehaviour
{
public float Speed { set => _speed.Value = value; }
[SerializeField]
@ -23,4 +23,5 @@ public class MoveInDirection : MonoBehaviour
{
rb.velocity = transform.right * _speed.Value;
}
}
}

View File

@ -1,7 +1,10 @@
using UnityEngine;
using UnityEngine.SceneManagement;
public class RestartCurrentScene : MonoBehaviour
namespace UnityAtoms.Examples
{
public class RestartCurrentScene : MonoBehaviour
{
public void Do() => SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
}