public void GetReboundStrategyTest1() { NonPassableArenaObjectFactory factory = new NonPassableArenaObjectFactory(); ObstacleBuilder objBuilder = new ObstacleBuilder().AddDuration(10).AddHeigth(10).AddPosX(10).AddWidth(10).AddPosY(10); Obstacle obstacle = factory.CreateObstacle(objBuilder); Assert.AreEqual(ArenaObjectType.NonPassable, obstacle.Type); }
private void InitializeBuilders() { platformBuilder = new PlatformBuilder(platformParent, platformsStats.Platform, platformsStats.Corner, platformsStats.Finish, platformsStats.LengthOfPlatform, platformsStats.WidthOfPlatform); coinBuilder = new CoinBuilder(coinsParent, coinsStats.CoinsPrefab, maxLengthAmountCoins, maxWidthAmountCoins, coinsStats.CoinsSide, PositionToSpawn.AfterObstacles); obstacleBuilder = new ObstacleBuilder(obstaclesParent, obstaclesStats.ObstaclesPrefab, obstaclesStats.SideOfObstacles); cubeBuilder = new CubeBuilder(cubesParent, cubesStats.CubesPrefab, cubesStats.SideCubes, PositionToSpawn.BeforeObstacles); }
public void CreateObjectTest() { ObstacleBuilder builder = new ObstacleBuilder(); builder.AddDuration(10).AddHeigth(10).AddPosX(10).AddPosY(10).AddWidth(10); ArenaObject obj = builder.CreateObject(); Assert.IsTrue(obj.Duration == 10 && obj.Heigth == 10 && obj.PosX == 10 && obj.PosY == 10 && obj.Width == 10); }
public void AddHeigthTest() { ObstacleBuilder builder = new ObstacleBuilder(); builder.AddHeigth(10); ArenaObject obj = builder.CreateObject(); Assert.AreEqual(10, obj.Heigth); }
public void AddPosYTest() { ObstacleBuilder builder = new ObstacleBuilder(); builder.AddPosY(10); ArenaObject obj = builder.CreateObject(); Assert.AreEqual(10, obj.PosY); }
public void AddDurationTest() { ObstacleBuilder builder = new ObstacleBuilder(); builder.AddDuration(10); ArenaObject obj = builder.CreateObject(); Assert.AreEqual(10, obj.Duration); }
public void AddPosTest() { ObstacleBuilder builder = new ObstacleBuilder(); Vector2 pos = new Vector2(10, 10); builder.AddPos(pos); ArenaObject obj = builder.CreateObject(); Assert.IsTrue(obj.PosX == 10 && obj.PosY == 10); }
public void CreateObstacleTest() { PassableArenaObjectFactory factory = new PassableArenaObjectFactory(); ObstacleBuilder objBuilder = new ObstacleBuilder().AddDuration(10).AddHeigth(10).AddPosX(10).AddWidth(10).AddPosY(10); Obstacle obstacle = factory.CreateObstacle(objBuilder); Assert.IsTrue(obstacle.Type == ArenaObjectType.Passable && obstacle.Duration == 10 && obstacle.Heigth == 10 && obstacle.PosX == 10 && obstacle.Width == 10 && obstacle.PosY == 10); }
private void CreateObstacleGUIButton(string name, ObstacleBuilder.ObstacleType type) { EditorGUILayout.BeginHorizontal(); bool isButtonPressed = GUILayout.Button(name, EditorGUIStyles.ButtonStyle); EditorGUILayout.EndHorizontal(); if (isButtonPressed) { ObstacleBuilder.CreateObstacle(type); } }
protected override void Spawn() { var width = Params.RollWidth(); var height = Params.RollHeight(); var duration = Params.RollDuration(); var pos = Params.RollPosition(); var obstacleBuilder = new ObstacleBuilder().AddHeigth(width).AddWidth(height).AddDuration(duration).AddPos(pos); var obstacle = Factories[RandomNumber.NextInt(0, Factories.Length)].CreateObstacle(obstacleBuilder); ArenaFacade.Instance.OnArenaObjectCreated(obstacle); SpawnInterval = Params.RollInterval(); LastSpawnTime = Time; }
public void CheckCollisionWithArenaObjectsTest() { Vector2 startingDir = new Vector2(1, 1); Ball testBall = Ball.CreateBall(0, BallType.Normal, new Vector2(225.5 + 200.5, 225.5), GameData.DefaultBallSpeed, startingDir, GameData.DefaultBallSize); ObstacleBuilder objBuilder = new ObstacleBuilder().AddDuration(10).AddHeigth(1000).AddPosX(225.5f).AddWidth(1000).AddPosY(225.5f); var Factories = new NonPassableArenaObjectFactory(); var obstacle = Factories.CreateObstacle(objBuilder); Dictionary <byte, ArenaObject> obsDict = new Dictionary <byte, ArenaObject>(); obsDict.Add(obstacle.Id, obstacle); testBall.CheckCollisionWithArenaObjects(obsDict); Vector2 dirAfterCollision = testBall.Direction; Assert.AreNotEqual(startingDir, dirAfterCollision); }
private void CreateNewChains() { ChainCreator myScript = (ChainCreator)target; for (int i = 0; i < myScript.WallMounts.Count; i++) { GameObject root = new GameObject(); ObstacleBuilder.CreateLogChain(root, myScript.WallMounts[i], myScript.ObstacleMounts[i]); ObstacleBuilder.AttachChain(root.GetComponent <VampLamp.Core.Obstacles.Chain.Chain>(), myScript.WallMounts[i], myScript.ObstacleMounts[i]); root.name = "Chain" + i.ToString(); root.transform.SetParent(myScript.transform); myScript.Chains.Add(root); } }
public void ReboundPositionTest() { NonPassableObstacleStrategy strategy = new NonPassableObstacleStrategy(); Paddle paddle = new NormalPaddle(10, PaddleDataFactory.GetPaddleData(PaddleType.Normal)); Vector2 vector = new Vector2(10, 10); Vector2 normalised = new Vector2(1, 0); Ball b = Ball.CreateBall(0, BallType.Deadly, vector, 10, vector, 10); NonPassableArenaObjectFactory factory = new NonPassableArenaObjectFactory(); ObstacleBuilder objBuilder = new ObstacleBuilder().AddDuration(10).AddHeigth(10).AddPosX(5).AddWidth(10).AddPosY(5); Obstacle obstacle = factory.CreateObstacle(objBuilder); Vector2 result = strategy.ReboundPosition(b, normalised, paddle, obstacle); Assert.IsFalse(vector == result); }
GameObject obstaclePrefab; //future: change to array private void Awake() { current = this; obstaclePrefab = Resources.Load("Prefabs/Obstacles/CubeObstacle") as GameObject; }