public override void Update(GameTime gameTime) { Position += Speed; Angle += AngularSpeed; Opacity -= OpacityChange; CurrentLife += gameTime.ElapsedGameTime.Milliseconds; }

public override void OnEnable() { team = target as Team; teamScroll = Vector2.zero; base.OnEnable(); name = "Team"; }

public ObjectClass(Texture2D Img) { Image = Img; Position = Vector2.Zero; Center = Vector2.Zero; Rotation = 0.0f; }

public Emitter(Vector2 position, Texture2D sprite, Color color, int size) { this.position = position; this.sprite = sprite; this.color = color; this.size = size; }

public void Transform(Matrix transform) { Vector2[] transformed = new Vector2[_vertices.Length]; Vector2.Transform(_vertices.ToArray(), ref transform, transformed); _transformedvertices.Clear(); _transformedvertices.vertices.InsertRange(0, transformed); }

public void m0002cf(ref bool[] p0, ref bool[] p1) { for (int i = 0; i < p0.Length; i++) { this.f00000a[i] = p0[i]; } for (int j = 0; j < p1.Length; j++) { this.f000056[j] = p1[j]; } this.f000030 = Vector2.Zero; if (this.m000017(enum020a.f00006d)) { this.f000030.X = -1f; } else if (this.m000017(enum020a.f00006e)) { this.f000030.X = 1f; } if (this.m000017(enum020a.f000005)) { this.f000030.Y = -1f; } else if (this.m000017(enum020a.f00006c)) { this.f000030.Y = 1f; } }

public static Vector2 SmoothStep(Vector2 value1, Vector2 value2, float amount) { float X = MathHelper.SmoothStep(value1.X, value2.X, amount); float Y = MathHelper.SmoothStep(value1.Y, value2.Y, amount); return new Vector2(X, Y); }

