You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.3 KiB
61 lines
1.3 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class OntologyGame : Level
|
|
{
|
|
private float _timeToNextWord = 1f;
|
|
[SerializeField] GameObject _wordPrefab;
|
|
[SerializeField] Canvas _canvas;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
Physics2D.gravity = Vector2.zero;
|
|
base.Start();
|
|
|
|
//AssignTopicsToPlayers();
|
|
}
|
|
|
|
protected override void PostStartupProcess()
|
|
{
|
|
AssignTopicsToPlayers();
|
|
SpawnWord();
|
|
}
|
|
|
|
void SpawnWord()
|
|
{
|
|
GameObject newWord = GameObject.Instantiate(_wordPrefab);
|
|
newWord.transform.parent = _canvas.transform;
|
|
|
|
|
|
_timeToNextWord *= .99f;
|
|
|
|
_timeToNextWord = Mathf.Max(_timeToNextWord, .3f);
|
|
Invoke("SpawnWord", _timeToNextWord);
|
|
|
|
}
|
|
|
|
void AssignTopicsToPlayers()
|
|
{
|
|
foreach (GameObject playerGo in _players)
|
|
{
|
|
Player player = playerGo.GetComponent<Player>();
|
|
TopicData topicData = GameDataManager.Instance.GetRandomTopicData();
|
|
|
|
player.OntologyTopicData = topicData;
|
|
player.SetName(topicData.Topic);
|
|
}
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
base.Awake();
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
base.Update();
|
|
}
|
|
}
|
|
|