First version of build system
This commit is contained in:
parent
4034c1e122
commit
15e1e06dfe
|
@ -409,7 +409,8 @@ MonoBehaviour:
|
||||||
health: 0
|
health: 0
|
||||||
maxHealth: 0
|
maxHealth: 0
|
||||||
isInvulnerable: 0
|
isInvulnerable: 0
|
||||||
_centerPosition: {fileID: 3291032053430181389}
|
centerPosition: {fileID: 3291032053430181389}
|
||||||
|
basePosition: {fileID: 2692714622321691895}
|
||||||
--- !u!1 &6940800288144322101
|
--- !u!1 &6940800288144322101
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|
|
@ -5,12 +5,6 @@ namespace AsteroidGame.Entities.Enemies.Scripts
|
||||||
{
|
{
|
||||||
public class EnemyBase : EntityBase
|
public class EnemyBase : EntityBase
|
||||||
{
|
{
|
||||||
[Header("Connections")]
|
|
||||||
[SerializeField] private Transform _centerPosition;
|
|
||||||
|
|
||||||
public Vector3 GetCenterPosition()
|
|
||||||
{
|
|
||||||
return _centerPosition.transform.position;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,24 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace AsteroidGame.Entities
|
namespace AsteroidGame.Entities
|
||||||
{
|
{
|
||||||
public class EntityBase : MonoBehaviour, IDamageable
|
public class EntityBase : MonoBehaviour, IDamageable, ITargetable
|
||||||
{
|
{
|
||||||
|
[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")]
|
||||||
|
[SerializeField] private Transform centerPosition;
|
||||||
|
[SerializeField] private Transform basePosition;
|
||||||
|
|
||||||
|
#region Props
|
||||||
|
|
||||||
public bool IsInvulnerable => isInvulnerable;
|
public bool IsInvulnerable => isInvulnerable;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
public void ModifyHealth(int healthChange)
|
public void ModifyHealth(int healthChange)
|
||||||
{
|
{
|
||||||
if (!isInvulnerable)
|
if (!isInvulnerable)
|
||||||
|
@ -19,6 +29,9 @@ namespace AsteroidGame.Entities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Setters
|
||||||
public void SetHealth(int newHealth)
|
public void SetHealth(int newHealth)
|
||||||
{
|
{
|
||||||
health = newHealth;
|
health = newHealth;
|
||||||
|
@ -34,6 +47,19 @@ namespace AsteroidGame.Entities
|
||||||
isInvulnerable = newState;
|
isInvulnerable = newState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Getters
|
||||||
|
|
||||||
|
public Vector3 GetCenterPosition()
|
||||||
|
{
|
||||||
|
return centerPosition.transform.position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 GetBasePosition()
|
||||||
|
{
|
||||||
|
return basePosition.transform.position;
|
||||||
|
}
|
||||||
public int GetHealth()
|
public int GetHealth()
|
||||||
{
|
{
|
||||||
return health;
|
return health;
|
||||||
|
@ -49,5 +75,7 @@ namespace AsteroidGame.Entities
|
||||||
// ReSharper disable once PossibleLossOfFraction
|
// ReSharper disable once PossibleLossOfFraction
|
||||||
return health / maxHealth;
|
return health / maxHealth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,45 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using AsteroidGame.Interfaces;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace AsteroidGame.Entities.Structures.Scripts
|
namespace AsteroidGame.Entities.Structures.Scripts
|
||||||
{
|
{
|
||||||
public class StructureBase : EntityBase
|
public class StructureBase : EntityBase, IBuildable
|
||||||
{
|
{
|
||||||
[Header("BuildParameters")]
|
[Header("BuildParameters")]
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
protected int cost;
|
protected int cost;
|
||||||
|
|
||||||
|
[SerializeField] private bool _buildPlacementBlocked;
|
||||||
[SerializeField] protected float buildTimer;
|
[SerializeField] protected float buildTimer;
|
||||||
|
|
||||||
#region Publics
|
#region Private
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Publics
|
||||||
|
public bool BuildPlacementBlocked => _buildPlacementBlocked;
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public int Cost { get; set; }
|
public int Cost { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private void OnTriggerStay(Collider other)
|
||||||
|
{
|
||||||
|
if(other.name == "BuildCollider")
|
||||||
|
{
|
||||||
|
_buildPlacementBlocked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTriggerExit(Collider other)
|
||||||
|
{
|
||||||
|
if(other.name == "BuildCollider")
|
||||||
|
{
|
||||||
|
_buildPlacementBlocked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -124,6 +124,22 @@ 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;
|
||||||
|
// // }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -689,7 +689,7 @@ BoxCollider:
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 8385032484663529878}
|
m_GameObject: {fileID: 8385032484663529878}
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_IsTrigger: 0
|
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, z: 1}
|
||||||
|
@ -745,8 +745,12 @@ MonoBehaviour:
|
||||||
health: 50
|
health: 50
|
||||||
maxHealth: 50
|
maxHealth: 50
|
||||||
isInvulnerable: 0
|
isInvulnerable: 0
|
||||||
|
centerPosition: {fileID: 5103935544759496321}
|
||||||
|
basePosition: {fileID: 8324879816836607384}
|
||||||
cost: 20
|
cost: 20
|
||||||
buildTimer: 1
|
buildTimer: 1
|
||||||
|
buildCollider: {fileID: 0}
|
||||||
|
_buildPlacementBlocked: 0
|
||||||
weaponRange: 40
|
weaponRange: 40
|
||||||
damage: 1
|
damage: 1
|
||||||
fireRate: 1
|
fireRate: 1
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using AsteroidGame.Entities.Structures.Scripts;
|
using AsteroidGame.Entities.Structures.Scripts;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
@ -7,14 +8,13 @@ namespace AsteroidGame.Handlers
|
||||||
{
|
{
|
||||||
public class BuildingHandler : HandlerBase
|
public class BuildingHandler : HandlerBase
|
||||||
{
|
{
|
||||||
[Header("Connections")]
|
[Header("Connections")] [SerializeField]
|
||||||
[SerializeField] private new Camera camera ;
|
private new Camera camera;
|
||||||
|
|
||||||
[Header("State")]
|
[Header("State")] [SerializeField] private bool isBuilding;
|
||||||
[SerializeField] private int buildingSelector;
|
[SerializeField] private int buildingSelector;
|
||||||
|
|
||||||
[Header("Prefabs")]
|
[Header("Prefabs")] [SerializeField] private List<StructureBase> buildings = new();
|
||||||
[SerializeField] private List<StructureBase> buildings = new();
|
|
||||||
|
|
||||||
#region Private
|
#region Private
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ namespace AsteroidGame.Handlers
|
||||||
private Vector3 _tempVec;
|
private Vector3 _tempVec;
|
||||||
private Plane _buildPlane;
|
private Plane _buildPlane;
|
||||||
private StructureBase _tempSb;
|
private StructureBase _tempSb;
|
||||||
|
private StructureBase _ghostStructure;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -29,27 +30,83 @@ namespace AsteroidGame.Handlers
|
||||||
protected override void OnEnable()
|
protected override void OnEnable()
|
||||||
{
|
{
|
||||||
base.OnEnable();
|
base.OnEnable();
|
||||||
|
_buildPlane = new Plane(Vector3.up, Vector3.zero);
|
||||||
activeBuildings.Clear();
|
activeBuildings.Clear();
|
||||||
camera = Camera.main;
|
camera = Camera.main;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnClick(InputAction.CallbackContext a)
|
private void Update()
|
||||||
{
|
{
|
||||||
PlaceBuilding();
|
if (isBuilding)
|
||||||
|
{
|
||||||
|
_ghostStructure.transform.position = GetPlanePoint();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PlaceBuilding()
|
protected override void OnLeftClick(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
if (!isBuilding) return;
|
||||||
|
if (_ghostStructure.BuildPlacementBlocked) return;
|
||||||
|
DestroyGhostStructure();
|
||||||
|
SpawnStructure();
|
||||||
|
isBuilding = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnRightClick(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
if (!isBuilding) return;
|
||||||
|
DestroyGhostStructure();
|
||||||
|
isBuilding = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnBuild(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
isBuilding = true;
|
||||||
|
SpawnGhostStructure();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SpawnGhostStructure()
|
||||||
|
{
|
||||||
|
_ghostStructure = Instantiate(buildings[buildingSelector], GetPlanePoint(), Quaternion.identity, transform);
|
||||||
|
_ghostStructure.name = "GhostStructure";
|
||||||
|
|
||||||
|
var rb = _ghostStructure.gameObject.AddComponent<Rigidbody>();
|
||||||
|
rb.useGravity = false;
|
||||||
|
|
||||||
|
// foreach (var renderer in _ghostStructure.GetComponents<MeshRenderer>())
|
||||||
|
// {
|
||||||
|
// var color = renderer.material.color;
|
||||||
|
// var tempcolor = color;
|
||||||
|
// tempcolor.a = 0.1f;
|
||||||
|
// color = tempcolor;
|
||||||
|
// }
|
||||||
|
|
||||||
|
_ghostStructure.GetComponent<StructureBase>().enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DestroyGhostStructure()
|
||||||
|
{
|
||||||
|
Destroy(_ghostStructure.gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SpawnStructure()
|
||||||
|
{
|
||||||
|
_tempSb = Instantiate(buildings[buildingSelector], GetPlanePoint(), Quaternion.identity, transform);
|
||||||
|
activeBuildings.Add(_tempSb);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Vector3 GetPlanePoint()
|
||||||
{
|
{
|
||||||
_buildPlane = new Plane(Vector3.up, Vector3.zero);
|
|
||||||
Ray ray = camera.ScreenPointToRay(Mouse.current.position.ReadValue());
|
Ray ray = camera.ScreenPointToRay(Mouse.current.position.ReadValue());
|
||||||
if (_buildPlane.Raycast(ray, out float distance))
|
if (_buildPlane.Raycast(ray, out float distance))
|
||||||
{
|
{
|
||||||
_tempVec = ray.GetPoint(distance);
|
return ray.GetPoint(distance);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print("BuildPlaneNotHit");
|
||||||
|
return Vector3.zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
_tempSb = Instantiate(buildings[buildingSelector], _tempVec, Quaternion.identity, transform);
|
|
||||||
|
|
||||||
activeBuildings.Add(_tempSb);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,16 +16,30 @@ namespace AsteroidGame.Handlers
|
||||||
protected virtual void OnEnable()
|
protected virtual void OnEnable()
|
||||||
{
|
{
|
||||||
_handlerControls.Player.Enable();
|
_handlerControls.Player.Enable();
|
||||||
_handlerControls.Player.Click.performed += OnClick;
|
_handlerControls.Player.LeftClick.performed += OnLeftClick;
|
||||||
|
_handlerControls.Player.RightClick.performed += OnRightClick;
|
||||||
|
_handlerControls.Player.Build.performed += OnBuild;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnDisable()
|
protected virtual void OnDisable()
|
||||||
{
|
{
|
||||||
_handlerControls.Player.Click.performed -= OnClick;
|
_handlerControls.Player.LeftClick.performed -= OnLeftClick;
|
||||||
|
_handlerControls.Player.RightClick.performed -= OnRightClick;
|
||||||
|
_handlerControls.Player.Build.performed -= OnBuild;
|
||||||
_handlerControls.Player.Disable();
|
_handlerControls.Player.Disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnClick(InputAction.CallbackContext a)
|
protected virtual void OnLeftClick(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnRightClick(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnBuild(InputAction.CallbackContext context)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,13 +48,31 @@ namespace AsteroidGame
|
||||||
""initialStateCheck"": true
|
""initialStateCheck"": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
""name"": ""Click"",
|
""name"": ""LeftClick"",
|
||||||
""type"": ""Button"",
|
""type"": ""Button"",
|
||||||
""id"": ""c7463e6d-1380-4e73-9edf-f690e3eabd4e"",
|
""id"": ""c7463e6d-1380-4e73-9edf-f690e3eabd4e"",
|
||||||
""expectedControlType"": ""Button"",
|
""expectedControlType"": ""Button"",
|
||||||
""processors"": """",
|
""processors"": """",
|
||||||
""interactions"": """",
|
""interactions"": """",
|
||||||
""initialStateCheck"": false
|
""initialStateCheck"": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
""name"": ""Build"",
|
||||||
|
""type"": ""Button"",
|
||||||
|
""id"": ""6e8d8fb8-b4a0-474e-987e-8df78202fc67"",
|
||||||
|
""expectedControlType"": ""Button"",
|
||||||
|
""processors"": """",
|
||||||
|
""interactions"": """",
|
||||||
|
""initialStateCheck"": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
""name"": ""RightClick"",
|
||||||
|
""type"": ""Button"",
|
||||||
|
""id"": ""ba97303e-0882-48d7-85fd-8b0d6d63b06f"",
|
||||||
|
""expectedControlType"": ""Button"",
|
||||||
|
""processors"": """",
|
||||||
|
""interactions"": """",
|
||||||
|
""initialStateCheck"": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
""bindings"": [
|
""bindings"": [
|
||||||
|
@ -230,7 +248,7 @@ namespace AsteroidGame
|
||||||
""interactions"": """",
|
""interactions"": """",
|
||||||
""processors"": """",
|
""processors"": """",
|
||||||
""groups"": "";Gamepad"",
|
""groups"": "";Gamepad"",
|
||||||
""action"": ""Click"",
|
""action"": ""LeftClick"",
|
||||||
""isComposite"": false,
|
""isComposite"": false,
|
||||||
""isPartOfComposite"": false
|
""isPartOfComposite"": false
|
||||||
},
|
},
|
||||||
|
@ -241,7 +259,7 @@ namespace AsteroidGame
|
||||||
""interactions"": """",
|
""interactions"": """",
|
||||||
""processors"": """",
|
""processors"": """",
|
||||||
""groups"": "";Keyboard&Mouse"",
|
""groups"": "";Keyboard&Mouse"",
|
||||||
""action"": ""Click"",
|
""action"": ""LeftClick"",
|
||||||
""isComposite"": false,
|
""isComposite"": false,
|
||||||
""isPartOfComposite"": false
|
""isPartOfComposite"": false
|
||||||
},
|
},
|
||||||
|
@ -252,7 +270,7 @@ namespace AsteroidGame
|
||||||
""interactions"": """",
|
""interactions"": """",
|
||||||
""processors"": """",
|
""processors"": """",
|
||||||
""groups"": "";Touch"",
|
""groups"": "";Touch"",
|
||||||
""action"": ""Click"",
|
""action"": ""LeftClick"",
|
||||||
""isComposite"": false,
|
""isComposite"": false,
|
||||||
""isPartOfComposite"": false
|
""isPartOfComposite"": false
|
||||||
},
|
},
|
||||||
|
@ -263,7 +281,7 @@ namespace AsteroidGame
|
||||||
""interactions"": """",
|
""interactions"": """",
|
||||||
""processors"": """",
|
""processors"": """",
|
||||||
""groups"": ""Joystick"",
|
""groups"": ""Joystick"",
|
||||||
""action"": ""Click"",
|
""action"": ""LeftClick"",
|
||||||
""isComposite"": false,
|
""isComposite"": false,
|
||||||
""isPartOfComposite"": false
|
""isPartOfComposite"": false
|
||||||
},
|
},
|
||||||
|
@ -274,7 +292,29 @@ namespace AsteroidGame
|
||||||
""interactions"": """",
|
""interactions"": """",
|
||||||
""processors"": """",
|
""processors"": """",
|
||||||
""groups"": ""XR"",
|
""groups"": ""XR"",
|
||||||
""action"": ""Click"",
|
""action"": ""LeftClick"",
|
||||||
|
""isComposite"": false,
|
||||||
|
""isPartOfComposite"": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
""name"": """",
|
||||||
|
""id"": ""30b1502f-c336-426d-b92f-2abd2ee7ccf4"",
|
||||||
|
""path"": ""<Keyboard>/#(B)"",
|
||||||
|
""interactions"": """",
|
||||||
|
""processors"": """",
|
||||||
|
""groups"": """",
|
||||||
|
""action"": ""Build"",
|
||||||
|
""isComposite"": false,
|
||||||
|
""isPartOfComposite"": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
""name"": """",
|
||||||
|
""id"": ""4c4b3c9a-43eb-4688-975e-0058cad51008"",
|
||||||
|
""path"": ""<Mouse>/rightButton"",
|
||||||
|
""interactions"": """",
|
||||||
|
""processors"": """",
|
||||||
|
""groups"": """",
|
||||||
|
""action"": ""RightClick"",
|
||||||
""isComposite"": false,
|
""isComposite"": false,
|
||||||
""isPartOfComposite"": false
|
""isPartOfComposite"": false
|
||||||
}
|
}
|
||||||
|
@ -864,7 +904,9 @@ namespace AsteroidGame
|
||||||
m_Player = asset.FindActionMap("Player", throwIfNotFound: true);
|
m_Player = asset.FindActionMap("Player", throwIfNotFound: true);
|
||||||
m_Player_Move = m_Player.FindAction("Move", throwIfNotFound: true);
|
m_Player_Move = m_Player.FindAction("Move", throwIfNotFound: true);
|
||||||
m_Player_Look = m_Player.FindAction("Look", throwIfNotFound: true);
|
m_Player_Look = m_Player.FindAction("Look", throwIfNotFound: true);
|
||||||
m_Player_Click = m_Player.FindAction("Click", throwIfNotFound: true);
|
m_Player_LeftClick = m_Player.FindAction("LeftClick", throwIfNotFound: true);
|
||||||
|
m_Player_Build = m_Player.FindAction("Build", throwIfNotFound: true);
|
||||||
|
m_Player_RightClick = m_Player.FindAction("RightClick", throwIfNotFound: true);
|
||||||
// UI
|
// UI
|
||||||
m_UI = asset.FindActionMap("UI", throwIfNotFound: true);
|
m_UI = asset.FindActionMap("UI", throwIfNotFound: true);
|
||||||
m_UI_Navigate = m_UI.FindAction("Navigate", throwIfNotFound: true);
|
m_UI_Navigate = m_UI.FindAction("Navigate", throwIfNotFound: true);
|
||||||
|
@ -938,14 +980,18 @@ namespace AsteroidGame
|
||||||
private IPlayerActions m_PlayerActionsCallbackInterface;
|
private IPlayerActions m_PlayerActionsCallbackInterface;
|
||||||
private readonly InputAction m_Player_Move;
|
private readonly InputAction m_Player_Move;
|
||||||
private readonly InputAction m_Player_Look;
|
private readonly InputAction m_Player_Look;
|
||||||
private readonly InputAction m_Player_Click;
|
private readonly InputAction m_Player_LeftClick;
|
||||||
|
private readonly InputAction m_Player_Build;
|
||||||
|
private readonly InputAction m_Player_RightClick;
|
||||||
public struct PlayerActions
|
public struct PlayerActions
|
||||||
{
|
{
|
||||||
private @HandlerControls m_Wrapper;
|
private @HandlerControls m_Wrapper;
|
||||||
public PlayerActions(@HandlerControls wrapper) { m_Wrapper = wrapper; }
|
public PlayerActions(@HandlerControls wrapper) { m_Wrapper = wrapper; }
|
||||||
public InputAction @Move => m_Wrapper.m_Player_Move;
|
public InputAction @Move => m_Wrapper.m_Player_Move;
|
||||||
public InputAction @Look => m_Wrapper.m_Player_Look;
|
public InputAction @Look => m_Wrapper.m_Player_Look;
|
||||||
public InputAction @Click => m_Wrapper.m_Player_Click;
|
public InputAction @LeftClick => m_Wrapper.m_Player_LeftClick;
|
||||||
|
public InputAction @Build => m_Wrapper.m_Player_Build;
|
||||||
|
public InputAction @RightClick => m_Wrapper.m_Player_RightClick;
|
||||||
public InputActionMap Get() { return m_Wrapper.m_Player; }
|
public InputActionMap Get() { return m_Wrapper.m_Player; }
|
||||||
public void Enable() { Get().Enable(); }
|
public void Enable() { Get().Enable(); }
|
||||||
public void Disable() { Get().Disable(); }
|
public void Disable() { Get().Disable(); }
|
||||||
|
@ -961,9 +1007,15 @@ namespace AsteroidGame
|
||||||
@Look.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLook;
|
@Look.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLook;
|
||||||
@Look.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLook;
|
@Look.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLook;
|
||||||
@Look.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLook;
|
@Look.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLook;
|
||||||
@Click.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnClick;
|
@LeftClick.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLeftClick;
|
||||||
@Click.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnClick;
|
@LeftClick.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLeftClick;
|
||||||
@Click.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnClick;
|
@LeftClick.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnLeftClick;
|
||||||
|
@Build.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnBuild;
|
||||||
|
@Build.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnBuild;
|
||||||
|
@Build.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnBuild;
|
||||||
|
@RightClick.started -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRightClick;
|
||||||
|
@RightClick.performed -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRightClick;
|
||||||
|
@RightClick.canceled -= m_Wrapper.m_PlayerActionsCallbackInterface.OnRightClick;
|
||||||
}
|
}
|
||||||
m_Wrapper.m_PlayerActionsCallbackInterface = instance;
|
m_Wrapper.m_PlayerActionsCallbackInterface = instance;
|
||||||
if (instance != null)
|
if (instance != null)
|
||||||
|
@ -974,9 +1026,15 @@ namespace AsteroidGame
|
||||||
@Look.started += instance.OnLook;
|
@Look.started += instance.OnLook;
|
||||||
@Look.performed += instance.OnLook;
|
@Look.performed += instance.OnLook;
|
||||||
@Look.canceled += instance.OnLook;
|
@Look.canceled += instance.OnLook;
|
||||||
@Click.started += instance.OnClick;
|
@LeftClick.started += instance.OnLeftClick;
|
||||||
@Click.performed += instance.OnClick;
|
@LeftClick.performed += instance.OnLeftClick;
|
||||||
@Click.canceled += instance.OnClick;
|
@LeftClick.canceled += instance.OnLeftClick;
|
||||||
|
@Build.started += instance.OnBuild;
|
||||||
|
@Build.performed += instance.OnBuild;
|
||||||
|
@Build.canceled += instance.OnBuild;
|
||||||
|
@RightClick.started += instance.OnRightClick;
|
||||||
|
@RightClick.performed += instance.OnRightClick;
|
||||||
|
@RightClick.canceled += instance.OnRightClick;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1135,7 +1193,9 @@ namespace AsteroidGame
|
||||||
{
|
{
|
||||||
void OnMove(InputAction.CallbackContext context);
|
void OnMove(InputAction.CallbackContext context);
|
||||||
void OnLook(InputAction.CallbackContext context);
|
void OnLook(InputAction.CallbackContext context);
|
||||||
void OnClick(InputAction.CallbackContext context);
|
void OnLeftClick(InputAction.CallbackContext context);
|
||||||
|
void OnBuild(InputAction.CallbackContext context);
|
||||||
|
void OnRightClick(InputAction.CallbackContext context);
|
||||||
}
|
}
|
||||||
public interface IUIActions
|
public interface IUIActions
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "AsteroidGame",
|
"name": "HandlerControls",
|
||||||
"maps": [
|
"maps": [
|
||||||
{
|
{
|
||||||
"name": "Player",
|
"name": "Player",
|
||||||
|
@ -24,13 +24,31 @@
|
||||||
"initialStateCheck": true
|
"initialStateCheck": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Click",
|
"name": "LeftClick",
|
||||||
"type": "Button",
|
"type": "Button",
|
||||||
"id": "c7463e6d-1380-4e73-9edf-f690e3eabd4e",
|
"id": "c7463e6d-1380-4e73-9edf-f690e3eabd4e",
|
||||||
"expectedControlType": "Button",
|
"expectedControlType": "Button",
|
||||||
"processors": "",
|
"processors": "",
|
||||||
"interactions": "",
|
"interactions": "",
|
||||||
"initialStateCheck": false
|
"initialStateCheck": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Build",
|
||||||
|
"type": "Button",
|
||||||
|
"id": "6e8d8fb8-b4a0-474e-987e-8df78202fc67",
|
||||||
|
"expectedControlType": "Button",
|
||||||
|
"processors": "",
|
||||||
|
"interactions": "",
|
||||||
|
"initialStateCheck": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "RightClick",
|
||||||
|
"type": "Button",
|
||||||
|
"id": "ba97303e-0882-48d7-85fd-8b0d6d63b06f",
|
||||||
|
"expectedControlType": "Button",
|
||||||
|
"processors": "",
|
||||||
|
"interactions": "",
|
||||||
|
"initialStateCheck": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"bindings": [
|
"bindings": [
|
||||||
|
@ -206,7 +224,7 @@
|
||||||
"interactions": "",
|
"interactions": "",
|
||||||
"processors": "",
|
"processors": "",
|
||||||
"groups": ";Gamepad",
|
"groups": ";Gamepad",
|
||||||
"action": "Click",
|
"action": "LeftClick",
|
||||||
"isComposite": false,
|
"isComposite": false,
|
||||||
"isPartOfComposite": false
|
"isPartOfComposite": false
|
||||||
},
|
},
|
||||||
|
@ -217,7 +235,7 @@
|
||||||
"interactions": "",
|
"interactions": "",
|
||||||
"processors": "",
|
"processors": "",
|
||||||
"groups": ";Keyboard&Mouse",
|
"groups": ";Keyboard&Mouse",
|
||||||
"action": "Click",
|
"action": "LeftClick",
|
||||||
"isComposite": false,
|
"isComposite": false,
|
||||||
"isPartOfComposite": false
|
"isPartOfComposite": false
|
||||||
},
|
},
|
||||||
|
@ -228,7 +246,7 @@
|
||||||
"interactions": "",
|
"interactions": "",
|
||||||
"processors": "",
|
"processors": "",
|
||||||
"groups": ";Touch",
|
"groups": ";Touch",
|
||||||
"action": "Click",
|
"action": "LeftClick",
|
||||||
"isComposite": false,
|
"isComposite": false,
|
||||||
"isPartOfComposite": false
|
"isPartOfComposite": false
|
||||||
},
|
},
|
||||||
|
@ -239,7 +257,7 @@
|
||||||
"interactions": "",
|
"interactions": "",
|
||||||
"processors": "",
|
"processors": "",
|
||||||
"groups": "Joystick",
|
"groups": "Joystick",
|
||||||
"action": "Click",
|
"action": "LeftClick",
|
||||||
"isComposite": false,
|
"isComposite": false,
|
||||||
"isPartOfComposite": false
|
"isPartOfComposite": false
|
||||||
},
|
},
|
||||||
|
@ -250,7 +268,29 @@
|
||||||
"interactions": "",
|
"interactions": "",
|
||||||
"processors": "",
|
"processors": "",
|
||||||
"groups": "XR",
|
"groups": "XR",
|
||||||
"action": "Click",
|
"action": "LeftClick",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "30b1502f-c336-426d-b92f-2abd2ee7ccf4",
|
||||||
|
"path": "<Keyboard>/#(B)",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "Build",
|
||||||
|
"isComposite": false,
|
||||||
|
"isPartOfComposite": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"id": "4c4b3c9a-43eb-4688-975e-0058cad51008",
|
||||||
|
"path": "<Mouse>/rightButton",
|
||||||
|
"interactions": "",
|
||||||
|
"processors": "",
|
||||||
|
"groups": "",
|
||||||
|
"action": "RightClick",
|
||||||
"isComposite": false,
|
"isComposite": false,
|
||||||
"isPartOfComposite": false
|
"isPartOfComposite": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace AsteroidGame.Interfaces
|
||||||
|
{
|
||||||
|
public interface IBuildable
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 99361805272d7f6419384097857e2bd6
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,11 @@
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace AsteroidGame.Interfaces
|
||||||
|
{
|
||||||
|
public interface ITargetable
|
||||||
|
{
|
||||||
|
public Vector3 GetCenterPosition();
|
||||||
|
|
||||||
|
public Vector3 GetBasePosition();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3d338501124dcf349b3852a83d20dbe4
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -23,7 +23,7 @@ Material:
|
||||||
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_Name: ColliderIndicators
|
m_Name: ColliderIndicator
|
||||||
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
|
m_Shader: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3}
|
||||||
m_ValidKeywords:
|
m_ValidKeywords:
|
||||||
- _DISABLE_SSR_TRANSPARENT
|
- _DISABLE_SSR_TRANSPARENT
|
|
@ -252,6 +252,7 @@ MonoBehaviour:
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
camera: {fileID: 0}
|
camera: {fileID: 0}
|
||||||
|
isBuilding: 0
|
||||||
buildingSelector: 0
|
buildingSelector: 0
|
||||||
buildings:
|
buildings:
|
||||||
- {fileID: 8787361557661825162, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
- {fileID: 8787361557661825162, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
|
@ -313,11 +314,6 @@ 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 &1494623308 stripped
|
|
||||||
GameObject:
|
|
||||||
m_CorrespondingSourceObject: {fileID: 8083988910325146965, guid: c2b4fe01faa847f4b976b5539477e1ec, type: 3}
|
|
||||||
m_PrefabInstance: {fileID: 1191794244}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
--- !u!1001 &1715656625
|
--- !u!1001 &1715656625
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -604,6 +600,10 @@ PrefabInstance:
|
||||||
m_Modification:
|
m_Modification:
|
||||||
m_TransformParent: {fileID: 0}
|
m_TransformParent: {fileID: 0}
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
|
- target: {fileID: 4256226406833302537, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
|
propertyPath: m_IsTrigger
|
||||||
|
value: 1
|
||||||
|
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: 1
|
||||||
|
@ -652,9 +652,6 @@ PrefabInstance:
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: Turret
|
value: Turret
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8787361557661825162, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
m_RemovedComponents:
|
||||||
propertyPath: targetEnemy
|
- {fileID: 1344974744014620977, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
value:
|
|
||||||
objectReference: {fileID: 1494623308}
|
|
||||||
m_RemovedComponents: []
|
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
<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/UserDictionary/Words/=Targetable/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
Loading…
Reference in New Issue