// Use this for initialization void Start() { rb2d = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); cp = GameObject.FindObjectOfType <ColumnPool>(); start_time = Time.time; }
public void MultiString_Direct_Equals_01() { for (int j = 0; j < 21; j++) { var targetString = j < 20 ? j.ToString() : "x"; // something not found for the last iteration var cap = new CharArrayPool(); var intPool = new ColumnPool <int>(); var shortPool = new ColumnPool <short>(); var bitvectorPool = new ColumnPool <long>(1 + (Config.DataBatchSize >> 6)); var ms = new MultiString(cap, intPool, shortPool, bitvectorPool); var input = new string[20]; for (int i = 0; i < 20; i++) { var s = i.ToString(); input[i] = s; ms.AddString(s); } ms.Seal(); bitvectorPool.Get(out var inBV); var result = ms.Equals(targetString, inBV, false); var output = new List <string>(); for (int i = 0; i < 20; i++) { if ((result.col[i >> 6] & (1L << (i & 0x3f))) == 0) { output.Add(ms[i]); } } var expected = input.Where(e => e.Equals(targetString)); Assert.IsTrue(expected.SequenceEqual(output)); } }
private void Awake() { _ = this; distSinceLastSpawned = distBetweenColumns * 0.9f; columnsTransforms = new Transform[columns.Length]; for (int i = 0; i < columns.Length; i++) { columnsTransforms[i] = columns[i].transform; } Bounds bounds = columns[0].GetComponent <BoxCollider2D>().bounds; scoreRectOffset = bounds.min - columnsTransforms[0].position; scoreRectSize = bounds.max - bounds.min; columnRectOffsets = new Vector3[2]; columnRectSizes = new Vector3[2]; for (int i = 0; i < 2; i++) { bounds = columns[0].transform.GetChild(i).GetComponent <BoxCollider2D>().bounds; columnRectOffsets[i] = bounds.min - columnsTransforms[0].position; columnRectSizes[i] = bounds.max - bounds.min; } }
void Awake() { if (instanceC == null) { instanceC = this; } else if (instanceC != this) { Destroy(gameObject); } }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
void Awake() { betterRandom = new BetterRandom(); if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
void Start() { //Get reference to the Animator component attached to this GameObject. anim = GetComponent <Animator> (); //Get and store a reference to the Rigidbody2D attached to this GameObject. rb2d = GetComponent <Rigidbody2D>(); entity = GetComponent <Entity> (); neuralNet = entity.neuralNet; columnDistanceY = 0.0f; distanceTraveled = 0.0f; columnPool = GameObject.FindObjectOfType <ColumnPool>(); }
public override void AgentReset() { gameObject.transform.position = Vector3.zero; birdRB.velocity = Vector2.zero; ColumnPool poolScript = FindObjectOfType <ColumnPool>(); poolScript.Reset(); Scrolling[] scrollingObjects = (Scrolling[])FindObjectsOfType(typeof(Scrolling)); foreach (Scrolling scrollingObject in scrollingObjects) { scrollingObject.InitScrolling(); } birdController.isDead = false; GameController.instance.gameOver = false; }
// Use this for initialization void Start() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); return; } columns = new GameObject[columnPoolSize]; for (int i = 0; i < columnPoolSize; i++) { columns[i] = (GameObject)Instantiate(columnPrefab, objectPoolPosition, Quaternion.identity); } spawnColumn(); colTopPos = GameObject.FindGameObjectWithTag("ColTop").gameObject.transform.position.y; colBottomPos = GameObject.FindGameObjectWithTag("ColBottom").gameObject.transform.position.y; }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } scoreText = GameObject.Find("ScoreText").GetComponent <Text>(); highScoreText = GameObject.Find("HighScoreText").GetComponent <Text>(); gameOverText = GameObject.Find("GameOverText"); columnPoolScript = GameObject.Find("ColumnManager").GetComponent <ColumnPool>(); highScore = StaticVars.highScore; highScoreText.text = "High Score:" + ReadScore().ToString(); freePlay = StaticVars.freePlay; currentUser = StaticVars.currentUser; //lives = StaticVars.lives; Debug.Log(freePlay); gameOverText.SetActive(false); if (!freePlay) { lives = CheckLives(); livesText.text = "Lives: " + lives.ToString(); if (lives == 0) { gameOver = true; SceneManager.LoadScene("ResetLives"); } } if (freePlay) { //lives = 99; livesText.text = "Lives: " + "∞"; } }
private void Start() { cp = FindObjectOfType <ColumnPool>(); }
void Start() { columnPool = GetComponent <ColumnPool>(); main = customParticleSystem.main; }
void Start() { bird = GameObject.FindGameObjectWithTag("Player").GetComponent <Bird> (); columnPool = GetComponent <ColumnPool> (); }
private void Start() { columnPool = GetComponent <ColumnPool>(); scrollingObjects = FindObjectsOfType <ScrollingObject>(); }