Select Git revision
FactManager.cs
-
MaZiFAU authored
Refactoring: -Eventbased Hint animation extended to sprites +->Added FactObjectUI +->Moved FactWrapper tree in own folder +->Used RectMask (does not work with normal one)
MaZiFAU authoredRefactoring: -Eventbased Hint animation extended to sprites +->Added FactObjectUI +->Moved FactWrapper tree in own folder +->Used RectMask (does not work with normal one)
FactManager.cs 5.96 KiB
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using static CommunicationEvents;
public class FactManager : MonoBehaviour
{
public GameObject SmartMenu;
private List<int> NextEmpties = new List<int>();
// Start is called before the first frame update
void Start()
{
// CommunicationEvents.SnapEvent.AddListener(Rocket);
//We dont want to have this here anymore...
//CommunicationEvents.RemoveFactEvent.AddListener(DeleteFact);
NextEmpties.Add(0);
}
// Update is called once per frame
void Update()
{
}
//TODO: change the return find....
public PointFact AddPointFact(RaycastHit hit, int id)
{
Facts.Insert(id, new PointFact(id, hit.point, hit.normal));
return Facts.Find(x => x.Id == id) as PointFact;
}
public LineFact AddLineFact(int pid1, int pid2, int id)
{
Facts.Insert(id, new LineFact(id, pid1, pid2));
return Facts.Find(x => x.Id == id) as LineFact;
}
public RayFact AddRayFact(int pid1, int pid2, int id)
{
Facts.Insert(id, new RayFact(id, pid1, pid2));
var oLid = GetFirstEmptyID();
Facts.Insert(oLid, new OnLineFact(oLid, pid1, id));
oLid = GetFirstEmptyID();
Facts.Insert(oLid, new OnLineFact(oLid, pid2, id));
var p1 = Facts.Find(x => x.Id == pid1);
var p2 = Facts.Find(x => x.Id == pid2);
Vector3 dir = p2.Representation.transform.position - p1.Representation.transform.position;
// Bit shift the index of the layer Point to get a bit mask
int layerMask = 1 << LayerMask.NameToLayer("Point");
// This casts rays only against colliders in layer 8