public static void Draw(ISpriteBatch sb, Vector2 source, Vector2 dest, Color color) { var dist = Vector2.Distance(source, dest); var angle = GetAngle(source, dest); // Get the length of the segments var segLen = dist / 6; if (segLen < 5.0f) segLen = 5.0f; if (segLen > 25.0f) segLen = 25.0f; // Primary line var tailLen = dist - (segLen / 2); var pDest = source + (new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)) * tailLen); RenderLine.Draw(sb, source, pDest, color); // Arrow segment 1 var ang1 = angle - MathHelper.PiOver4; var seg1 = dest - (new Vector2((float)Math.Cos(ang1), (float)Math.Sin(ang1)) * segLen); RenderLine.Draw(sb, dest, seg1, color); // Arrow segment 2 var ang2 = angle + MathHelper.PiOver4; var seg2 = dest - (new Vector2((float)Math.Cos(ang2), (float)Math.Sin(ang2)) * segLen); RenderLine.Draw(sb, dest, seg2, color); // Arrow segment 3 RenderLine.Draw(sb, seg1, seg2, color); }

public void Spawn(ESpaceObjects e, int count, Vector2 start, Vector2 end) { if (count < 1) return; Debug.Log(string.Format("Spawn {0} {1}", count, e.ToString())); var cahce = _cache[(int)e]; for (int i = 0; i < count; i++) { var so = cahce.Pop(); so.OnDestroy += _destroyDelegates[(int)e]; so.OnReward += OnReward; so.transform.position = new Vector2(Random.Range(start.x, end.x), Random.Range(start.y, end.y)); so.Spawn(); if (e == ESpaceObjects.AlienBig || e == ESpaceObjects.AlienShield || e == ESpaceObjects.AlienSmall) { Alien alien = so as Alien; alien.Spawner = this; } LiveObjects.Add(so); } }

public static Vector2 GetIntersectionDepth(Rectangle rectA, Rectangle rectB) { // Calculate half sizes. float halfWidthA = rectA.Width / 2.0f; float halfHeightA = rectA.Height / 2.0f; float halfWidthB = rectB.Width / 2.0f; float halfHeightB = rectB.Height / 2.0f; // Calculate centers. Vector2 centerA = new Vector2(rectA.Left + halfWidthA, rectA.Top + halfHeightA); Vector2 centerB = new Vector2(rectB.Left + halfWidthB, rectB.Top + halfHeightB); // Calculate current and minimum-non-intersecting distances between centers. float distanceX = centerA.X - centerB.X; float distanceY = centerA.Y - centerB.Y; float minDistanceX = halfWidthA + halfWidthB; float minDistanceY = halfHeightA + halfHeightB; // If we are not intersecting at all, return (0, 0). if (Math.Abs(distanceX) >= minDistanceX || Math.Abs(distanceY) >= minDistanceY) return Vector2.Zero; // Calculate and return intersection depths. float depthX = distanceX > 0 ? minDistanceX - distanceX : -minDistanceX - distanceX; float depthY = distanceY > 0 ? minDistanceY - distanceY : -minDistanceY - distanceY; return new Vector2(depthX, depthY); }

/// <summary> /// Initializes a new instance of the <see cref="UnityGwenRenderer"/> class. /// </summary> /// <param name="target">Unity render target.</param> public UnityGwenRenderer() { whiteTex = new Texture2D(1, 1); whiteTex.SetPixel(0, 0, UnityEngine.Color.white); whiteTex.Apply(); m_ViewScale = Vector2.one; }

public C_Maps() { //init stuff here m_mousePosition = Vector2.Zero; m_font1 = null; m_spriteBatch = null; }

private void Spawn_Tile(GameObject Select_Tile, Vector2 Position) { GameObject Tile = Instantiate (Select_Tile); Tile.transform.parent = transform; Tile.transform.position = transform.position; Tile.transform.position += (Vector3)Position; }

public void setBoundary(Vector2 bottomLeft, Vector2 topRight, float minZoom, float maxZoom) { this.bottomLeft = bottomLeft; this.topRight = topRight; this.minZoom = minZoom; this.maxZoom = maxZoom; }

public HardBall(IGame game, Vector2 position) : base(game, game.ContentProvider.GetBallSprite(0), position, 5) { Velocity = 2; var target = new Vector2(Game.Random.Next() - Game.Random.Next(), Game.Random.Next() - Game.Random.Next()); MoveTo(target); }

public static float AngleBetween(Vector2 v1, Vector2 v2) { v1.Normalize(); v2.Normalize(); float Angle = (float)Math.Acos(Vector2.Dot(v1, v2)); return Angle; }

public Paddle(ContentManager theContent, string theAssetName, Input theInput, PaddlePosition thePosition) : base(theContent, theAssetName) { SourceRectangle = new Rectangle(0, 0, 1, 1); Scale = new Vector2(10.0f, 100.0f); mColor = Color.SlateBlue; mPaddlePosition = thePosition; switch (thePosition) { case PaddlePosition.Left: { Boundary = new Rectangle(140, 185, 10, 833); break; } case PaddlePosition.Right: { Boundary = new Rectangle(1130, 185, 10, 833); break; } } Position = Center(Boundary); mInput = theInput; }

public static Vector2 PointOnCircle(Vector2 C, float R, float A) { //A = A - 90; float endX = (C.X + (R * ((float)Math.Cos((float)A)))); float endY = (C.Y + (R * ((float)Math.Sin((float)A)))); return new Vector2(endX, endY); }

/// <summary> /// Checks the mouse's position set in the in-game world plane. /// </summary> /// <param name="mousePosition">Mouse's position on screen</param> /// <param name="camera">Camera object</param> /// <param name="device">Graphics device used in rendering</param> /// <returns></returns> public static Vector3 getMouseWorldPosition(Vector2 mousePosition,CameraAndLights camera,GraphicsDevice device) { Vector3 nearsource = new Vector3(mousePosition,0f); Vector3 farsource = new Vector3(mousePosition,CameraAndLights.nearClip); Vector3 nearPoint = device.Viewport.Unproject(nearsource, camera.projectionMatrix, camera.viewMatrix, Matrix.Identity); Vector3 farPoint = device.Viewport.Unproject(farsource, camera.projectionMatrix, camera.viewMatrix, Matrix.Identity); // Create a ray from the near clip plane to the far clip plane. Vector3 direction = farPoint - nearPoint; direction.Normalize(); Ray pickRay = new Ray(nearPoint,direction); Plane floor = new Plane(new Vector3(0f,1f,0f),0f); float denominator = Vector3.Dot(floor.Normal,pickRay.Direction); float numerator = Vector3.Dot(floor.Normal,pickRay.Position) + floor.D; float dist = -(numerator / denominator); Vector3 mouseWorldPos = nearPoint + direction * dist; return mouseWorldPos * new Vector3(1f,0f,1f); }

public Fruit(World world, Vector2 position, FruitType fruitType) : base(world, position) { this._fruitType = fruitType; switch (fruitType) { case FruitType.Apple: this.Energy = 6; break; case FruitType.Watermelon: this.Energy = 8; break; case FruitType.Pineapple: this.Energy = 10; break; case FruitType.Strawberry: this.Energy = 12; break; case FruitType.Cherries: this.Energy = 14; break; case FruitType.Acorn: this.Energy = 16; break; default: throw new InvalidOperationException(); } string textureName = string.Format("Sprites/Fruit/{0:G}", _fruitType); var a = Animation.StaticAnimation(World, textureName); this.Ap.PlayAnimation(a); }

public struct0207(ref bool[] p0, ref bool[] p1) { this.f00000a = new bool[p0.Length]; this.f000056 = new bool[p1.Length]; this.f000030 = Vector2.Zero; this.m0002cf(ref p0, ref p1); }

// Shifts the camera position by a value public void Move(Vector2 amount) { position += amount; ClampPosition(); UpdateCamArea(); center = new Vector2(camArea.X + camArea.Width / 2.0f, camArea.Y + camArea.Height / 2.0f); }

public void Update() { if (top == 0 && bottom == 0) { if (up) { top = location.Y; bottom = top + columnHeight; } else { bottom = location.Y; top = bottom - columnHeight; } } if (!up && location.Y < bottom) { physics.Velocity = new Vector2(0, LemmingObjectConstants.DOWNELEVATORVELOCITY); } else if (up && location.Y > top) { physics.Velocity = new Vector2(0, LemmingObjectConstants.UPELEVATORVELOCITY); } else { physics.Velocity = Vector2.Zero; } elevatorSprite.Update(); location = physics.Update(location); }

internal static void BeginScrollView(Rect position, Vector2 scrollPosition, Rect viewRect, GUIStyle horizontalScrollbar, GUIStyle verticalScrollbar) { s_ScrollPos = scrollPosition; s_ViewRect = viewRect; s_Position = position; GUIClip.Push(position, new Vector2(Mathf.Round((-scrollPosition.x - viewRect.x) - ((viewRect.width - position.width) * 0.5f)), Mathf.Round((-scrollPosition.y - viewRect.y) - ((viewRect.height - position.height) * 0.5f))), Vector2.zero, false); }

void AddUVs() { Vector2 _00 = new Vector2( 0f, 0f ); Vector2 _10 = new Vector2( 1f, 0f ); Vector2 _01 = new Vector2( 0f, 1f ); Vector2 _11 = new Vector2( 1f, 1f ); uvs = new Vector2[] { // Bottom _11, _01, _00, _10, // Left _11, _01, _00, _10, // Front _11, _01, _00, _10, // Back _11, _01, _00, _10, // Right _11, _01, _00, _10, // Top _11, _01, _00, _10, }; }

public void Init(ContentManager content, Vector2 position, string normalTextureName, string hoverTextureName) { m_Normal = content.Load<Texture2D>(normalTextureName); m_Hover = content.Load<Texture2D>(hoverTextureName); m_ButtonRec = new Rectangle((int)position.X, (int)position.Y, m_Normal.Width, m_Normal.Height); }

void Update() { if (!isActive) return; Vector2 position = transform.position; Vector2 nodePos = path[currentNode]; Vector2 positionDelta = nodePos - position; float dot_product = move_dir.x * positionDelta.x + move_dir.y * positionDelta.y; if (dot_product <= 0) { if (++currentNode == path.Length) { //OnEndReached.Invoke(gameObject); //GetComponent<Animator>().SetBool("Explode", true); Die(); isActive = false; } else { nodePos = path[currentNode]; move_dir = (nodePos - position).normalized; transform.position = position + move_dir * speed * Time.deltaTime; //_animator.SetFloat("SpeedX", move_dir.x); //_animator.SetFloat("SpeedY", move_dir.y); //_animator.SetBool("horizontal_move", Mathf.Abs(move_dir.x) > 0.1f); } } else { transform.position = position + move_dir * speed * Time.deltaTime; } }

public Plane(int xRes, int yRes, float xScale, float yScale) { Vertices = new Vector3[xRes * yRes]; Normals = new Vector3[xRes * yRes]; Indices = new uint[6 * xRes * yRes]; Texcoords = new Vector2[xRes * yRes]; int i = 0; for (int y = -yRes / 2; y < yRes / 2; y++) { for (int x = -xRes / 2; x < xRes / 2; x++) { Vertices[i].X = xScale * x / xRes; Vertices[i].Y = yScale * y / yRes; Vertices[i].Z = 0; Normals[i].X = Normals[i].Y = 0; Normals[i].Z = 1; i++; } } i = 0; for (int y = 0; y < yRes - 1; y++) { for (int x = 0; x < xRes - 1; x++) { Indices[i++] = (uint)((y + 0) * xRes + x); Indices[i++] = (uint)((y + 1) * xRes + x); Indices[i++] = (uint)((y + 0) * xRes + x + 1); Indices[i++] = (uint)((y + 0) * xRes + x + 1); Indices[i++] = (uint)((y + 1) * xRes + x); Indices[i++] = (uint)((y + 1) * xRes + x + 1); } } }

public Mob(ushort pID, Vector2 Pos) { ID = pID; Position = Pos; Init(); SetBoundriesFromPointAndRange(Pos, 700); }

public static void SetSize(this RectTransform trans, Vector2 newSize) { Vector2 oldSize = trans.rect.size; Vector2 deltaSize = newSize - oldSize; trans.offsetMin = trans.offsetMin - new Vector2(deltaSize.x * trans.pivot.x, deltaSize.y * trans.pivot.y); trans.offsetMax = trans.offsetMax + new Vector2(deltaSize.x * (1f - trans.pivot.x), deltaSize.y * (1f - trans.pivot.y)); }