initial commit

This commit is contained in:
klemek
2020-12-10 13:18:02 +01:00
commit 67f7123f4d
68 changed files with 5029 additions and 0 deletions
+85
View File
@@ -0,0 +1,85 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameManager : MonoBehaviour
{
#region Static Properties
public static GameManager Instance { get; set; }
#endregion
#region Unity Properties
[Header("Prefabs")]
public Cable CablePrefab;
[Header("Groups")]
public Transform GatesGroup;
public Transform CablesGroup;
[Header("Colors")]
public Color DeadColor;
public Color ActivatedColor;
#endregion
#region Public Properties
public Anchor CurrentAnchor { get; set; }
#endregion
#region Private Properties
private Cable _currentCable;
#endregion
#region Unity Methods
// Start is called before the first frame update
private void Start()
{
if (Instance != null)
throw new InvalidOperationException("More than one GameManager in scene");
Instance = this;
}
// Update is called once per frame
private void Update()
{
if (Input.GetMouseButton(0))
{
if (CurrentAnchor != null && _currentCable == null)
{
_currentCable = Instantiate(CablePrefab, CablesGroup, true);
_currentCable.StartAnchor = CurrentAnchor;
}
}
else if (_currentCable != null)
{
if (CurrentAnchor == null || _currentCable.StartAnchor.IsInput == CurrentAnchor.IsInput)
{
Destroy(_currentCable.gameObject);
}
else
{
_currentCable.EndAnchor = CurrentAnchor;
}
_currentCable = null;
}
}
#endregion
#region Public Methods
#endregion
#region Private Methods
#endregion
}