void Start() { blockClass = new List <Block>(); curr = GetComponent <Ball>(); paddleClass = Paddle.GetComponent <Paddle>(); foreach (GameObject blocks in Block) { Block some = blocks.GetComponent <Block>(); blockClass.Add(some); } speed = DataScript.ball_speed; randValue = Random.Range(0, sign.Length); position = transform.position; ball_Collider = GetComponent <Collider2D>(); if (WallR != null) { WallR_Collider = WallR.GetComponent <BoxCollider2D>(); } if (WallL != null) { WallL_Collider = WallL.GetComponent <BoxCollider2D>(); } if (Paddle != null) { paddle_Collider = Paddle.GetComponent <BoxCollider2D>(); } if (Ceil != null) { Ceil_Collider = Ceil.GetComponent <BoxCollider2D>(); } }
void Awake() { /*Dictionary<string, bool> dic = new Dictionary<string, bool>(); * ArrayList list = new ArrayList(); * int count = 0; * DateTime dateBegin = DateTime.Now; * for (int y = -100; y < 100; y++) * { * for(int x = -100; x < 100; x++) * { * if(UnityEngine.Random.Range(0f,1f) < 0.05f) * { * GameBody body = BufferManager.Instance.CreateGameBody(x, y); * Ceil ceil = body.ceils[0] as Ceil; * ceil.gameObject.AddComponent<ControllerRandomAbility>(); * count++; * } * } * } * Debug.Log("All:" + count);*/ for (int i = -20; i < 20; i++) { BufferManager.Instance.CreateGameBody(i, -2); } for (int i = 1; i < 20; i++) { BufferManager.Instance.CreateGameBody(-20, -2 + i); BufferManager.Instance.CreateGameBody(20, -2 + i); } GameBody body = BufferManager.Instance.CreateGameBody(0, 0); Ceil ceil = body.ceils [0] as Ceil; ceil.gameObject.AddComponent <ControllerAbility> (); }
private Tuple <int, int> CheckNearestCell(Ceil ceil, int x, int y) { // Проверка палубы слева if (x > 0 && Grid[x - 1, y] == ceil) { return(Tuple.Create(x - 1, y)); } // Проверка палубы справа if (x < Constants.MapSize - 1 && Grid[x + 1, y] == ceil) { return(Tuple.Create(x + 1, y)); } // Проверка палубы сверху if (y > 0 && Grid[x, y - 1] == ceil) { return(Tuple.Create(x, y - 1)); } // Проверка палубы снизу if (y < Constants.MapSize - 1 && Grid[x, y + 1] == ceil) { return(Tuple.Create(x, y + 1)); } return(null); }
public void RemoveCeil(Ceil ceil) { if (!ceils.Remove(ceil)) { throw new CeilNotFoundException(ceil); } }
/** * 添加细胞 **/ public void AddCeil(Ceil ceil, int ceilx, int ceily) { ceil.gameObject.transform.parent = gameObject.transform; ceil._body = this; ceil.ChangeCeilPosition(ceilx, ceily); ceils.Add(ceil); }
public void CloneTest() { var exp = new Ceil(new Number(0)); var clone = exp.Clone(); Assert.Equal(exp, clone); }
public void ExecuteTestNumber() { var ceil = new Ceil(new Number(5.55555555)); var result = ceil.Execute(); var expected = 6.0; Assert.Equal(expected, result); }
public static TetrisFigure CreateT() { var color = Colors.Purple; return(new TetrisFigure( Ceil.Create(0, MiddleColumn + 1, color), Ceil.Create(0, MiddleColumn - 1, color), Ceil.Create(0, MiddleColumn, color), Ceil.Create(1, MiddleColumn, color) )); }
public static TetrisFigure CreateSkew() { var color = Colors.Green; return(new TetrisFigure( Ceil.Create(1, MiddleColumn - 2, color), Ceil.Create(1, MiddleColumn - 1, color), Ceil.Create(0, MiddleColumn - 1, color), Ceil.Create(0, MiddleColumn, color) )); }
public static TetrisFigure CreateSquare() { var color = Colors.Yellow; return(new TetrisFigure( Ceil.Create(1, MiddleColumn, color), Ceil.Create(1, MiddleColumn - 1, color), Ceil.Create(0, MiddleColumn - 1, color), Ceil.Create(0, MiddleColumn, color) )); }
public static TetrisFigure CreateL() { var color = Colors.Orange; return(new TetrisFigure( Ceil.Create(0, MiddleColumn - 1, color), Ceil.Create(1, MiddleColumn - 1, color), Ceil.Create(2, MiddleColumn - 1, color), Ceil.Create(2, MiddleColumn, color) )); }
public static TetrisFigure CreateStraight() { var color = Colors.DarkBlue; return(new TetrisFigure( Ceil.Create(0, 4, color), Ceil.Create(1, 4, color), Ceil.Create(2, 4, color), Ceil.Create(3, 4, color) )); }
public Coords(int[] arr) { _p1 = new Ceil(arr[0], arr[1]); _p2 = new Ceil(arr[2], arr[3]); }
void Awake() { ceil = gameObject.GetComponent <Ceil> (); body = ceil.body; this.init(); }
void SetCeils() { int x = 0, y = 0; while (ceils[x, y].state != 2) { Ceil myCeil = ceils[x, y]; Dirs myDir = (myCeil.dirs.Count > 0) ? myCeil.dirs[random.Next(0, myCeil.dirs.Count)] : Dirs.None; if (myDir != Dirs.None) { myCeil.dirs.Remove(myDir); } switch (myDir) { case Dirs.Left: if (x > 0) { x--; Ceil addCeil = ceils[x, y]; if (addCeil.state == 0) { myCeil.CreateDir(Dirs.Left); addCeil.CreateDir(Dirs.Right); addCeil.backWay = new Vector2(x + 1, y); } } break; case Dirs.Right: if (x < mapSize.x - 1) { x++; Ceil addCeil = ceils[x, y]; if (addCeil.state == 0) { myCeil.CreateDir(Dirs.Right); addCeil.CreateDir(Dirs.Left); addCeil.backWay = new Vector2(x - 1, y); } } break; case Dirs.Top: if (y < mapSize.y - 1) { y++; Ceil addCeil = ceils[x, y]; if (addCeil.state == 0) { myCeil.CreateDir(Dirs.Top); addCeil.CreateDir(Dirs.Bottom); addCeil.backWay = new Vector2(x, y - 1); } } break; case Dirs.Bottom: if (y > 0) { y--; Ceil addCeil = ceils[x, y]; if (addCeil.state == 0) { myCeil.CreateDir(Dirs.Bottom); addCeil.CreateDir(Dirs.Top); addCeil.backWay = new Vector2(x, y + 1); } } break; case Dirs.None: myCeil.state = 2; x = (int)(myCeil.backWay.x); y = (int)(myCeil.backWay.y); break; } } }
public void TestCeilException() { var exp = new Ceil(new Bool(false)); TestException(exp); }
public CeilNotFoundException(Ceil ceil) { this.ceil = ceil; }
public void CeilToStringTest() { var ceil = new Ceil(new Number(5.55555555)); Assert.Equal("ceil(5.55555555)", ceil.ToString(commoonFormatter)); }
public void ExecuteTestExecption() { var exp = new Ceil(new Bool(false)); Assert.Throws <ResultIsNotSupportedException>(() => exp.Execute()); }
public bool HasCeilOnRow(Ceil ceil) { return(HasCeilOnRow(ceil.Row)); }
public bool HasCeilInColumn(Ceil ceil) { return(HasCeilInColumn(ceil.Column)); }
/// <summary> /// Analyzes the specified expression. /// </summary> /// <param name="exp">The expression.</param> /// <returns>The result of analysis.</returns> public string Analyze(Ceil exp) { return(ToString(exp, "ceil({0})")); }
public Node <INode> GetNode(string nodeName) { switch (nodeName) { case Absolute.NAME: INode nodeAbsolute = new Absolute() as INode; return(new Node <INode>(nodeAbsolute)); case Approx.NAME: INode nodeAprox = new Approx() as INode; return(new Node <INode>(nodeAprox)); case ArcCos.NAME: INode nodeArcCos = new ArcCos() as INode; return(new Node <INode>(nodeArcCos)); case ArcSin.NAME: INode nodeArcSin = new ArcSin() as INode; return(new Node <INode>(nodeArcSin)); case ArcTan2.NAME: INode nodeArcTan2 = new ArcTan2() as INode; return(new Node <INode>(nodeArcTan2)); case Ceil.NAME: INode nodeCeil = new Ceil() as INode; return(new Node <INode>(nodeCeil)); case CeilToInt.NAME: INode nodeCeilToInt = new CeilToInt() as INode; return(new Node <INode>(nodeCeilToInt)); case Clamp.NAME: INode nodeClamp = new Clamp() as INode; return(new Node <INode>(nodeClamp)); case Clamp01.NAME: INode nodeClamp01 = new Clamp01() as INode; return(new Node <INode>(nodeClamp01)); case ClosestPowerOf2.NAME: INode nodeClosestPowerOf2 = new ClosestPowerOf2() as INode; return(new Node <INode>(nodeClosestPowerOf2)); case Cosinus.NAME: INode nodeCosinus = new Cosinus() as INode; return(new Node <INode>(nodeCosinus)); case DeltaAngle.NAME: INode nodeDeltaAngle = new DeltaAngle() as INode; return(new Node <INode>(nodeDeltaAngle)); case Exp.NAME: INode nodeExp = new Exp() as INode; return(new Node <INode>(nodeExp)); case Floor.NAME: INode nodeFloor = new Floor() as INode; return(new Node <INode>(nodeFloor)); case FloorToInt.NAME: INode nodeFloorToInt = new FloorToInt() as INode; return(new Node <INode>(nodeFloorToInt)); case Lerp.NAME: INode nodeLerp = new Lerp() as INode; return(new Node <INode>(nodeLerp)); case LerpAngle.NAME: INode nodeLerpAngle = new LerpAngle() as INode; return(new Node <INode>(nodeLerpAngle)); case Log10.NAME: INode nodeLog10 = new Log10() as INode; return(new Node <INode>(nodeLog10)); case Logarithm.NAME: INode nodeLogarithm = new Logarithm() as INode; return(new Node <INode>(nodeLogarithm)); case Sinus.NAME: INode nodeSinus_ = new Sinus() as INode; return(new Node <INode>(nodeSinus_)); case Max.NAME: INode nodeMax = new Max() as INode; return(new Node <INode>(nodeMax)); case Min.NAME: INode nodeMin = new Min() as INode; return(new Node <INode>(nodeMin)); case MoveTowards.NAME: INode nodeMoveTowards = new MoveTowards() as INode; return(new Node <INode>(nodeMoveTowards)); case MoveTowardsAngle.NAME: INode nodeMoveTowardsAngle = new MoveTowardsAngle() as INode; return(new Node <INode>(nodeMoveTowardsAngle)); case NextPowerOfTwo.NAME: INode nodeNextPowerOfTwo = new NextPowerOfTwo() as INode; return(new Node <INode>(nodeNextPowerOfTwo)); case PerlinNoise.NAME: INode nodePerlinNoise = new PerlinNoise() as INode; return(new Node <INode>(nodePerlinNoise)); case PingPong.NAME: INode nodePingPong = new PingPong() as INode; return(new Node <INode> (nodePingPong)); case Pow.NAME: INode nodePow = new Pow() as INode; return(new Node <INode>(nodePow)); case SquareRoot.NAME: INode nodeSqrt = new SquareRoot() as INode; return(new Node <INode>(nodeSqrt)); case Tan.NAME: INode nodeTan = new Tan() as INode; return(new Node <INode>(nodeTan)); case Random.NAME: INode nodeRandom = new Random() as INode; return(new Node <INode>(nodeRandom)); default: return(null); } }
/// <summary> /// Creates an expression object from <see cref="FunctionToken"/>. /// </summary> /// <param name="token">The function token.</param> /// <returns>An expression.</returns> protected virtual IExpression CreateFunction(FunctionToken token) { IExpression exp; switch (token.Function) { case Functions.Add: exp = new Add(); break; case Functions.Sub: exp = new Sub(); break; case Functions.Mul: exp = new Mul(); break; case Functions.Div: exp = new Div(); break; case Functions.Pow: exp = new Pow(); break; case Functions.Absolute: exp = new Abs(); break; case Functions.Sine: exp = new Sin(); break; case Functions.Cosine: exp = new Cos(); break; case Functions.Tangent: exp = new Tan(); break; case Functions.Cotangent: exp = new Cot(); break; case Functions.Secant: exp = new Sec(); break; case Functions.Cosecant: exp = new Csc(); break; case Functions.Arcsine: exp = new Arcsin(); break; case Functions.Arccosine: exp = new Arccos(); break; case Functions.Arctangent: exp = new Arctan(); break; case Functions.Arccotangent: exp = new Arccot(); break; case Functions.Arcsecant: exp = new Arcsec(); break; case Functions.Arccosecant: exp = new Arccsc(); break; case Functions.Sqrt: exp = new Sqrt(); break; case Functions.Root: exp = new Root(); break; case Functions.Ln: exp = new Ln(); break; case Functions.Lg: exp = new Lg(); break; case Functions.Lb: exp = new Lb(); break; case Functions.Log: exp = new Log(); break; case Functions.Sineh: exp = new Sinh(); break; case Functions.Cosineh: exp = new Cosh(); break; case Functions.Tangenth: exp = new Tanh(); break; case Functions.Cotangenth: exp = new Coth(); break; case Functions.Secanth: exp = new Sech(); break; case Functions.Cosecanth: exp = new Csch(); break; case Functions.Arsineh: exp = new Arsinh(); break; case Functions.Arcosineh: exp = new Arcosh(); break; case Functions.Artangenth: exp = new Artanh(); break; case Functions.Arcotangenth: exp = new Arcoth(); break; case Functions.Arsecanth: exp = new Arsech(); break; case Functions.Arcosecanth: exp = new Arcsch(); break; case Functions.Exp: exp = new Exp(); break; case Functions.GCD: exp = new GCD(); break; case Functions.LCM: exp = new LCM(); break; case Functions.Factorial: exp = new Fact(); break; case Functions.Sum: exp = new Sum(); break; case Functions.Product: exp = new Product(); break; case Functions.Round: exp = new Round(); break; case Functions.Floor: exp = new Floor(); break; case Functions.Ceil: exp = new Ceil(); break; case Functions.Derivative: exp = new Derivative(); break; case Functions.Simplify: exp = new Simplify(); break; case Functions.Del: exp = new Del(); break; case Functions.Define: exp = new Define(); break; case Functions.Vector: exp = new Vector(); break; case Functions.Matrix: exp = new Matrix(); break; case Functions.Transpose: exp = new Transpose(); break; case Functions.Determinant: exp = new Determinant(); break; case Functions.Inverse: exp = new Inverse(); break; case Functions.If: exp = new If(); break; case Functions.For: exp = new For(); break; case Functions.While: exp = new While(); break; case Functions.Undefine: exp = new Undefine(); break; case Functions.Im: exp = new Im(); break; case Functions.Re: exp = new Re(); break; case Functions.Phase: exp = new Phase(); break; case Functions.Conjugate: exp = new Conjugate(); break; case Functions.Reciprocal: exp = new Reciprocal(); break; case Functions.Min: exp = new Min(); break; case Functions.Max: exp = new Max(); break; case Functions.Avg: exp = new Avg(); break; case Functions.Count: exp = new Count(); break; case Functions.Var: exp = new Var(); break; case Functions.Varp: exp = new Varp(); break; case Functions.Stdev: exp = new Stdev(); break; case Functions.Stdevp: exp = new Stdevp(); break; default: exp = null; break; } if (exp is DifferentParametersExpression diff) { diff.ParametersCount = token.CountOfParams; } return(exp); }
public void TestCeilVariable() { var exp = new Ceil(Variable.X); Test(exp, ResultType.Number); }
/// <summary> /// Analyzes the specified expression. /// </summary> /// <param name="exp">The expression.</param> /// <returns> /// The result of analysis. /// </returns> /// <exception cref="System.NotSupportedException">Always.</exception> public virtual TResult Analyze(Ceil exp) { throw new NotSupportedException(); }
public void TestCeilNumber() { var exp = new Ceil(new Number(-2)); Test(exp, ResultType.Number); }
public void AddCeilToWorld(int coordx, int coordy, Ceil item) { coords.Add(coordx + "," + coordy, item); }
public void TestCeilVariable() { var exp = new Ceil(Variable.X); Test(exp, ResultType.Undefined); }