Project cleanup
This commit is contained in:
parent
0cf7f6401b
commit
4151ba0050
|
@ -73,3 +73,4 @@ crashlytics-build.properties
|
||||||
/[Aa]ssets/[Ss]treamingAssets/aa/*
|
/[Aa]ssets/[Ss]treamingAssets/aa/*
|
||||||
|
|
||||||
game_notes/.obsidian
|
game_notes/.obsidian
|
||||||
|
.idea/.idea.AsteroidGame/.idea/dictionaries
|
||||||
|
|
|
@ -406,11 +406,12 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: a8e2a3a5a069cea4cbe59c093201d8dc, type: 3}
|
m_Script: {fileID: 11500000, guid: a8e2a3a5a069cea4cbe59c093201d8dc, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
health: 0
|
_health: 0
|
||||||
maxHealth: 0
|
_maxHealth: 0
|
||||||
isInvulnerable: 0
|
_isInvulnerable: 0
|
||||||
centerPosition: {fileID: 3291032053430181389}
|
_centerPosition: {fileID: 3291032053430181389}
|
||||||
basePosition: {fileID: 2692714622321691895}
|
_basePosition: {fileID: 2692714622321691895}
|
||||||
|
_uiFriendlyName: Enemy
|
||||||
--- !u!1 &6940800288144322101
|
--- !u!1 &6940800288144322101
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
using AsteroidGame.Entities.Structures.Tower;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace AsteroidGame.Entities.Enemies.Scripts
|
namespace AsteroidGame.Entities.Enemies.Scripts
|
||||||
|
@ -10,23 +9,23 @@ namespace AsteroidGame.Entities.Enemies.Scripts
|
||||||
// [SerializeField] ScoreHandler scoreHandler;
|
// [SerializeField] ScoreHandler scoreHandler;
|
||||||
|
|
||||||
[Header("Parameters")]
|
[Header("Parameters")]
|
||||||
[SerializeField] int maxHealth = 5;
|
[SerializeField] int _maxHealth = 5;
|
||||||
[SerializeField] int difficultyRamp = 1;
|
[SerializeField] int _difficultyRamp = 1;
|
||||||
|
|
||||||
[SerializeField] int wealthValue = 5;
|
[SerializeField] int _wealthValue = 5;
|
||||||
|
|
||||||
[Header("Stats")]
|
[Header("Stats")]
|
||||||
[SerializeField] int currentHealth;
|
[SerializeField] int _currentHealth;
|
||||||
|
|
||||||
#region Public
|
#region Public
|
||||||
public int Health { get=> currentHealth;}
|
public int Health { get=> _currentHealth;}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
void OnEnable()
|
void OnEnable()
|
||||||
{
|
{
|
||||||
// enemyHandler = FindObjectOfType<EnemyHandler>();
|
// enemyHandler = FindObjectOfType<EnemyHandler>();
|
||||||
// scoreHandler = FindObjectOfType<ScoreHandler>();
|
// scoreHandler = FindObjectOfType<ScoreHandler>();
|
||||||
currentHealth = maxHealth;
|
_currentHealth = _maxHealth;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnParticleCollision(GameObject damager)
|
private void OnParticleCollision(GameObject damager)
|
||||||
|
@ -39,11 +38,11 @@ namespace AsteroidGame.Entities.Enemies.Scripts
|
||||||
// SpawnFX(damageVFX);
|
// SpawnFX(damageVFX);
|
||||||
|
|
||||||
// Debug.Log(damager.GetComponentInParent<Tower>().GetDamage());
|
// Debug.Log(damager.GetComponentInParent<Tower>().GetDamage());
|
||||||
currentHealth -= damager.GetComponentInParent<Turret>().Damage;
|
_currentHealth -= damager.GetComponentInParent<Turret>().Damage;
|
||||||
|
|
||||||
//UpdateHealthText(health);
|
//UpdateHealthText(health);
|
||||||
|
|
||||||
if(currentHealth <= 0)
|
if(_currentHealth <= 0)
|
||||||
{
|
{
|
||||||
ProcessDeathFrom(damager);
|
ProcessDeathFrom(damager);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +57,7 @@ namespace AsteroidGame.Entities.Enemies.Scripts
|
||||||
// enemyHandler.RemoveEnemy(gameObject);
|
// enemyHandler.RemoveEnemy(gameObject);
|
||||||
// Destroy(gameObject);
|
// Destroy(gameObject);
|
||||||
gameObject.SetActive(false);
|
gameObject.SetActive(false);
|
||||||
maxHealth += difficultyRamp;
|
_maxHealth += _difficultyRamp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,19 +6,19 @@ namespace AsteroidGame.Entities.Enemies
|
||||||
public class EnemyMovement : MonoBehaviour
|
public class EnemyMovement : MonoBehaviour
|
||||||
{
|
{
|
||||||
[Header("Parameters")]
|
[Header("Parameters")]
|
||||||
[SerializeField] [Range(0f, 5f)] float speed = 1f;
|
[SerializeField] [Range(0f, 5f)] float _speed = 1f;
|
||||||
[SerializeField] int damage = 1;
|
[SerializeField] int _damage = 1;
|
||||||
|
|
||||||
|
|
||||||
// [SerializeField] EnemyHandler enemyHandler;
|
// [SerializeField] EnemyHandler enemyHandler;
|
||||||
// [SerializeField] ScoreHandler scoreHandler;
|
// [SerializeField] ScoreHandler scoreHandler;
|
||||||
|
|
||||||
|
|
||||||
Vector3 startPosition;
|
Vector3 _startPosition;
|
||||||
Vector3 endPosition;
|
Vector3 _endPosition;
|
||||||
float travelPercent = 0f;
|
float _travelPercent = 0f;
|
||||||
|
|
||||||
private IEnumerator followPath;
|
private IEnumerator _followPath;
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
|
@ -35,10 +35,10 @@ namespace AsteroidGame.Entities.Enemies
|
||||||
|
|
||||||
void RecalculatePath()
|
void RecalculatePath()
|
||||||
{
|
{
|
||||||
if (followPath != null)
|
if (_followPath != null)
|
||||||
{
|
{
|
||||||
//Debug.Log("Stopping Coroutine");
|
//Debug.Log("Stopping Coroutine");
|
||||||
StopCoroutine(followPath);
|
StopCoroutine(_followPath);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,9 +52,9 @@ namespace AsteroidGame.Entities.Enemies
|
||||||
gameObject.SetActive(false);
|
gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector3 GetVector3(Vector2Int _coord)
|
private Vector3 GetVector3(Vector2Int coord)
|
||||||
{
|
{
|
||||||
return new Vector3((float)_coord.x, 0f, (float)_coord.y) * 10f;
|
return new Vector3((float)coord.x, 0f, (float)coord.y) * 10f;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,78 +6,57 @@ namespace AsteroidGame.Entities
|
||||||
public class EntityBase : MonoBehaviour, IDamageable, ITargetable
|
public class EntityBase : MonoBehaviour, IDamageable, ITargetable
|
||||||
{
|
{
|
||||||
[Header("Health")]
|
[Header("Health")]
|
||||||
[SerializeField] protected int health;
|
[SerializeField] protected int _health;
|
||||||
[SerializeField] protected int maxHealth;
|
[SerializeField] protected int _maxHealth;
|
||||||
[SerializeField] protected bool isInvulnerable;
|
[SerializeField] protected bool _isInvulnerable;
|
||||||
|
|
||||||
[Header("TargetPositions")]
|
[Header("TargetPositions")]
|
||||||
[SerializeField] private Transform centerPosition;
|
[SerializeField] private Transform _centerPosition;
|
||||||
[SerializeField] private Transform basePosition;
|
[SerializeField] private Transform _basePosition;
|
||||||
|
|
||||||
[Header("UI")]
|
[Header("UI")]
|
||||||
[SerializeField]protected string uiFriendlyName;
|
[SerializeField] protected string _uiFriendlyName;
|
||||||
|
|
||||||
#region Props
|
#region Props
|
||||||
|
|
||||||
public bool IsInvulnerable => isInvulnerable;
|
public bool IsInvulnerable => _isInvulnerable;
|
||||||
public string UiFriendlyName => uiFriendlyName;
|
public string UiFriendlyName => _uiFriendlyName;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|
||||||
public void ModifyHealth(int healthChange)
|
public void ModifyHealth(int healthChange)
|
||||||
{
|
{
|
||||||
if (!isInvulnerable)
|
if (!_isInvulnerable)
|
||||||
{
|
{
|
||||||
health += healthChange;
|
_health += healthChange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Setters
|
#region Setters
|
||||||
public void SetHealth(int newHealth)
|
|
||||||
{
|
|
||||||
health = newHealth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetMaxHealth(int newHealth)
|
public void SetHealth(int newHealth) => _health = newHealth;
|
||||||
{
|
|
||||||
maxHealth = newHealth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetInvulnerable(bool newState)
|
public void SetMaxHealth(int newHealth) => _maxHealth = newHealth;
|
||||||
{
|
|
||||||
isInvulnerable = newState;
|
public void SetInvulnerable(bool newState) => _isInvulnerable = newState;
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Getters
|
#region Getters
|
||||||
|
|
||||||
public Vector3 GetCenterPosition()
|
public Vector3 GetCenterPosition() => _centerPosition.transform.position;
|
||||||
{
|
|
||||||
return centerPosition.transform.position;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector3 GetBasePosition()
|
public Vector3 GetBasePosition() => _basePosition.transform.position;
|
||||||
{
|
|
||||||
return basePosition.transform.position;
|
|
||||||
}
|
|
||||||
public int GetHealth()
|
|
||||||
{
|
|
||||||
return health;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetMaxHealth()
|
public int GetHealth() => _health;
|
||||||
{
|
|
||||||
return maxHealth;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float GetHealthFactor()
|
public int GetMaxHealth() => _maxHealth;
|
||||||
{
|
|
||||||
// ReSharper disable once PossibleLossOfFraction
|
public float GetHealthFactor() => (float)_health / (float)_maxHealth;
|
||||||
return health / maxHealth;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 652265e583504f4479d63342d0afb59d, type: 3}
|
||||||
|
m_Name: AllStructures
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
_structureList:
|
||||||
|
- {fileID: 8787361557661825162, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
|
- {fileID: 5166195223278443568, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a6bec5a151656ac428c38df1675ee2e4
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -12,6 +12,6 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: 652265e583504f4479d63342d0afb59d, type: 3}
|
m_Script: {fileID: 11500000, guid: 652265e583504f4479d63342d0afb59d, type: 3}
|
||||||
m_Name: AvailableStructures
|
m_Name: AvailableStructures
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
structureList:
|
_structureList:
|
||||||
- {fileID: 8787361557661825162, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
- {fileID: 8787361557661825162, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
- {fileID: 5166195223278443568, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
- {fileID: 5166195223278443568, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
using AsteroidGame.Entities.Structures.Scripts;
|
namespace AsteroidGame.Entities
|
||||||
using AsteroidGame.Interfaces;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace AsteroidGame.Entities.Structures.PowerPlant
|
|
||||||
{
|
{
|
||||||
public class PowerPlant : StructureBase
|
public class PowerPlant : StructureBase
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -46,19 +46,19 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: b5b8b24a2cbe7294c90fb34afeca78e7, type: 3}
|
m_Script: {fileID: 11500000, guid: b5b8b24a2cbe7294c90fb34afeca78e7, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
health: 0
|
_health: 10
|
||||||
maxHealth: 0
|
_maxHealth: 0
|
||||||
isInvulnerable: 0
|
_isInvulnerable: 0
|
||||||
centerPosition: {fileID: 0}
|
_centerPosition: {fileID: 1841478903898566568}
|
||||||
basePosition: {fileID: 493861824998956378}
|
_basePosition: {fileID: 493861824998956378}
|
||||||
uiFriendlyName: Power\nPlant
|
_uiFriendlyName: Power\nPlant
|
||||||
cost: 0
|
_cost: 100
|
||||||
buildPlacementBlocked: 0
|
_buildPlacementBlocked: 0
|
||||||
buildTimer: 0
|
_buildTimer: 0
|
||||||
isPowerGenerator: 1
|
_isGenerator: 1
|
||||||
isPowerConsumer: 0
|
_isConsumer: 0
|
||||||
maxPower: 100
|
_maxPower: 100
|
||||||
currentPower: 0
|
_currentPower: 0
|
||||||
--- !u!1 &1863277996181035512
|
--- !u!1 &1863277996181035512
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 91195dc9638557a4aa7380bb7bb3c5cc
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,23 @@
|
||||||
|
using AsteroidGame.Interfaces;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace AsteroidGame.Entities
|
||||||
|
{
|
||||||
|
public class SWeaponConfig : ScriptableObject, IWeapon
|
||||||
|
{
|
||||||
|
[SerializeField] private float _fireRate;
|
||||||
|
[SerializeField] private float _damage;
|
||||||
|
|
||||||
|
public float FireRate
|
||||||
|
{
|
||||||
|
get => _fireRate;
|
||||||
|
set => _fireRate = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float Damage
|
||||||
|
{
|
||||||
|
get => _damage;
|
||||||
|
set => _damage = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 19bf3f6dd184a48499aff1db728edfcd
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -1,89 +1,73 @@
|
||||||
using System;
|
|
||||||
using AsteroidGame.Interfaces;
|
using AsteroidGame.Interfaces;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Serialization;
|
|
||||||
|
|
||||||
namespace AsteroidGame.Entities.Structures.Scripts
|
namespace AsteroidGame.Entities
|
||||||
{
|
{
|
||||||
public class StructureBase : EntityBase, IBuildable, IPowerSystem
|
public class StructureBase : EntityBase, IBuildable, IPowerSystem
|
||||||
{
|
{
|
||||||
[Header("BuildParameters")]
|
[Header("BuildParameters")]
|
||||||
[SerializeField]
|
[SerializeField] protected int _cost;
|
||||||
protected int cost;
|
[SerializeField] private bool _buildPlacementBlocked;
|
||||||
|
[SerializeField] protected float _buildTimer;
|
||||||
[SerializeField] private bool buildPlacementBlocked;
|
|
||||||
[SerializeField] protected float buildTimer;
|
|
||||||
|
|
||||||
[Header("Power")]
|
[Header("Power")]
|
||||||
[SerializeField] protected bool isPowerGenerator;
|
[SerializeField] protected bool _isGenerator;
|
||||||
[SerializeField] protected bool isPowerConsumer;
|
[SerializeField] protected bool _isConsumer;
|
||||||
[SerializeField] protected int maxPower;
|
[SerializeField] protected int _maxPower;
|
||||||
[SerializeField] protected int currentPower;
|
[SerializeField] protected int _currentPower;
|
||||||
|
|
||||||
#region Private
|
#region Private
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Publics
|
#region Publics
|
||||||
public bool IsPowerGenerator => isPowerGenerator;
|
|
||||||
public bool IsPowerConsumer => isPowerConsumer;
|
public bool IsGenerator => _isGenerator;
|
||||||
public bool BuildPlacementBlocked => buildPlacementBlocked;
|
public bool IsConsumer => _isConsumer;
|
||||||
public int Cost => cost;
|
public bool BuildPlacementBlocked => _buildPlacementBlocked;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
if (!isPowerConsumer && !isPowerGenerator)
|
if (!_isConsumer && !_isGenerator)
|
||||||
{
|
{
|
||||||
Debug.Log("Power consumer/generator not set!");
|
Debug.LogWarning("Power consumer/generator not set!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTriggerStay(Collider other)
|
private void OnTriggerStay(Collider other)
|
||||||
{
|
{
|
||||||
if(other.name == "BuildCollider")
|
if (other.name == "BuildCollider")
|
||||||
{
|
{
|
||||||
buildPlacementBlocked = true;
|
_buildPlacementBlocked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTriggerExit(Collider other)
|
private void OnTriggerExit(Collider other)
|
||||||
{
|
{
|
||||||
if(other.name == "BuildCollider")
|
if (other.name == "BuildCollider")
|
||||||
{
|
{
|
||||||
buildPlacementBlocked = false;
|
_buildPlacementBlocked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Setters
|
#region Setters
|
||||||
|
|
||||||
public void SetMaxPower(int newValue)
|
public void SetMaxPower(int newValue) => _maxPower = newValue;
|
||||||
{
|
public int SetCost(int newCost) => _cost = newCost;
|
||||||
maxPower = newValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Getters
|
#region Getters
|
||||||
|
|
||||||
public int GetMaxPower()
|
public int GetMaxPower() => _maxPower;
|
||||||
{
|
|
||||||
return maxPower;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetCurrentPower()
|
public int GetCurrentPower() => _currentPower;
|
||||||
{
|
|
||||||
return currentPower;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float GetPowerFactor()
|
public float GetPowerFactor() => (float)_currentPower / _maxPower;
|
||||||
{
|
|
||||||
// ReSharper disable once PossibleLossOfFraction
|
public int GetCost() => _cost;
|
||||||
return currentPower / maxPower;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEditor;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace AsteroidGame.Entities.Structures.Scripts
|
namespace AsteroidGame.Entities
|
||||||
{
|
{
|
||||||
|
[CreateAssetMenu(fileName = "newStructureList", menuName = "Structures/StructureList")]
|
||||||
public class StructureBaseScriptableObject : ScriptableObject
|
public class StructureBaseScriptableObject : ScriptableObject
|
||||||
{
|
{
|
||||||
public List<StructureBase> structureList;
|
public List<StructureBase> _structureList;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static class MakeScriptableObject
|
// public static class MakeScriptableObject
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e9db218efcae6ef47ac0d9eb96240cb0
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -1,42 +1,36 @@
|
||||||
using AsteroidGame.Entities.Enemies.Scripts;
|
using AsteroidGame.Entities.Enemies.Scripts;
|
||||||
using AsteroidGame.Entities.Structures.Scripts;
|
|
||||||
using AsteroidGame.Interfaces;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace AsteroidGame.Entities.Structures.Tower
|
namespace AsteroidGame.Entities
|
||||||
{
|
{
|
||||||
public class Turret : StructureBase
|
public class Turret : StructureBase
|
||||||
{
|
{
|
||||||
[Header("WeaponParameters")] [SerializeField]
|
[Header("WeaponParameters")] [SerializeField]
|
||||||
private float weaponRange = 40f;
|
private float _weaponRange = 40f;
|
||||||
|
|
||||||
[SerializeField] private int damage = 1;
|
[SerializeField] private int _damage = 1;
|
||||||
[SerializeField] private float fireRate = 1;
|
[SerializeField] private float _fireRate = 1;
|
||||||
[SerializeField] private float projectileSpeed = 5;
|
[SerializeField] private float _projectileSpeed = 5;
|
||||||
[SerializeField] private TargetStrategy targetStrategy = TargetStrategy.LowestHealth;
|
[SerializeField] private TargetStrategy _targetStrategy = TargetStrategy.LowestHealth;
|
||||||
|
|
||||||
[Header("Stats")]
|
[Header("Stats")]
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private float score = 0f;
|
private float _score = 0f;
|
||||||
|
|
||||||
|
|
||||||
[Header("RigConnections")]
|
[Header("RigConnections")]
|
||||||
[SerializeField] private Transform turretHead;
|
[SerializeField] private Transform _turretHead;
|
||||||
[SerializeField] private Transform barrel;
|
[SerializeField] private Transform _barrel;
|
||||||
|
|
||||||
#region Privates
|
#region Privates
|
||||||
|
|
||||||
|
[SerializeField] private enum TargetStrategy
|
||||||
[SerializeField]
|
|
||||||
enum TargetStrategy
|
|
||||||
{
|
{
|
||||||
ClosestEnemy,
|
ClosestEnemy,
|
||||||
LowestHealth
|
LowestHealth
|
||||||
};
|
};
|
||||||
|
|
||||||
[SerializeField] private EnemyBase targetEnemy;
|
[SerializeField] private EnemyBase _targetEnemy;
|
||||||
[SerializeField] private Transform[] buildingParts;
|
[SerializeField] private Transform[] _buildingParts;
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -46,8 +40,8 @@ namespace AsteroidGame.Entities.Structures.Tower
|
||||||
|
|
||||||
public int Damage
|
public int Damage
|
||||||
{
|
{
|
||||||
get => damage;
|
get => _damage;
|
||||||
set => damage = value;
|
set => _damage = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int FireRate { get; set; }
|
public int FireRate { get; set; }
|
||||||
|
@ -56,22 +50,22 @@ namespace AsteroidGame.Entities.Structures.Tower
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
targetEnemy = FindObjectOfType<EnemyBase>();
|
_targetEnemy = FindObjectOfType<EnemyBase>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
// enemyHandler = FindObjectOfType<EnemyHandler>();
|
// enemyHandler = FindObjectOfType<EnemyHandler>();
|
||||||
// scoreHandler = FindObjectOfType<ScoreHandler>();
|
// scoreHandler = FindObjectOfType<ScoreHandler>();
|
||||||
UpdateWeaponParameters(fireRate, projectileSpeed);
|
UpdateWeaponParameters(_fireRate, _projectileSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
turretHead.transform.LookAt(targetEnemy.GetCenterPosition());
|
_turretHead.transform.LookAt(_targetEnemy.GetCenterPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateWeaponParameters(float _fireRate, float _projectileSpeed)
|
private void UpdateWeaponParameters(float fireRate, float projectileSpeed)
|
||||||
{
|
{
|
||||||
// var main = _projectile.main;
|
// var main = _projectile.main;
|
||||||
// main.startSpeed = _projectileSpeed;
|
// main.startSpeed = _projectileSpeed;
|
||||||
|
@ -126,22 +120,5 @@ namespace AsteroidGame.Entities.Structures.Tower
|
||||||
// ShootProjectile(true);
|
// ShootProjectile(true);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// private void OnTriggerEnter(Collider other)
|
|
||||||
// {
|
|
||||||
// print($"TriggerEnter: {other.name}");
|
|
||||||
// // if(other.name == "BuildCollider")
|
|
||||||
// // {
|
|
||||||
// // _buildPlacementBlocked = true;
|
|
||||||
// // }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void OnTriggerExit(Collider other)
|
|
||||||
// {
|
|
||||||
// print($"TriggerExit: {other.name}");
|
|
||||||
// // if(other.name == "BuildCollider")
|
|
||||||
// // {
|
|
||||||
// // _buildPlacementBlocked = false;
|
|
||||||
// // }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -692,7 +692,7 @@ BoxCollider:
|
||||||
m_IsTrigger: 1
|
m_IsTrigger: 1
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Size: {x: 1, y: 1, z: 1}
|
m_Size: {x: 1, y: 1.0236204, z: 1}
|
||||||
m_Center: {x: 0, y: 0, z: 0}
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &8704396752535238434
|
--- !u!1 &8704396752535238434
|
||||||
GameObject:
|
GameObject:
|
||||||
|
@ -742,26 +742,26 @@ MonoBehaviour:
|
||||||
m_Script: {fileID: 11500000, guid: d3a16cf44e28f02409c23498ed14acf5, type: 3}
|
m_Script: {fileID: 11500000, guid: d3a16cf44e28f02409c23498ed14acf5, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
health: 50
|
_health: 10
|
||||||
maxHealth: 50
|
_maxHealth: 0
|
||||||
isInvulnerable: 0
|
_isInvulnerable: 0
|
||||||
centerPosition: {fileID: 5103935544759496321}
|
_centerPosition: {fileID: 5103935544759496321}
|
||||||
basePosition: {fileID: 8324879816836607384}
|
_basePosition: {fileID: 8324879816836607384}
|
||||||
uiFriendlyName: Turret
|
_uiFriendlyName: Turret
|
||||||
cost: 20
|
_cost: 10
|
||||||
buildPlacementBlocked: 0
|
_buildPlacementBlocked: 0
|
||||||
buildTimer: 1
|
_buildTimer: 0
|
||||||
isPowerGenerator: 0
|
_isGenerator: 0
|
||||||
isPowerConsumer: 1
|
_isConsumer: 1
|
||||||
maxPower: 10
|
_maxPower: 10
|
||||||
currentPower: 0
|
_currentPower: 0
|
||||||
weaponRange: 40
|
_weaponRange: 40
|
||||||
damage: 1
|
_damage: 1
|
||||||
fireRate: 1
|
_fireRate: 1
|
||||||
projectileSpeed: 5
|
_projectileSpeed: 5
|
||||||
targetStrategy: 1
|
_targetStrategy: 1
|
||||||
score: 0
|
_score: 0
|
||||||
turretHead: {fileID: 5103935544653627402}
|
_turretHead: {fileID: 5103935544653627402}
|
||||||
barrel: {fileID: 5103935545559248087}
|
_barrel: {fileID: 5103935545559248087}
|
||||||
targetEnemy: {fileID: 0}
|
_targetEnemy: {fileID: 0}
|
||||||
buildingParts: []
|
_buildingParts: []
|
|
@ -1,5 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using AsteroidGame.Entities.Structures.Scripts;
|
using AsteroidGame.Entities;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
|
|
||||||
|
@ -8,23 +8,23 @@ namespace AsteroidGame.Handlers
|
||||||
public class BuildingHandler : HandlerBase
|
public class BuildingHandler : HandlerBase
|
||||||
{
|
{
|
||||||
[Header("Config")]
|
[Header("Config")]
|
||||||
[SerializeField] private Color colorGhost = new Color(1f, 1f, 1f, 0.12f);
|
[SerializeField] private Color _colorGhost = new Color(1f, 1f, 1f, 0.12f);
|
||||||
[SerializeField] private Color colorBuildingBlocked = new Color(1f, 0f, 0f, 0.12f);
|
[SerializeField] private Color _colorBuildingBlocked = new Color(1f, 0f, 0f, 0.12f);
|
||||||
[SerializeField] private Material ghostStructureMaterial;
|
[SerializeField] private Material _ghostStructureMaterial;
|
||||||
|
|
||||||
[Header("State")]
|
[Header("State")]
|
||||||
[SerializeField] private bool isBuilding;
|
[SerializeField] private bool _isBuilding;
|
||||||
[SerializeField] private int buildingSelector;
|
[SerializeField] private int _buildingSelector;
|
||||||
|
|
||||||
[Header("Structures")]
|
[Header("Structures")]
|
||||||
[SerializeField] private StructureBaseScriptableObject availableStructuresObject;
|
[SerializeField] private StructureBaseScriptableObject _availableStructuresObject;
|
||||||
|
|
||||||
#region Private
|
#region Private
|
||||||
|
|
||||||
private Dictionary<int, StructureBase> _availableStructures = new();
|
private readonly Dictionary<int, StructureBase> _availableStructures = new();
|
||||||
[SerializeField] private Color colorCurrent;
|
private Color _colorCurrent;
|
||||||
private Camera _camera;
|
private Camera _camera;
|
||||||
[SerializeField] private List<StructureBase> activeStructures;
|
[SerializeField] private List<StructureBase> _activeStructures;
|
||||||
private Vector3 _tempVec;
|
private Vector3 _tempVec;
|
||||||
private Plane _buildPlane;
|
private Plane _buildPlane;
|
||||||
private StructureBase _tempStructure;
|
private StructureBase _tempStructure;
|
||||||
|
@ -36,31 +36,31 @@ namespace AsteroidGame.Handlers
|
||||||
protected override void OnEnable()
|
protected override void OnEnable()
|
||||||
{
|
{
|
||||||
base.OnEnable();
|
base.OnEnable();
|
||||||
for (int i = 0; i < availableStructuresObject.structureList.Count; i++)
|
for (int i = 0; i < _availableStructuresObject._structureList.Count; i++)
|
||||||
{
|
{
|
||||||
_availableStructures.Add(i, availableStructuresObject.structureList[i]);
|
_availableStructures.Add(i, _availableStructuresObject._structureList[i]);
|
||||||
}
|
}
|
||||||
_camera = Camera.main;
|
_camera = Camera.main;
|
||||||
_buildPlane = new Plane(Vector3.up, Vector3.zero);
|
_buildPlane = new Plane(Vector3.up, Vector3.zero);
|
||||||
activeStructures.Clear();
|
_activeStructures.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
if (!isBuilding) return;
|
if (!_isBuilding) return;
|
||||||
_ghostStructure.transform.position = GetPlanePoint();
|
_ghostStructure.transform.position = GetPlanePoint();
|
||||||
SetGhostColor(_ghostStructure.BuildPlacementBlocked ? colorBuildingBlocked : colorGhost);
|
SetGhostColor(_ghostStructure.BuildPlacementBlocked ? _colorBuildingBlocked : _colorGhost);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetGhostColor(Color newColor)
|
private void SetGhostColor(Color newColor)
|
||||||
{
|
{
|
||||||
if (newColor == colorCurrent) return;
|
if (newColor == _colorCurrent) return;
|
||||||
foreach (var meshRenderer in _ghostStructureMeshRenderers)
|
foreach (var meshRenderer in _ghostStructureMeshRenderers)
|
||||||
{
|
{
|
||||||
meshRenderer.material.color = newColor;
|
meshRenderer.material.color = newColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
colorCurrent = newColor;
|
_colorCurrent = newColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnLeftClick(InputAction.CallbackContext context)
|
protected override void OnLeftClick(InputAction.CallbackContext context)
|
||||||
|
@ -75,41 +75,41 @@ namespace AsteroidGame.Handlers
|
||||||
|
|
||||||
protected override void OnBuild(InputAction.CallbackContext context)
|
protected override void OnBuild(InputAction.CallbackContext context)
|
||||||
{
|
{
|
||||||
EnterBuildMode(buildingSelector);
|
EnterBuildMode(_buildingSelector);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlaceStructure()
|
private void PlaceStructure()
|
||||||
{
|
{
|
||||||
if (!isBuilding) return;
|
if (!_isBuilding) return;
|
||||||
if (_ghostStructure.BuildPlacementBlocked) return;
|
if (_ghostStructure.BuildPlacementBlocked) return;
|
||||||
if (!Keyboard.current.shiftKey.isPressed)
|
if (!Keyboard.current.shiftKey.isPressed)
|
||||||
{
|
{
|
||||||
DestroyGhostStructure();
|
DestroyGhostStructure();
|
||||||
isBuilding = false;
|
_isBuilding = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpawnStructure();
|
SpawnStructure();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AbortPlaceStructure()
|
private void AbortPlaceStructure()
|
||||||
{
|
{
|
||||||
if (!isBuilding) return;
|
if (!_isBuilding) return;
|
||||||
DestroyGhostStructure();
|
DestroyGhostStructure();
|
||||||
isBuilding = false;
|
_isBuilding = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EnterBuildMode(int index)
|
public void EnterBuildMode(int index)
|
||||||
{
|
{
|
||||||
if (isBuilding) return;
|
if (_isBuilding) return;
|
||||||
isBuilding = true;
|
_isBuilding = true;
|
||||||
SetBuildingIndex(index);
|
SetBuildingIndex(index);
|
||||||
SpawnGhostStructure();
|
SpawnGhostStructure();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SpawnGhostStructure()
|
private void SpawnGhostStructure()
|
||||||
{
|
{
|
||||||
_ghostStructure = Instantiate(_availableStructures[buildingSelector], GetPlanePoint(), Quaternion.identity, transform);
|
_ghostStructure = Instantiate(_availableStructures[_buildingSelector], GetPlanePoint(), Quaternion.identity, transform);
|
||||||
_ghostStructure.name = "GhostStructure";
|
_ghostStructure.name = "GhostStructure";
|
||||||
|
|
||||||
var rb = _ghostStructure.gameObject.AddComponent<Rigidbody>();
|
var rb = _ghostStructure.gameObject.AddComponent<Rigidbody>();
|
||||||
|
@ -119,7 +119,7 @@ namespace AsteroidGame.Handlers
|
||||||
|
|
||||||
foreach (var meshRenderer in _ghostStructureMeshRenderers)
|
foreach (var meshRenderer in _ghostStructureMeshRenderers)
|
||||||
{
|
{
|
||||||
meshRenderer.material = ghostStructureMaterial;
|
meshRenderer.material = _ghostStructureMaterial;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ghostStructure.GetComponent<StructureBase>().enabled = false;
|
_ghostStructure.GetComponent<StructureBase>().enabled = false;
|
||||||
|
@ -132,8 +132,8 @@ namespace AsteroidGame.Handlers
|
||||||
|
|
||||||
private void SpawnStructure()
|
private void SpawnStructure()
|
||||||
{
|
{
|
||||||
_tempStructure = Instantiate(_availableStructures[buildingSelector], GetPlanePoint(), Quaternion.identity, transform);
|
_tempStructure = Instantiate(_availableStructures[_buildingSelector], GetPlanePoint(), Quaternion.identity, transform);
|
||||||
activeStructures.Add(_tempStructure);
|
_activeStructures.Add(_tempStructure);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Getters
|
#region Getters
|
||||||
|
@ -157,7 +157,7 @@ namespace AsteroidGame.Handlers
|
||||||
|
|
||||||
public List<StructureBase> GetActiveStructures()
|
public List<StructureBase> GetActiveStructures()
|
||||||
{
|
{
|
||||||
return activeStructures;
|
return _activeStructures;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -166,7 +166,7 @@ namespace AsteroidGame.Handlers
|
||||||
|
|
||||||
public void SetBuildingIndex(int index)
|
public void SetBuildingIndex(int index)
|
||||||
{
|
{
|
||||||
buildingSelector = index;
|
_buildingSelector = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &664620742648054783
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 664620742648054780}
|
||||||
|
- component: {fileID: 664620742648054781}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: BuildingHandler
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &664620742648054780
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 664620742648054783}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &664620742648054781
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 664620742648054783}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 51bf353b43f7b2448bbb3088d78ee8a6, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
_colorGhost: {r: 1, g: 1, b: 1, a: 0.12}
|
||||||
|
_colorBuildingBlocked: {r: 1, g: 0, b: 0, a: 0.12}
|
||||||
|
_ghostStructureMaterial: {fileID: 2100000, guid: dc919a35edbf85647939132e73b39642, type: 2}
|
||||||
|
_isBuilding: 0
|
||||||
|
_buildingSelector: 0
|
||||||
|
_availableStructuresObject: {fileID: 11400000, guid: f789f54c47873664284d6e8544724693, type: 2}
|
||||||
|
_activeStructures: []
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3a89f87af6ee84a459d98a4c296dd1be
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -7,35 +7,35 @@ namespace AsteroidGame.Handlers
|
||||||
public class EnemyHandler : HandlerBase
|
public class EnemyHandler : HandlerBase
|
||||||
{
|
{
|
||||||
[Header("Parameters")]
|
[Header("Parameters")]
|
||||||
[SerializeField] [Range(0.1f, 60f)] float spawnRate = 60f;
|
[SerializeField] [Range(0.1f, 60f)] float _spawnRate = 60f;
|
||||||
[SerializeField] int objectPoolSize = 15;
|
[SerializeField] int _objectPoolSize = 15;
|
||||||
|
|
||||||
[Header("Prefabs")]
|
[Header("Prefabs")]
|
||||||
[SerializeField] GameObject objectPool;
|
[SerializeField] GameObject _objectPool;
|
||||||
[SerializeField] List<GameObject> enemyPrefabs = new List<GameObject>();
|
[SerializeField] List<GameObject> _enemyPrefabs = new List<GameObject>();
|
||||||
|
|
||||||
[Header("Lists")]
|
[Header("Lists")]
|
||||||
[SerializeField] List<GameObject> enemyPools = new List<GameObject>();
|
[SerializeField] List<GameObject> _enemyPools = new List<GameObject>();
|
||||||
[SerializeField] List<GameObject> allEnemies = new List<GameObject>();
|
[SerializeField] List<GameObject> _allEnemies = new List<GameObject>();
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddEnemyToAllEnemies(GameObject _enemy)
|
public void AddEnemyToAllEnemies(GameObject enemy)
|
||||||
{
|
{
|
||||||
allEnemies.Add(_enemy);
|
_allEnemies.Add(enemy);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveEnemy(GameObject _enemy)
|
public void RemoveEnemy(GameObject enemy)
|
||||||
{
|
{
|
||||||
allEnemies.Remove(_enemy);
|
_allEnemies.Remove(enemy);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GameObject> ReturnAllEnemies()
|
public List<GameObject> ReturnAllEnemies()
|
||||||
{
|
{
|
||||||
return allEnemies;
|
return _allEnemies;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyEnemiesOfNewPath()
|
public void NotifyEnemiesOfNewPath()
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &5200388201450229077
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 5200388201450229074}
|
||||||
|
- component: {fileID: 5200388201450229075}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: EnemyHandler
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &5200388201450229074
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5200388201450229077}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &5200388201450229075
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5200388201450229077}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 62a3dc5f11a44cb4d9faccb4fda8599f, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
_spawnRate: 60
|
||||||
|
_objectPoolSize: 15
|
||||||
|
_objectPool: {fileID: 0}
|
||||||
|
_enemyPrefabs: []
|
||||||
|
_enemyPools: []
|
||||||
|
_allEnemies: []
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 07826307af1971948b98dd42d1e9457a
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -1,75 +1,73 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using AsteroidGame.Entities.Structures.Scripts;
|
using AsteroidGame.Entities;
|
||||||
using AsteroidGame.Interfaces;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Pool;
|
|
||||||
|
|
||||||
namespace AsteroidGame.Handlers
|
namespace AsteroidGame.Handlers
|
||||||
{
|
{
|
||||||
public class PowerHandler : HandlerBase
|
public class PowerHandler : HandlerBase
|
||||||
{
|
{
|
||||||
[Header("State")] [SerializeField] private int powerConsumption;
|
[Header("State")]
|
||||||
[SerializeField] private int powerCapacity;
|
[SerializeField] private int _powerConsumption;
|
||||||
[SerializeField] private float powerFactor;
|
[SerializeField] private int _powerCapacity;
|
||||||
|
[SerializeField] private float _powerFactor;
|
||||||
|
|
||||||
[Header("Connections")] [SerializeField]
|
[Header("Connections")]
|
||||||
private BuildingHandler buildingHandler;
|
[SerializeField] private BuildingHandler _buildingHandler;
|
||||||
// [SerializeField] private BuildingHandler buildingHandler;
|
|
||||||
|
|
||||||
#region Private
|
#region Private
|
||||||
|
|
||||||
[SerializeField] private List<StructureBase> activeStructures = new();
|
[SerializeField] private List<StructureBase> _activeStructures = new();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
protected override void OnEnable()
|
protected override void OnEnable()
|
||||||
{
|
{
|
||||||
base.OnEnable();
|
base.OnEnable();
|
||||||
buildingHandler = FindObjectOfType<BuildingHandler>();
|
_buildingHandler = FindObjectOfType<BuildingHandler>();
|
||||||
activeStructures = buildingHandler.GetActiveStructures();
|
_activeStructures = _buildingHandler.GetActiveStructures();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
powerConsumption = 0;
|
_powerConsumption = 0;
|
||||||
powerCapacity = 0;
|
_powerCapacity = 0;
|
||||||
foreach (var structure in activeStructures)
|
foreach (var structure in _activeStructures)
|
||||||
{
|
{
|
||||||
if (structure.IsPowerConsumer)
|
if (structure.IsConsumer)
|
||||||
{
|
{
|
||||||
powerConsumption += structure.GetMaxPower();
|
_powerConsumption += structure.GetMaxPower();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (structure.IsPowerGenerator)
|
if (structure.IsGenerator)
|
||||||
{
|
{
|
||||||
powerCapacity += structure.GetMaxPower();
|
_powerCapacity += structure.GetMaxPower();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (powerCapacity > 0)
|
if (_powerCapacity > 0)
|
||||||
{
|
{
|
||||||
powerFactor = (float)powerConsumption / (float)powerCapacity;
|
_powerFactor = (float)_powerConsumption / _powerCapacity;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
powerFactor = 0;
|
_powerFactor = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetMaxPower()
|
public int GetMaxPower()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetCurrentPower()
|
public int GetCurrentPower()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetPowerFactor()
|
public float GetPowerFactor()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &5263199550015624125
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 5263199550015624126}
|
||||||
|
- component: {fileID: 5263199550015624127}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PowerHandler
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &5263199550015624126
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5263199550015624125}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &5263199550015624127
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5263199550015624125}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: bf720c524a2a9624099d0e4ba3d78108, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
_powerConsumption: 0
|
||||||
|
_powerCapacity: 0
|
||||||
|
_powerFactor: 0
|
||||||
|
_buildingHandler: {fileID: 0}
|
||||||
|
_activeStructures: []
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2e352ad6389b4234083764d15d4e6a5f
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -9,41 +9,41 @@ namespace AsteroidGame.Handlers
|
||||||
{
|
{
|
||||||
[Header("UI")]
|
[Header("UI")]
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private TextMeshProUGUI displayBalance;
|
private TextMeshProUGUI _displayBalance;
|
||||||
|
|
||||||
[Header("Parameters")]
|
[Header("Parameters")]
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private int startHealth = 5;
|
private int _startHealth = 5;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private int startBalance = 100;
|
private int _startBalance = 100;
|
||||||
[Header("Stats")]
|
[Header("Stats")]
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private int currentHealth;
|
private int _currentHealth;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private int currentBalance;
|
private int _currentBalance;
|
||||||
public int CurrentBalance => currentBalance;
|
public int CurrentBalance => _currentBalance;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
currentHealth = startHealth;
|
_currentHealth = _startHealth;
|
||||||
currentBalance = startBalance;
|
_currentBalance = _startBalance;
|
||||||
UpdateGUI();
|
UpdateGUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ModifyHealth(GameObject enemy)
|
public void ModifyHealth(GameObject enemy)
|
||||||
{
|
{
|
||||||
currentHealth -= 1;
|
_currentHealth -= 1;
|
||||||
CheckIfYouLost();
|
CheckIfYouLost();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ModifyHealth(int amount)
|
public void ModifyHealth(int amount)
|
||||||
{
|
{
|
||||||
currentHealth += amount;
|
_currentHealth += amount;
|
||||||
CheckIfYouLost();
|
CheckIfYouLost();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckIfYouLost(){
|
private void CheckIfYouLost(){
|
||||||
if(currentHealth <= 0)
|
if(_currentHealth <= 0)
|
||||||
{
|
{
|
||||||
Debug.Log("You lost");
|
Debug.Log("You lost");
|
||||||
Reload();
|
Reload();
|
||||||
|
@ -51,7 +51,7 @@ namespace AsteroidGame.Handlers
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ModifyWealth(int amount){
|
public void ModifyWealth(int amount){
|
||||||
currentBalance += amount;
|
_currentBalance += amount;
|
||||||
UpdateGUI();
|
UpdateGUI();
|
||||||
// Debug.Log($"Wealth modification. Change:{_amount}. Current: {wealthAmount}");
|
// Debug.Log($"Wealth modification. Change:{_amount}. Current: {wealthAmount}");
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ namespace AsteroidGame.Handlers
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateGUI(){
|
private void UpdateGUI(){
|
||||||
displayBalance.text = $"Gold: {currentBalance.ToString()}";
|
_displayBalance.text = $"Gold: {_currentBalance.ToString()}";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ namespace AsteroidGame.Interfaces
|
||||||
{
|
{
|
||||||
public interface IBuildable
|
public interface IBuildable
|
||||||
{
|
{
|
||||||
|
public int GetCost();
|
||||||
|
public int SetCost(int newCost);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,9 +2,9 @@ namespace AsteroidGame.Interfaces
|
||||||
{
|
{
|
||||||
public interface IPowerSystem
|
public interface IPowerSystem
|
||||||
{
|
{
|
||||||
public bool IsPowerGenerator { get; }
|
public bool IsGenerator { get; }
|
||||||
|
|
||||||
public bool IsPowerConsumer { get; }
|
public bool IsConsumer { get; }
|
||||||
|
|
||||||
public void SetMaxPower(int newValue);
|
public void SetMaxPower(int newValue);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
namespace AsteroidGame.Interfaces
|
||||||
|
{
|
||||||
|
public interface IWeapon
|
||||||
|
{
|
||||||
|
public float FireRate { get; set; }
|
||||||
|
public float Damage { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a4d06a75a5a64c83aa191a8610f5080f
|
||||||
|
timeCreated: 1664621279
|
|
@ -153,8 +153,9 @@ Transform:
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 1047643964}
|
- {fileID: 1047643964}
|
||||||
- {fileID: 1158682046}
|
- {fileID: 1158682046}
|
||||||
|
- {fileID: 624469242}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &95533810
|
--- !u!1 &95533810
|
||||||
GameObject:
|
GameObject:
|
||||||
|
@ -203,6 +204,7 @@ MonoBehaviour:
|
||||||
m_TrackedDeviceOrientationAction: {fileID: 7970375526676320489, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
m_TrackedDeviceOrientationAction: {fileID: 7970375526676320489, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
|
||||||
m_DeselectOnBackgroundClick: 1
|
m_DeselectOnBackgroundClick: 1
|
||||||
m_PointerBehavior: 0
|
m_PointerBehavior: 0
|
||||||
|
m_CursorLockBehavior: 0
|
||||||
--- !u!114 &95533812
|
--- !u!114 &95533812
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -231,9 +233,9 @@ Transform:
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 6
|
m_RootOrder: 4
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1047643963
|
--- !u!1 &157782260
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
@ -241,101 +243,52 @@ GameObject:
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 1047643964}
|
- component: {fileID: 157782261}
|
||||||
- component: {fileID: 1047643965}
|
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: EnemyHandler
|
m_Name: TestObjects
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 1
|
||||||
--- !u!4 &1047643964
|
--- !u!4 &157782261
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1047643963}
|
m_GameObject: {fileID: 157782260}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: -4.6326556, y: 0.98203504, z: 6.9309382}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
|
- {fileID: 2079460687}
|
||||||
- {fileID: 1715656626}
|
- {fileID: 1715656626}
|
||||||
m_Father: {fileID: 38176946}
|
- {fileID: 991542217}
|
||||||
m_RootOrder: 0
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 5
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &1047643965
|
--- !u!4 &624469242 stripped
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1047643963}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 62a3dc5f11a44cb4d9faccb4fda8599f, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
spawnRate: 60
|
|
||||||
objectPoolSize: 15
|
|
||||||
objectPool: {fileID: 0}
|
|
||||||
enemyPrefabs: []
|
|
||||||
enemyPools: []
|
|
||||||
allEnemies: []
|
|
||||||
--- !u!1 &1158682045
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 1158682046}
|
|
||||||
- component: {fileID: 1158682047}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: BuildingHandler
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &1158682046
|
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_CorrespondingSourceObject: {fileID: 5263199550015624126, guid: 2e352ad6389b4234083764d15d4e6a5f, type: 3}
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_PrefabInstance: {fileID: 5263199549561108292}
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1158682045}
|
--- !u!4 &991542217 stripped
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
Transform:
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_CorrespondingSourceObject: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_PrefabInstance: {fileID: 8451896670512076735}
|
||||||
m_ConstrainProportionsScale: 0
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Children: []
|
--- !u!4 &1047643964 stripped
|
||||||
m_Father: {fileID: 38176946}
|
Transform:
|
||||||
m_RootOrder: 1
|
m_CorrespondingSourceObject: {fileID: 5200388201450229074, guid: 07826307af1971948b98dd42d1e9457a, type: 3}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_PrefabInstance: {fileID: 5200388200885062254}
|
||||||
--- !u!114 &1158682047
|
m_PrefabAsset: {fileID: 0}
|
||||||
MonoBehaviour:
|
--- !u!4 &1158682046 stripped
|
||||||
m_ObjectHideFlags: 0
|
Transform:
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 664620742648054780, guid: 3a89f87af6ee84a459d98a4c296dd1be, type: 3}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 664620741625697858}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1158682045}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 51bf353b43f7b2448bbb3088d78ee8a6, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
colorGhost: {r: 1, g: 1, b: 1, a: 0.12}
|
|
||||||
colorBuildingBlocked: {r: 1, g: 0, b: 0, a: 0.12}
|
|
||||||
ghostStructureMaterial: {fileID: 2100000, guid: dc919a35edbf85647939132e73b39642, type: 2}
|
|
||||||
isBuilding: 0
|
|
||||||
buildingSelector: 0
|
|
||||||
availableStructuresObject: {fileID: 11400000, guid: f789f54c47873664284d6e8544724693, type: 2}
|
|
||||||
colorCurrent: {r: 0, g: 0, b: 0, a: 0}
|
|
||||||
activeStructures: []
|
|
||||||
--- !u!1001 &1191794244
|
--- !u!1001 &1191794244
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -349,7 +302,7 @@ PrefabInstance:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8083988910661828847, guid: c2b4fe01faa847f4b976b5539477e1ec, type: 3}
|
- target: {fileID: 8083988910661828847, guid: c2b4fe01faa847f4b976b5539477e1ec, type: 3}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 3
|
value: 2
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8083988910661828847, guid: c2b4fe01faa847f4b976b5539477e1ec, type: 3}
|
- target: {fileID: 8083988910661828847, guid: c2b4fe01faa847f4b976b5539477e1ec, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
|
@ -393,90 +346,28 @@ PrefabInstance:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: c2b4fe01faa847f4b976b5539477e1ec, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: c2b4fe01faa847f4b976b5539477e1ec, type: 3}
|
||||||
--- !u!1 &1223464901
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 1223464903}
|
|
||||||
- component: {fileID: 1223464902}
|
|
||||||
- component: {fileID: 1223464904}
|
|
||||||
m_Layer: 5
|
|
||||||
m_Name: UserInterface
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!114 &1223464902
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1223464901}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
m_PanelSettings: {fileID: 11400000, guid: e6db20d33c1e6754e961e09ddc91ad73, type: 2}
|
|
||||||
m_ParentUI: {fileID: 0}
|
|
||||||
sourceAsset: {fileID: 9197481963319205126, guid: 80724155ca8b2ef4bbd2cbb3b6049114, type: 3}
|
|
||||||
m_SortingOrder: 0
|
|
||||||
--- !u!4 &1223464903
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1223464901}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children: []
|
|
||||||
m_Father: {fileID: 0}
|
|
||||||
m_RootOrder: 5
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!114 &1223464904
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1223464901}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: e0455460303dea141b831f0bfdd0e47f, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
availableStructuresObject: {fileID: 11400000, guid: f789f54c47873664284d6e8544724693, type: 2}
|
|
||||||
--- !u!1001 &1715656625
|
--- !u!1001 &1715656625
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Modification:
|
m_Modification:
|
||||||
m_TransformParent: {fileID: 1047643964}
|
m_TransformParent: {fileID: 157782261}
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
- target: {fileID: 2692714622321691895, guid: 4af571b983b23f94f8d5ca4dbda27de5, type: 3}
|
- target: {fileID: 2692714622321691895, guid: 4af571b983b23f94f8d5ca4dbda27de5, type: 3}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 0
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2692714622321691895, guid: 4af571b983b23f94f8d5ca4dbda27de5, type: 3}
|
- target: {fileID: 2692714622321691895, guid: 4af571b983b23f94f8d5ca4dbda27de5, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
value: -4.95
|
value: -0.3173442
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2692714622321691895, guid: 4af571b983b23f94f8d5ca4dbda27de5, type: 3}
|
- target: {fileID: 2692714622321691895, guid: 4af571b983b23f94f8d5ca4dbda27de5, type: 3}
|
||||||
propertyPath: m_LocalPosition.y
|
propertyPath: m_LocalPosition.y
|
||||||
value: 0
|
value: -0.98203504
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2692714622321691895, guid: 4af571b983b23f94f8d5ca4dbda27de5, type: 3}
|
- target: {fileID: 2692714622321691895, guid: 4af571b983b23f94f8d5ca4dbda27de5, type: 3}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 6.97
|
value: 0.039061546
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 2692714622321691895, guid: 4af571b983b23f94f8d5ca4dbda27de5, type: 3}
|
- target: {fileID: 2692714622321691895, guid: 4af571b983b23f94f8d5ca4dbda27de5, type: 3}
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
|
@ -734,12 +625,17 @@ MonoBehaviour:
|
||||||
m_PointlightHDType: 0
|
m_PointlightHDType: 0
|
||||||
m_SpotLightShape: 0
|
m_SpotLightShape: 0
|
||||||
m_AreaLightShape: 0
|
m_AreaLightShape: 0
|
||||||
|
--- !u!4 &2079460687 stripped
|
||||||
|
Transform:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 2134547390}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
--- !u!1001 &2134547390
|
--- !u!1001 &2134547390
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Modification:
|
m_Modification:
|
||||||
m_TransformParent: {fileID: 0}
|
m_TransformParent: {fileID: 157782261}
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
- target: {fileID: 3252872069634226352, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
- target: {fileID: 3252872069634226352, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
propertyPath: m_Enabled
|
propertyPath: m_Enabled
|
||||||
|
@ -751,19 +647,19 @@ PrefabInstance:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 1
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
value: 0
|
value: 4.6326556
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
propertyPath: m_LocalPosition.y
|
propertyPath: m_LocalPosition.y
|
||||||
value: 0
|
value: -0.98203504
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 4.04
|
value: -2.8909383
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
|
@ -771,15 +667,15 @@ PrefabInstance:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
value: 0
|
value: -0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
propertyPath: m_LocalRotation.y
|
propertyPath: m_LocalRotation.y
|
||||||
value: 0
|
value: -0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
propertyPath: m_LocalRotation.z
|
propertyPath: m_LocalRotation.z
|
||||||
value: 0
|
value: -0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
- target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
@ -804,28 +700,256 @@ PrefabInstance:
|
||||||
m_RemovedComponents:
|
m_RemovedComponents:
|
||||||
- {fileID: 1344974744014620977, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
- {fileID: 1344974744014620977, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
--- !u!1001 &8451896670512076735
|
--- !u!1001 &664620741625697858
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 38176946}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 664620742648054780, guid: 3a89f87af6ee84a459d98a4c296dd1be, type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 664620742648054780, guid: 3a89f87af6ee84a459d98a4c296dd1be, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 664620742648054780, guid: 3a89f87af6ee84a459d98a4c296dd1be, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 664620742648054780, guid: 3a89f87af6ee84a459d98a4c296dd1be, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 664620742648054780, guid: 3a89f87af6ee84a459d98a4c296dd1be, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 664620742648054780, guid: 3a89f87af6ee84a459d98a4c296dd1be, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 664620742648054780, guid: 3a89f87af6ee84a459d98a4c296dd1be, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 664620742648054780, guid: 3a89f87af6ee84a459d98a4c296dd1be, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 664620742648054780, guid: 3a89f87af6ee84a459d98a4c296dd1be, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 664620742648054780, guid: 3a89f87af6ee84a459d98a4c296dd1be, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 664620742648054780, guid: 3a89f87af6ee84a459d98a4c296dd1be, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 664620742648054783, guid: 3a89f87af6ee84a459d98a4c296dd1be, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: BuildingHandler
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 3a89f87af6ee84a459d98a4c296dd1be, type: 3}
|
||||||
|
--- !u!1001 &3627079579018641133
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Modification:
|
m_Modification:
|
||||||
m_TransformParent: {fileID: 0}
|
m_TransformParent: {fileID: 0}
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
- target: {fileID: 3627079578080913704, guid: 1170a91b91039d6429d389468bd72c6f, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: UserInterface
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3627079578080913706, guid: 1170a91b91039d6429d389468bd72c6f, type: 3}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 4
|
value: 3
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
- target: {fileID: 3627079578080913706, guid: 1170a91b91039d6429d389468bd72c6f, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
value: -4.71
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
- target: {fileID: 3627079578080913706, guid: 1170a91b91039d6429d389468bd72c6f, type: 3}
|
||||||
propertyPath: m_LocalPosition.y
|
propertyPath: m_LocalPosition.y
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3627079578080913706, guid: 1170a91b91039d6429d389468bd72c6f, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3627079578080913706, guid: 1170a91b91039d6429d389468bd72c6f, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3627079578080913706, guid: 1170a91b91039d6429d389468bd72c6f, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3627079578080913706, guid: 1170a91b91039d6429d389468bd72c6f, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3627079578080913706, guid: 1170a91b91039d6429d389468bd72c6f, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3627079578080913706, guid: 1170a91b91039d6429d389468bd72c6f, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3627079578080913706, guid: 1170a91b91039d6429d389468bd72c6f, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3627079578080913706, guid: 1170a91b91039d6429d389468bd72c6f, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 1170a91b91039d6429d389468bd72c6f, type: 3}
|
||||||
|
--- !u!1001 &5200388200885062254
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 38176946}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 5200388201450229074, guid: 07826307af1971948b98dd42d1e9457a, type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5200388201450229074, guid: 07826307af1971948b98dd42d1e9457a, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5200388201450229074, guid: 07826307af1971948b98dd42d1e9457a, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5200388201450229074, guid: 07826307af1971948b98dd42d1e9457a, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5200388201450229074, guid: 07826307af1971948b98dd42d1e9457a, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5200388201450229074, guid: 07826307af1971948b98dd42d1e9457a, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5200388201450229074, guid: 07826307af1971948b98dd42d1e9457a, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5200388201450229074, guid: 07826307af1971948b98dd42d1e9457a, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5200388201450229074, guid: 07826307af1971948b98dd42d1e9457a, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5200388201450229074, guid: 07826307af1971948b98dd42d1e9457a, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5200388201450229074, guid: 07826307af1971948b98dd42d1e9457a, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5200388201450229077, guid: 07826307af1971948b98dd42d1e9457a, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: EnemyHandler
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 07826307af1971948b98dd42d1e9457a, type: 3}
|
||||||
|
--- !u!1001 &5263199549561108292
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 38176946}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 5263199550015624125, guid: 2e352ad6389b4234083764d15d4e6a5f, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: PowerHandler
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5263199550015624126, guid: 2e352ad6389b4234083764d15d4e6a5f, type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 2
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5263199550015624126, guid: 2e352ad6389b4234083764d15d4e6a5f, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5263199550015624126, guid: 2e352ad6389b4234083764d15d4e6a5f, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5263199550015624126, guid: 2e352ad6389b4234083764d15d4e6a5f, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5263199550015624126, guid: 2e352ad6389b4234083764d15d4e6a5f, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5263199550015624126, guid: 2e352ad6389b4234083764d15d4e6a5f, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5263199550015624126, guid: 2e352ad6389b4234083764d15d4e6a5f, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5263199550015624126, guid: 2e352ad6389b4234083764d15d4e6a5f, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5263199550015624126, guid: 2e352ad6389b4234083764d15d4e6a5f, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5263199550015624126, guid: 2e352ad6389b4234083764d15d4e6a5f, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5263199550015624126, guid: 2e352ad6389b4234083764d15d4e6a5f, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 2e352ad6389b4234083764d15d4e6a5f, type: 3}
|
||||||
|
--- !u!1001 &8451896670512076735
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 157782261}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 2
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: -0.07734442
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: -0.98203504
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 1.66
|
value: -5.2709384
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
|
@ -833,15 +957,15 @@ PrefabInstance:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
value: 0
|
value: -0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
||||||
propertyPath: m_LocalRotation.y
|
propertyPath: m_LocalRotation.y
|
||||||
value: 0
|
value: -0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
||||||
propertyPath: m_LocalRotation.z
|
propertyPath: m_LocalRotation.z
|
||||||
value: 0
|
value: -0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
- target: {fileID: 493861824998956378, guid: 57a75520298c47140a928041b05d7f3c, type: 3}
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
|
|
@ -6,77 +6,77 @@ namespace AsteroidGame
|
||||||
{
|
{
|
||||||
public class CameraController : MonoBehaviour
|
public class CameraController : MonoBehaviour
|
||||||
{
|
{
|
||||||
private CameraControllActions cameraActions;
|
private CameraControllActions _cameraActions;
|
||||||
private InputAction movement;
|
private InputAction _movement;
|
||||||
private Transform cameraTransform;
|
private Transform _cameraTransform;
|
||||||
private Camera cameraReference;
|
private Camera _cameraReference;
|
||||||
|
|
||||||
// Horizontal Movement
|
// Horizontal Movement
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private float maxSpeed = 5f;
|
private float _maxSpeed = 5f;
|
||||||
private float speed;
|
private float _speed;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private float acceleration = 10f;
|
private float _acceleration = 10f;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private float damping = 15f;
|
private float _damping = 15f;
|
||||||
|
|
||||||
//Vertial Motion - Zooming
|
//Vertial Motion - Zooming
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private float stepSize = 2f;
|
private float _stepSize = 2f;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private float zoomDampening = 7.5f;
|
private float _zoomDampening = 7.5f;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private float minHeight = 5f;
|
private float _minHeight = 5f;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private float maxHeight = 50f;
|
private float _maxHeight = 50f;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private float zoomSpeed = 2f;
|
private float _zoomSpeed = 2f;
|
||||||
|
|
||||||
//Rotation
|
//Rotation
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private float maxRotationSpeed = 1f;
|
private float _maxRotationSpeed = 1f;
|
||||||
|
|
||||||
//Screen Edge Motion
|
//Screen Edge Motion
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
[Range(0f, 0.1f)]
|
[Range(0f, 0.1f)]
|
||||||
private float edgeTolerance = 0.05f;
|
private float _edgeTolerance = 0.05f;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private bool useScreenEdge = false;
|
private bool _useScreenEdge = false;
|
||||||
|
|
||||||
private Vector3 targetPosition;
|
private Vector3 _targetPosition;
|
||||||
private float zoomHeight;
|
private float _zoomHeight;
|
||||||
private Vector3 horizontalVelocity;
|
private Vector3 _horizontalVelocity;
|
||||||
private Vector3 lastPosition;
|
private Vector3 _lastPosition;
|
||||||
private Plane cameraPlane;
|
private Plane _cameraPlane;
|
||||||
|
|
||||||
Vector3 startDrag;
|
Vector3 _startDrag;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
cameraActions = new CameraControllActions();
|
_cameraActions = new CameraControllActions();
|
||||||
|
|
||||||
cameraReference = this.GetComponentInChildren<Camera>();
|
_cameraReference = this.GetComponentInChildren<Camera>();
|
||||||
cameraTransform = cameraReference.transform;
|
_cameraTransform = _cameraReference.transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
cameraPlane = new Plane(Vector3.up, Vector3.zero);
|
_cameraPlane = new Plane(Vector3.up, Vector3.zero);
|
||||||
zoomHeight = cameraTransform.localPosition.y;
|
_zoomHeight = _cameraTransform.localPosition.y;
|
||||||
cameraTransform.LookAt(this.transform);
|
_cameraTransform.LookAt(this.transform);
|
||||||
lastPosition = this.transform.position;
|
_lastPosition = this.transform.position;
|
||||||
movement = cameraActions.Camera.Movement;
|
_movement = _cameraActions.Camera.Movement;
|
||||||
cameraActions.Camera.RotateCamera.performed += RotateCamera;
|
_cameraActions.Camera.RotateCamera.performed += RotateCamera;
|
||||||
cameraActions.Camera.ZoomCamera.performed += ZoomCamera;
|
_cameraActions.Camera.ZoomCamera.performed += ZoomCamera;
|
||||||
cameraActions.Camera.Enable();
|
_cameraActions.Camera.Enable();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDisable()
|
private void OnDisable()
|
||||||
{
|
{
|
||||||
cameraActions.Camera.RotateCamera.performed -= RotateCamera;
|
_cameraActions.Camera.RotateCamera.performed -= RotateCamera;
|
||||||
cameraActions.Camera.ZoomCamera.performed -= ZoomCamera;
|
_cameraActions.Camera.ZoomCamera.performed -= ZoomCamera;
|
||||||
cameraActions.Disable();
|
_cameraActions.Disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ namespace AsteroidGame
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
GetKeyboardMovement();
|
GetKeyboardMovement();
|
||||||
if (useScreenEdge)
|
if (_useScreenEdge)
|
||||||
{
|
{
|
||||||
CheckMouseAtScreenEdge();
|
CheckMouseAtScreenEdge();
|
||||||
}
|
}
|
||||||
|
@ -97,51 +97,51 @@ namespace AsteroidGame
|
||||||
|
|
||||||
private void UpdateVelocity()
|
private void UpdateVelocity()
|
||||||
{
|
{
|
||||||
horizontalVelocity = (this.transform.position - lastPosition) / Time.deltaTime;
|
_horizontalVelocity = (this.transform.position - _lastPosition) / Time.deltaTime;
|
||||||
horizontalVelocity.y = 0;
|
_horizontalVelocity.y = 0;
|
||||||
lastPosition = this.transform.position;
|
_lastPosition = this.transform.position;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GetKeyboardMovement()
|
private void GetKeyboardMovement()
|
||||||
{
|
{
|
||||||
Vector3 inputValue = movement.ReadValue<Vector2>().x * GetCameraRight()
|
Vector3 inputValue = _movement.ReadValue<Vector2>().x * GetCameraRight()
|
||||||
+ movement.ReadValue<Vector2>().y * GetCameraForward();
|
+ _movement.ReadValue<Vector2>().y * GetCameraForward();
|
||||||
inputValue = inputValue.normalized;
|
inputValue = inputValue.normalized;
|
||||||
|
|
||||||
if (inputValue.sqrMagnitude > 0.1f)
|
if (inputValue.sqrMagnitude > 0.1f)
|
||||||
{
|
{
|
||||||
targetPosition += inputValue;
|
_targetPosition += inputValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector3 GetCameraRight()
|
private Vector3 GetCameraRight()
|
||||||
{
|
{
|
||||||
Vector3 right = cameraTransform.right;
|
Vector3 right = _cameraTransform.right;
|
||||||
right.y = 0;
|
right.y = 0;
|
||||||
return right;
|
return right;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector3 GetCameraForward()
|
private Vector3 GetCameraForward()
|
||||||
{
|
{
|
||||||
Vector3 forward = cameraTransform.forward;
|
Vector3 forward = _cameraTransform.forward;
|
||||||
forward.y = 0;
|
forward.y = 0;
|
||||||
return forward;
|
return forward;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateBasePosition()
|
private void UpdateBasePosition()
|
||||||
{
|
{
|
||||||
if (targetPosition.sqrMagnitude > 0.1f)
|
if (_targetPosition.sqrMagnitude > 0.1f)
|
||||||
{
|
{
|
||||||
speed = Mathf.Lerp(speed, maxSpeed, Time.deltaTime * acceleration);
|
_speed = Mathf.Lerp(_speed, _maxSpeed, Time.deltaTime * _acceleration);
|
||||||
transform.position += speed * Time.deltaTime * targetPosition;
|
transform.position += _speed * Time.deltaTime * _targetPosition;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
horizontalVelocity = Vector3.Lerp(horizontalVelocity, Vector3.zero, Time.deltaTime * damping);
|
_horizontalVelocity = Vector3.Lerp(_horizontalVelocity, Vector3.zero, Time.deltaTime * _damping);
|
||||||
transform.position += horizontalVelocity * Time.deltaTime;
|
transform.position += _horizontalVelocity * Time.deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
targetPosition = Vector3.zero;
|
_targetPosition = Vector3.zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RotateCamera(InputAction.CallbackContext inputValue)
|
private void RotateCamera(InputAction.CallbackContext inputValue)
|
||||||
|
@ -149,7 +149,7 @@ namespace AsteroidGame
|
||||||
if (!Mouse.current.middleButton.isPressed) { return; }
|
if (!Mouse.current.middleButton.isPressed) { return; }
|
||||||
|
|
||||||
float value = inputValue.ReadValue<Vector2>().x;
|
float value = inputValue.ReadValue<Vector2>().x;
|
||||||
transform.rotation = Quaternion.Euler(0f, value * maxRotationSpeed + transform.rotation.eulerAngles.y, 0f);
|
transform.rotation = Quaternion.Euler(0f, value * _maxRotationSpeed + transform.rotation.eulerAngles.y, 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ZoomCamera(InputAction.CallbackContext inputValue)
|
private void ZoomCamera(InputAction.CallbackContext inputValue)
|
||||||
|
@ -158,21 +158,21 @@ namespace AsteroidGame
|
||||||
|
|
||||||
if (Mathf.Abs(value) > 0.1f)
|
if (Mathf.Abs(value) > 0.1f)
|
||||||
{
|
{
|
||||||
zoomHeight = cameraTransform.localPosition.y + value * stepSize;
|
_zoomHeight = _cameraTransform.localPosition.y + value * _stepSize;
|
||||||
if (zoomHeight < minHeight)
|
if (_zoomHeight < _minHeight)
|
||||||
zoomHeight = minHeight;
|
_zoomHeight = _minHeight;
|
||||||
else if (zoomHeight > maxHeight)
|
else if (_zoomHeight > _maxHeight)
|
||||||
zoomHeight = maxHeight;
|
_zoomHeight = _maxHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateCameraPosition()
|
private void UpdateCameraPosition()
|
||||||
{
|
{
|
||||||
Vector3 zoomTarget = new Vector3(cameraTransform.localPosition.x, zoomHeight, cameraTransform.localPosition.z);
|
Vector3 zoomTarget = new Vector3(_cameraTransform.localPosition.x, _zoomHeight, _cameraTransform.localPosition.z);
|
||||||
zoomTarget -= zoomSpeed * (zoomHeight - cameraTransform.localPosition.y) * Vector3.forward;
|
zoomTarget -= _zoomSpeed * (_zoomHeight - _cameraTransform.localPosition.y) * Vector3.forward;
|
||||||
|
|
||||||
cameraTransform.localPosition = Vector3.Lerp(cameraTransform.localPosition, zoomTarget, Time.deltaTime * zoomDampening);
|
_cameraTransform.localPosition = Vector3.Lerp(_cameraTransform.localPosition, zoomTarget, Time.deltaTime * _zoomDampening);
|
||||||
cameraTransform.LookAt(this.transform);
|
_cameraTransform.LookAt(this.transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckMouseAtScreenEdge()
|
private void CheckMouseAtScreenEdge()
|
||||||
|
@ -180,17 +180,17 @@ namespace AsteroidGame
|
||||||
Vector2 mousePosition = Mouse.current.position.ReadValue();
|
Vector2 mousePosition = Mouse.current.position.ReadValue();
|
||||||
Vector3 moveDirection = Vector3.zero;
|
Vector3 moveDirection = Vector3.zero;
|
||||||
|
|
||||||
if (mousePosition.x < edgeTolerance * Screen.width)
|
if (mousePosition.x < _edgeTolerance * Screen.width)
|
||||||
moveDirection += -GetCameraRight();
|
moveDirection += -GetCameraRight();
|
||||||
else if (mousePosition.x > (1f - edgeTolerance) * Screen.width)
|
else if (mousePosition.x > (1f - _edgeTolerance) * Screen.width)
|
||||||
moveDirection += GetCameraRight();
|
moveDirection += GetCameraRight();
|
||||||
|
|
||||||
if (mousePosition.y < edgeTolerance * Screen.height)
|
if (mousePosition.y < _edgeTolerance * Screen.height)
|
||||||
moveDirection += -GetCameraForward();
|
moveDirection += -GetCameraForward();
|
||||||
else if (mousePosition.y > (1f - edgeTolerance) * Screen.height)
|
else if (mousePosition.y > (1f - _edgeTolerance) * Screen.height)
|
||||||
moveDirection += GetCameraForward();
|
moveDirection += GetCameraForward();
|
||||||
|
|
||||||
targetPosition += moveDirection;
|
_targetPosition += moveDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DragCamera()
|
private void DragCamera()
|
||||||
|
@ -198,13 +198,13 @@ namespace AsteroidGame
|
||||||
if (!Mouse.current.rightButton.isPressed) { return; }
|
if (!Mouse.current.rightButton.isPressed) { return; }
|
||||||
|
|
||||||
|
|
||||||
Ray ray = cameraReference.ScreenPointToRay(Mouse.current.position.ReadValue());
|
Ray ray = _cameraReference.ScreenPointToRay(Mouse.current.position.ReadValue());
|
||||||
if (cameraPlane.Raycast(ray,out float distance))
|
if (_cameraPlane.Raycast(ray,out float distance))
|
||||||
{
|
{
|
||||||
if (Mouse.current.rightButton.wasPressedThisFrame)
|
if (Mouse.current.rightButton.wasPressedThisFrame)
|
||||||
startDrag = ray.GetPoint(distance);
|
_startDrag = ray.GetPoint(distance);
|
||||||
else
|
else
|
||||||
targetPosition += startDrag - ray.GetPoint(distance);
|
_targetPosition += _startDrag - ray.GetPoint(distance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,43 +1,41 @@
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using AsteroidGame.Entities;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
using AsteroidGame.Entities.Structures.Scripts;
|
|
||||||
using AsteroidGame.Handlers;
|
using AsteroidGame.Handlers;
|
||||||
using UnityEditor;
|
|
||||||
|
|
||||||
namespace AsteroidGame
|
namespace AsteroidGame.UI
|
||||||
{
|
{
|
||||||
public class BuildMenuUiController : MonoBehaviour
|
public class BuildMenuUiController : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
||||||
[Header("Structures")]
|
[Header("Structures")]
|
||||||
[SerializeField] private StructureBaseScriptableObject availableStructuresObject;
|
[SerializeField] private StructureBaseScriptableObject _availableStructuresObject;
|
||||||
|
|
||||||
private VisualElement m_Root;
|
private VisualElement _mRoot;
|
||||||
private VisualElement m_SlotContainer;
|
private VisualElement _mSlotContainer;
|
||||||
private List<StructureBase> buildings = new();
|
private List<StructureBase> _buildings = new();
|
||||||
private BuildingHandler buildingHandler;
|
private BuildingHandler _buildingHandler;
|
||||||
void OnEnable()
|
|
||||||
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
buildings = availableStructuresObject.structureList;
|
_buildings = _availableStructuresObject._structureList;
|
||||||
buildingHandler = FindObjectOfType<BuildingHandler>();
|
_buildingHandler = FindObjectOfType<BuildingHandler>();
|
||||||
|
|
||||||
//Store the root from the UI Document component
|
//Store the root from the UI Document component
|
||||||
m_Root = GetComponent<UIDocument>().rootVisualElement;
|
_mRoot = GetComponent<UIDocument>().rootVisualElement;
|
||||||
m_SlotContainer = m_Root.Q<VisualElement>("Menu");
|
_mSlotContainer = _mRoot.Q<VisualElement>("Menu");
|
||||||
|
|
||||||
for (int i = 0; i < buildings.Count; i++)
|
for (int i = 0; i < _buildings.Count; i++)
|
||||||
{
|
{
|
||||||
StructureBase building = buildings[i];
|
StructureBase building = _buildings[i];
|
||||||
BuildingButton button = new();
|
BuildingButton button = new()
|
||||||
button.name = building.name;
|
|
||||||
button.text = building.UiFriendlyName;
|
|
||||||
button.RegisterCallback<ClickEvent, int>((evt, index) =>
|
|
||||||
{
|
{
|
||||||
buildingHandler.EnterBuildMode(index);
|
name = building.name,
|
||||||
},i);
|
text = building.UiFriendlyName
|
||||||
m_SlotContainer.Add(button);
|
};
|
||||||
|
button.RegisterCallback<ClickEvent, int>((evt, index) => { _buildingHandler.EnterBuildMode(index); },
|
||||||
|
i);
|
||||||
|
_mSlotContainer.Add(button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UIElements;
|
using UnityEngine.UIElements;
|
||||||
|
|
||||||
namespace AsteroidGame
|
namespace AsteroidGame.UI
|
||||||
{
|
{
|
||||||
public class BuildingButton : Button
|
public class BuildingButton : Button
|
||||||
{
|
{
|
||||||
|
@ -14,7 +11,6 @@ namespace AsteroidGame
|
||||||
|
|
||||||
icon.AddToClassList("slotIcon");
|
icon.AddToClassList("slotIcon");
|
||||||
AddToClassList("button");
|
AddToClassList("button");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &3627079578080913704
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 3627079578080913706}
|
||||||
|
- component: {fileID: 3627079578080913707}
|
||||||
|
- component: {fileID: 3627079578080913701}
|
||||||
|
m_Layer: 5
|
||||||
|
m_Name: UserInterface
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &3627079578080913706
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3627079578080913704}
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 0
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &3627079578080913707
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3627079578080913704}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_PanelSettings: {fileID: 11400000, guid: e6db20d33c1e6754e961e09ddc91ad73, type: 2}
|
||||||
|
m_ParentUI: {fileID: 0}
|
||||||
|
sourceAsset: {fileID: 9197481963319205126, guid: 80724155ca8b2ef4bbd2cbb3b6049114, type: 3}
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!114 &3627079578080913701
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 3627079578080913704}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: e0455460303dea141b831f0bfdd0e47f, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
_availableStructuresObject: {fileID: 11400000, guid: f789f54c47873664284d6e8544724693, type: 2}
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1170a91b91039d6429d389468bd72c6f
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,8 @@
|
||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=assets_005Centities_005Cenemies/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=assets_005Centities_005Cenemies_005Cscripts/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=assets_005Centities_005Cstructures/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=assets_005Centities_005Cstructures_005Cpowerplant/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=assets_005Centities_005Cstructures_005Cscriptableobjects/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=assets_005Centities_005Cstructures_005Cscripts/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=assets_005Centities_005Cstructures_005Cturret/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
Loading…
Reference in New Issue