private GameObject InstantiatePlatformAtRGP(float x, float y) { GameObject platform = InstantiateAtRGP(WorldGenerator.WG.Platform, x, y); MoveHorizontally mh = platform.GetComponent <MoveHorizontally>(); mh.Speed = Random.Range(5.0f, 20.0f); return(platform); }
protected GameObject InstantiateMovingEnemyXAtRGP(int y) { int xGridPos = FindFreeXAtRGP(y); GameObject enemy = InstantiateEnemyAtPosition(WorldGenerator.WG.MovingEnemyX, xGridPos, y); if (enemy != null) { MoveHorizontally mh = enemy.GetComponent <MoveHorizontally>(); mh.Speed = Random.Range(7.0f, 15.0f); } return(enemy); }