private void Awake() { //Singleton pattern if (Instance == null) { Instance = this; } else { Destroy(gameObject); return; } //Pipes list pipes = new List <Pipe>(); //Initialize pool GameObject poolObject = new GameObject("CloudPool"); poolObject.transform.parent = transform; pipePool = poolObject.AddComponent <PipePool>(); //Set pool properties pipePool.SetPrefab(pipePrefab); pipePool.AddObjects(20); timer = 0f; }
private void Awake() { if (instance == null) { instance = this; } }
// Use this for initialization void Start() { pipes = new List <GameObject>(); if (Instance == null) { Instance = this; } cor = StartCoroutine(Spawn()); }
//public Text scoreText2; // Start is called before the first frame update void Start() { pipe = GameObject.Find("PipeSpawner").GetComponent <PipeSpawner>(); //pipes = GameObject.Find("PipePair").GetComponent<Pipe>(); gameOver.enabled = false; startOver.onClick.AddListener(() => { SceneManager.LoadScene(0); }); }
void Start() { if(pipeSpawner == null) { PipeSpawner[] spawners = (PipeSpawner[])FindObjectsOfType(typeof(PipeSpawner)); if(spawners.Length > 0) pipeSpawner = spawners[0]; else Debug.LogError("Please create a GameObject with a PipeSpawner component."); } target = pipeSpawner.transform.position; }
void Awake() { gm = GameObject.Find("NNGameManager").GetComponent <NNGameManager>(); pipeSpawner = GameObject.Find("PipeSpawner").GetComponent <PipeSpawner>(); score = 0; fitness = 0; nn = new NeuralNetwork(); scoreText = GameObject.Find("DummyScore").GetComponent <Text>(); fitnessText = GameObject.Find("DummyFitness").GetComponent <Text>(); }
void Awake() { if (instance != null) { Debug.LogWarning( "There should be only ONE instance of " + "PipeSpawner. Destroying this instance..." ); DestroyImmediate(this); return; } instance = this; }
private void Awake() { if (m_instance == null) { m_instance = this; } else if (m_instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); m_pipeSpawner = GetComponent <PipeSpawner>(); InitGame(); }
private void FixedUpdate() { if (!alive) { return; } if (!PlayerSpawner.instance.play) { PipeSpawner firstPipe = PipeSpawnerSpawner.instance.pipes.First.Value; float[] inputs = new float[3]; inputs[0] = (transform.position.y + 4) / 8; inputs[1] = (firstPipe.transform.position.y + 4) / 8f; inputs[2] = (firstPipe.transform.position.x - transform.position.x) / 6; float[] outputs = brain.FeedForward(inputs); if (outputs[0] > .5f) { Jump(); } } }
void OnEnable() { ps = (PipeSpawner)target; }
private void Start() { pipeSpawner = GameObject.FindGameObjectWithTag("PipeController").GetComponent <PipeSpawner>(); }