Important Readme Update

This commit is contained in:
hyperion51 2020-03-28 18:36:12 +00:00
commit 2236ecd129
26 changed files with 625 additions and 71 deletions

View file

@ -0,0 +1,69 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
public class ClickCatcher : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler
{
public bool EnableMouse => PointerIsInside && !_catching;
public bool PointerIsInside { get; private set; }
public PointerEnterEvent OnEnter = new PointerEnterEvent();
public PointerExitEvent OnExit = new PointerExitEvent();
private bool _catching;
private UnityEvent _catchClick;
public static ClickCatcher Background
{
get
{
if (_background == null)
_background = GameObject.FindGameObjectWithTag("UIBackground").GetComponent<ClickCatcher>();
return _background;
}
}
private static ClickCatcher _background;
public UnityEvent Catch()
{
_catching = true;
_catchClick = new UnityEvent();
return _catchClick;
}
public void Release()
{
_catching = false;
}
public void OnPointerEnter(PointerEventData eventData)
{
//Debug.Log("Pointer Entered");
OnEnter.Invoke();
PointerIsInside = true;
}
public void OnPointerExit(PointerEventData eventData)
{
//Debug.Log("Pointer Exited");
OnExit.Invoke();
PointerIsInside = false;
}
public void OnPointerClick(PointerEventData eventData)
{
if (!_catching) return;
_catchClick.Invoke();
_catching = false;
}
[Serializable]
public class PointerEnterEvent : UnityEvent { }
[Serializable]
public class PointerExitEvent : UnityEvent { }
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 20fa7724865c6b04097615292a325dfe
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -39,6 +39,7 @@ public class ZoneGenerator
};
// There is some chance of generating a rosette or binary system
// Probabilities which are fixed for the entire galaxy are in GlobalData, contained in the GameContext
var rosette = random.NextFloat() < context.GlobalData.RosetteProbability;
if (rosette)
@ -115,6 +116,9 @@ public class ZoneGenerator
}
}
// All orbiting bodies are referred to here as "Planets"
// This goes back to the original etymology for the word planet, which is traveler,
// Because they were objects we observed to move in the sky instead of remaining fixed like the stars
public class Planet
{
public Random Random;
@ -126,9 +130,10 @@ public class Planet
public float ChildDistanceMinimum;
public float ChildDistanceMaximum;
public bool Empty = false;
public List<Planet> Children = new List<Planet>();
public List<Planet> Children = new List<Planet>(); // Planets orbiting this one are referred to as children
public Planet Parent;
// Recursively gather all planets in the hierarchy
public IEnumerable<Planet> AllPlanets()
{
return new[]{this}.Concat(Children.SelectMany(c=>c.AllPlanets()));