public ThirdPersonCamera(Rectangle clientBounds, IMovable movableToFollow) : base(clientBounds, movableToFollow.Transform) { m_movableToFollow = movableToFollow; // default the offset to slightly up and behind m_offset = new Vector3 (0.0f, 4.0f, -20.0f); }
public void setUp( Vector2 position, int width, int height, ILogic brain = null, BodyBase body = null, IRenderable renderer = null, IMovable mover = null ) { // Start setUp. if (!_setUp) { // Start not setup if. _position = position; _width = width; _height = height; _setUp = true; if (brain != null) _brain = brain; if (body != null) _body = body; if (renderer != null) _renderer = renderer; if ( mover != null) _mover = mover; } // End not setup if. }
public ThirdPersonCamera(Rectangle clientBounds, IMovable movableToFollow, Vector3 offset) : base(clientBounds, movableToFollow.Transform) { m_movableToFollow = movableToFollow; m_offset = offset; }
/// <summary> /// Creates a Human /// </summary> /// <param name="name">The name to display for this character</param> /// <param name="x">The starting x position</param> /// <param name="y">The starting y position</param> public Human(string name, int x, int y) { this.name = name; health = 100; Killable = new BasicKillable(100); Movable = new BasicMovable(50, 50); }
/// <summary> /// Checks if an object is visible and adds it to the render queue /// </summary> /// <param name="camera">Current camera</param> /// <param name="movable">IMovable instance</param> internal void ProcessesVisibleObject(Camera camera, IMovable movable) { movable.FrustumCulling(camera); if (movable.IsRendered) movable.UpdateRenderQueue(this); }
public void EndMove(IMovable movable, bool fireevent, bool forceend) { if(this.MovableCache.ContainsKey(movable) && this.MovableCache[movable] == MovementType.TileBased && movable.IsMoving) { ScreenPoint destination = this.GetNextScreenPointTile(movable); if(this.context.CollisionProvider.CheckCollision(movable, destination)) { movable.IgnoreMoveInput = true; movable.MovingDestination = destination; this.MovableCache[movable] = MovementType.Destination; return; } } if((movable.Location.Y % 32) != 0) movable.IsMoving = false; movable.IsMoving = false; movable.IgnoreMoveInput = false; this.RemoveFromCache(movable); if(fireevent) movable.OnStoppedMoving(this, EventArgs.Empty); }
public static void MoveObject(IMovable movableObject, Direction direction) { IMovable moveObject = movableObject; switch (direction) { case Direction.North: moveObject.Position.Y -= moveObject.MoveSpeed; break; case Direction.NorthEast: moveObject.Position.X += moveObject.MoveSpeed/2; moveObject.Position.Y += moveObject.MoveSpeed/2; break; case Direction.East: moveObject.Position.X += moveObject.MoveSpeed; break; case Direction.SouthEast: moveObject.Position.X += moveObject.MoveSpeed/2; moveObject.Position.Y += moveObject.MoveSpeed/2; break; case Direction.South: moveObject.Position.Y += moveObject.MoveSpeed; break; case Direction.SouthWest: moveObject.Position.X -= moveObject.MoveSpeed/2; moveObject.Position.Y += moveObject.MoveSpeed/2; break; case Direction.West: moveObject.Position.X -= moveObject.MoveSpeed; break; case Direction.NorthWest: moveObject.Position.X -= moveObject.MoveSpeed/2; moveObject.Position.Y += moveObject.MoveSpeed/2; break; } }
/************************************************************/ public ThirdPersonCamera(Rectangle clientBounds) : base(clientBounds) { m_movableToFollow = null; // default the offset to slightly up and behind m_offset = new Vector3 (0.0f, 4.0f, -20.0f); }
public void OnTeleportation(Teleport teleport, IMovable obj) { var targetTeleport = teleports.Find(x => x != teleport); if (targetTeleport == null) return; obj.Teleportation(BoardManager.Instance.GetCurrentCellPosition(targetTeleport.transform.position), targetTeleport.outDirection); }
public void ExecuteMove(IMovable element) { Point dest = element.Location + element.Displacement; if (dest.X >= Univers.Width) { dest.X = 0; } else if (dest.X < 0) { dest.X = Univers.Width - 1; } if (dest.Y >= Univers.Height) { dest.Y = 0; } else if (dest.Y < 0) { dest.Y = Univers.Height - 1; } try { element.Location = dest; } catch (ElementCollisionException) { var evt = new ElementsCollisionEvent(element, Univers[dest], dest); Univers.ThrowCollisionEvent(evt); if (OnCollision != null) { OnCollision(evt); } } }
public void Setup() { entity = new Block(); move = Vector2.Zero; _blocks = new List<Block>(); _blocks.Add(entity as Block); allowNegativeY = false; }
public void OnCenterCellReached(IMovable obj, Vector3 cellPos) { var teleportCellPosition = BoardManager.Instance.GetCurrentCellPosition(transform.position); if (teleportCellPosition.x == cellPos.x && teleportCellPosition.z == cellPos.z) { if(Teleportation != null) { Teleportation(this, obj); } } }
public static void WriteThis(IMovable target) { string typeOfTarget = target.GetType().Name; string[] lines = File.ReadAllLines(typeOfTarget+".txt"); foreach (string line in lines) { Console.WriteLine(line); } }
public void EndMoveLocation(IMovable movable, MapPoint destination, string animationname) { lock (this.movablecache) { if(!this.movablecache.ContainsKey (movable)) this.movablecache.Add (movable, new Queue<MovementItem> ()); //return this.movablecache[movable].Enqueue(new MovementItem(destination.ToScreenPoint(), MovementType.Destination, Directions.Any, animationname)); } }
public void BeginMoveDestination(IMovable movable, ScreenPoint destination, bool fireevent) { if(movable.IsMoving || this.MovableCache.ContainsKey (movable)) this.EndMove (movable, fireevent, false); movable.IgnoreMoveInput = true; movable.IsMoving = true; this.AddToCache(movable, MovementType.Destination); this.InternalMove(movable, destination); movable.OnStartedMoving(this, EventArgs.Empty); }
/// <summary> /// Attaches a movable object to this scene node /// </summary> /// <param name="movObj">IMovable instance</param> public void AttachObject(IMovable movObj) { if (_movablesByName.ContainsKey(movObj.Name)) { _movablesByName.Remove(movObj.Name); _movablesList.Remove(movObj); } _movablesByName.Add(movObj.Name, movObj); _movablesList.Add(movObj); movObj.AttachParent(this); RequireUpdate(); }
public void Move(IMovable movable, GameTime gameTime) { var lSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds; if (this.ScreenSize == Vector2.Zero) { movable.Location = movable.Location + (this.Direction * lSeconds * movable.Speed); } else { movable.Location = Vector2.Clamp( movable.Location + (this.Direction * lSeconds * movable.Speed), Vector2.Zero, this.ScreenSize + movable.Size); } }
public bool CheckCollision(IMovable source, MapPoint Destination) { if(source.Density < 1) return true; World currentworld = this.worldmanager.GetWorld(source.WorldName); foreach(MapHeader header in currentworld.Maps.Values) { Rectangle rect = (header.MapLocation).ToRect(header.Map.MapSize.ToPoint()); if(rect.Contains(Destination.ToPoint())) { return (header.Map.GetLayerValue(Destination - header.MapLocation, MapLayers.CollisionLayer) == -1); } } return true; }
/// <summary> /// static method to find a path for a movable object from cell to cell using a tile map /// </summary> /// <param name="movable"></param> /// <param name="fromCell"></param> /// <param name="toCell"></param> /// <param name="mapRef"></param> public static void SetMovableToMovePath(IMovable movable, Vector2 fromCell, Vector2 toCell, TileMap mapRef) { var path = PathFinder.FindPath(fromCell, toCell, mapRef); movable.MovingPath = path; if (path == null || path.Count <= 1) return; movable.CurrentPathSegment = 1; // initially move to first segment.. Vector2 cellCenter = mapRef.MapCellAt(movable.MovingPath[movable.CurrentPathSegment]).CenterPosition; movable.Distination = cellCenter; Vector2 difference = movable.Distination - movable.Position; if (difference != Vector2.Zero) { movable.MoveDirection = Vector2.Normalize(difference); } }
private static List<Step> CalculatePath(IMovable movable, Zone destination) { List<Step> steps = new List<Step>(); if (movable.Location == destination || !movable.CanCross(destination)) return steps; //Calculate path using A* algorithm SortedSet<PathfindingNode> openList = new SortedSet<PathfindingNode>( Comparer<PathfindingNode>.Create((a, b) => a.CompareTo(b))); HashSet<Zone> closedList = new HashSet<Zone>(); openList.Add(new PathfindingNode(movable.Location, destination.DistanceWith(movable.Location))); bool pathFound = destination == movable.Location; while (!pathFound) { if (openList.Count == 0) break; PathfindingNode currentNode = openList.First(); foreach (Zone neighbourg in currentNode.Zone.Adjacencies.Select(a => a.Neighbourg).Where(s => movable.CanCross(s))) { if (closedList.Contains(neighbourg) || openList.Any(n => n.Zone == neighbourg)) continue; openList.Add(new PathfindingNode(neighbourg, destination.DistanceWith(neighbourg), currentNode)); if (neighbourg == destination) // Path found ! { pathFound = true; steps.Add(new Step(currentNode.Zone, destination)); while (currentNode.Parent != null) { steps.Add(new Step(currentNode.Parent.Zone, currentNode.Zone)); currentNode = currentNode.Parent; } steps.Reverse(); break; } } openList.Remove(currentNode); closedList.Add(currentNode.Zone); } if (steps.Count == 0) return steps; return steps; }
public void BeginMove(IMovable movable, Directions direction) { if(movable.IsMoving) { if(movable.Direction == direction) return; this.EndMove (movable, true, false); } if (this.MovableCache.ContainsKey (movable)) return; movable.IsMoving = true; movable.Direction = direction; this.InternalMove(movable, this.GetDestinationFromDirection(movable, movable.Direction)); this.AddToCache(movable, MovementType.TileBased); movable.OnStartedMoving(this, EventArgs.Empty); }
public void AddMovable(IMovable movable) { lock (m_movableList) { m_movableList.Add(movable); lock (m_monitorList) { var movableType = movable.GetType(); foreach (var type in m_monitorList) { if (type.IsAssignableFrom(movableType) == true) { var collectedMovableList = m_collectedMovableList[type]; collectedMovableList.Add(movable); } } } } OnMovableAdded(movable); }
public Car(int passengers, string model, IMovable mov) { _passengers = passengers; _model = model; Movable = mov; }
public void AddToHerd(IMovable m) { this.objects.Add(m); }
public void Reflect(IMovable movable, Vector3 normal) { var reflectedVelocity = Vector3.Reflect(movable.Velocity, normal); movable.Velocity = reflectedVelocity; }
public Car(IMovable movable) { Movable = movable; }
public void MobMapChange(IMovable mob) { OnMobMapChange?.Invoke(mob); }
public string Main(string model, int pass, IMovable movable) { Car car = new Car(model, pass, movable); return(car.Move()); }
void ProcessLeftMouseClick() { if (Input.GetMouseButtonDown(0)) { startClickedPos = Input.mousePosition; //무엇을 클릭했는지 체크 //UI기준좌표계에서 충돌체크. Collider2D temp0 = Physics2D.OverlapPoint(Input.mousePosition); if (temp0 != null) { selectedObject = temp0.gameObject; localOffset = selectedObject.transform.position - Input.mousePosition; isUI = true; } //노드시스템좌표계에서 충돌체크. else { touchPos = nodeCamera.ScreenToWorldPoint(Input.mousePosition); //Switch노드의 AddCase, DeleteCase처리 Collider2D[] temps = Physics2D.OverlapPointAll(touchPos); foreach (Collider2D coll in temps) { if (coll.gameObject.name == "AddStringCase") { coll.gameObject.transform.parent.GetComponent <SwitchOnString>().AddCase(); } if (coll.gameObject.name == "DeleteStringCase") { coll.gameObject.transform.parent.GetComponent <SwitchOnString>().DeleteCase(); } } Collider2D temp = null; Collider2D[] overlapColls = Physics2D.OverlapPointAll(touchPos); //ArrowInput,ArrowOutput 우선처리, 없다면 가장 마지막의 것을 채택 foreach (Collider2D coll in overlapColls) { if (coll.gameObject.name.StartsWith("Input") || coll.gameObject.name.StartsWith("Output") || coll.gameObject.name.EndsWith("(Folder)")) { temp = coll; break; } temp = coll; } if (temp != null && !temp.CompareTag("LockField")) { selectedObject = temp.gameObject; //선택한 오브젝트가 우클릭드래그로 선택한 그룹에 속해있는지 확인 isGroup = false; foreach (GameObject go in selectedObjects) { if (go == selectedObject) { isGroup = true; } } //속해있다면 그 그룹의 localOffset을 구함 if (isGroup) { localOffsets = new Vector3[selectedObjects.Length]; for (int i = 0; i < localOffsets.Length; ++i) { localOffsets[i] = (Vector2)selectedObjects[i].transform.position - touchPos; } } else { localOffset = (Vector2)selectedObject.transform.position - touchPos; } } isUI = false; } Lclicked = true; //클릭시 바로 일어나야 하는 부분 처리. if (selectedObject != null) { Folder folder = selectedObject.GetComponent <Folder>(); TouchEvent touchEvent = selectedObject.GetComponent <TouchEvent>(); if (isGetTool) { if (folder != null) { folder.UnFold(); myAudio.Play(); //myAudio.PlayDelayed(0); isGetTool = false; } } else { if (touchEvent != null) { touchEvent.Active(); } if (folder != null) { folder.Active(); } } } } if (Input.GetMouseButtonUp(0)) { Lclicked = false; if (isGroup) { foreach (GameObject _selectedObject in selectedObjects) { IMovable movable = _selectedObject.GetComponent <IMovable>(); if (movable != null) { if (!isUI) { movable.MoveEnd((nodeCamera.ScreenToWorldPoint(Input.mousePosition) + localOffset), true); } else { movable.MoveEnd(Input.mousePosition + localOffset, true); } } } } else if (selectedObject != null) { IMovable movable = selectedObject.GetComponent <IMovable>(); if (movable != null) { if (!isUI) { movable.MoveEnd((nodeCamera.ScreenToWorldPoint(Input.mousePosition) + localOffset)); } else { movable.MoveEnd(Input.mousePosition + localOffset); } } } selectedObject = null; } //클릭되고있는 동안 else if (Lclicked) { //선택된 오브젝트가 있다면 if (selectedObject != null) { //여러개 선택되었는가 if (isGroup) { for (int i = 0; i < selectedObjects.Length; ++i) { IMovable movable = selectedObjects[i].GetComponent <IMovable>(); if (movable != null) { if (!isUI) { movable.Move((nodeCamera.ScreenToWorldPoint(Input.mousePosition) + localOffsets[i]), true); } else { movable.Move(Input.mousePosition + localOffsets[i], true); } } } } else { IMovable movable = selectedObject.GetComponent <IMovable>(); if (movable != null) { if (!isUI) { movable.Move((nodeCamera.ScreenToWorldPoint(Input.mousePosition) + localOffset)); } else { movable.Move(Input.mousePosition + localOffset); } } } } else { ResetMultySelectSystems(); //화면이동 if (Input.GetMouseButton(0)) { Vector2 delta = (Vector2)Input.mousePosition - startClickedPos; nodeCamera.transform.position -= new Vector3(delta.x, delta.y) * cameraMoveSpeed * Time.deltaTime * nodeCamera.orthographicSize; } } } if (Application.isFocused) { startClickedPos = Input.mousePosition; } }
public void RemoveFromCache(IMovable movable) { lock(this.movablecache) { this.movablecache.Remove(movable); } }
public ElementsCollisionEvent(IMovable from, IMovable to, Point at) { FromElement = from; ToElement = to; AtLocation = at; }
public abstract void Move(IMovable user, ref Vector2 velocity, ref CollisionStatus status);
private bool MoveTileBased(IMovable movable, List<IMovable> collided) { bool movedok = true; float x = movable.Location.X; float y = movable.Location.Y; #region Destination calculation if(movable.Direction == Directions.North) { y -= movable.Speed; } else if(movable.Direction == Directions.South) { y += movable.Speed; } else if(movable.Direction == Directions.East) { x += movable.Speed; } else if(movable.Direction == Directions.West) { x -= movable.Speed; } #endregion movable.Location = new ScreenPoint((int)x, (int)y); return movedok; }
static void Action(IMovable movable) { movable.Move(); }
protected override void MoveInternal(IMovable movable) { movable.Wait(); }
public abstract MotorConfig CreateConfig(IMovable user);
// Use this for initialization void Start() { barrel = transform.Find("Barrel"); owner = transform.root.GetComponent <IMovable>(); lastShotTime = Time.time - cooldown; }
public void SetPosition(IMovable entity, Vector3 pos) { entity.ActualPosition = pos; entity.MoveTo(CutPosition(pos, step)); }
void ProcessRightMouseClick() { //우클릭 시작 if (Input.GetMouseButtonDown(1)) { isGetTool = false; ResetMultySelectSystems(); boxLeftTopPos = nodeCamera.ScreenToWorldPoint(Input.mousePosition); Rclicked = true; //엣지 끊기 touchPos = nodeCamera.ScreenToWorldPoint(Input.mousePosition); Collider2D[] temps = Physics2D.OverlapPointAll(touchPos); foreach (Collider2D temp in temps) { NewEdge edgeComponent = temp.GetComponent <NewEdge>(); //엣지이면서 타겟이 마우스가 아닐때(아직 마우스로 연결중이면 무시) if (edgeComponent != null && !edgeComponent.endTarget.Equals(transform)) { EdgeManager.instance.removeEdge(edgeComponent, edgeComponent.endTarget); } } } if (Input.GetMouseButton(1)) { //크기조절 float xSize, ySize; Vector3 v3 = nodeCamera.ScreenToWorldPoint(Input.mousePosition); xSize = v3.x - boxLeftTopPos.x; ySize = v3.y - boxLeftTopPos.y; SelectBoxTr.localScale = new Vector3(xSize * 0.5f, ySize * 0.5f, 1); Vector3 boxOffset = boxLeftTopPos - transform.position; SelectBoxTr.localPosition = new Vector3(boxOffset.x, boxOffset.y, 0); //LockField가 있으면 빨간색으로 표시해줌 Collider2D[] colls = Physics2D.OverlapAreaAll(SelectBoxTr.position, SelectBoxTr.position + SelectBoxTr.lossyScale * 2); int i; for (i = 0; i < colls.Length; ++i) { if (colls[i].CompareTag("LockField")) { SelectBoxRenderer.color = new Color(1, 0, 0, 0.5f); break; } } if (i == colls.Length) { SelectBoxRenderer.color = new Color(1, 1, 1, 0.5f); } } if (Input.GetMouseButtonUp(1)) { Collider2D[] colls = Physics2D.OverlapAreaAll(SelectBoxTr.position, SelectBoxTr.position + SelectBoxTr.lossyScale * 2); //LockField가 껴있는지 체크 int i; for (i = 0; i < colls.Length; ++i) { if (colls[i].CompareTag("LockField")) { SelectBoxRenderer.color = new Color(1, 0, 0, 0.5f); break; } } if (i == colls.Length) { //콜라이더들 중 Movable인터페이스를 구현한 게임오브젝트 숫자를 구함 int movableCount = 0; foreach (Collider2D coll in colls) { IMovable temp = coll.GetComponent <IMovable>(); if (temp != null) { movableCount++; } } selectedObjects = new GameObject[movableCount]; moveIcons = new GameObject[movableCount]; int objectIdx = 0; foreach (Collider2D coll in colls) { IMovable temp = coll.GetComponent <IMovable>(); if (temp != null) { selectedObjects[objectIdx] = coll.gameObject; moveIcons[objectIdx] = Instantiate(movableIconObj, coll.transform.position - new Vector3(0, 0, 1), Quaternion.identity); moveIcons[objectIdx].transform.SetParent(coll.transform); objectIdx++; } } SelectBoxRenderer.color = new Color(1, 0, 0, 0.5f); } SelectBoxTr.localScale = new Vector3(0, 0, 1); Rclicked = false; } }
public Transport(IMovable mov) { Movable = mov; }
public Car(string model, int pass, IMovable movable) { _model = model; _pass = pass; Movable = movable; }
public Person(IMovable _transport) { transport = _transport; }
public abstract bool RequiresConfig(IMovable user);
protected string _model; // модель автомобиля public Car(int num, string model, IMovable mov) { _passengers = num; _model = model; Movable = mov; }
public static void MoveTo(this IMovable movable, double x, double y) { movable.MoveTo(new Point(x, y)); }
// Updates the entire world on each loop within the main loop in Program.cs public void Update() { // Reset World requested? if (SplashKit.KeyTyped(KeyCode.RKey)) { SetupWorld(); } // Undo requested? if (SplashKit.KeyTyped(KeyCode.ZKey)) { MoveLedger.UndoLastMoves(); } // When we modify each sprite, we may remove them from the list (i.e., // by calling Remove(Sprite sprite). If we do that, we modify the foreach // list during enumerating through the list. Therefore we must use a // C-style for loop. for (int i = 0; i < this.sprites.Count; i++) { Sprite spr = this.sprites[i]; // If this sprite is collidable and it collides with the player... if (spr is ICollidable) { if (spr.IsAt(this.player)) { // Downcast sprite 's' into collidable object and this.player into // a collide object ICollidable collidableSpr = ((ICollidable)spr); collidableSpr.CollidesWith(this.player); } } // Try move the player first if (spr.Equals(this.player)) { // Key typed events if (SplashKit.KeyTyped(KeyCode.UpKey)) { this.player.Direction = Cardinality.North; this.player.Move(); } if (SplashKit.KeyTyped(KeyCode.DownKey)) { this.player.Direction = Cardinality.South; this.player.Move(); } if (SplashKit.KeyTyped(KeyCode.LeftKey)) { this.player.Direction = Cardinality.West; this.player.Move(); } if (SplashKit.KeyTyped(KeyCode.RightKey)) { this.player.Direction = Cardinality.East; this.player.Move(); } } // Check if this sprite is another Movable kind of sprite. else if (spr is IMovable) { // Downcast sprite 's' into movable object IMovable movableSpr = ((IMovable)spr); if (movableSpr.ShouldMove) { movableSpr.Move(); } } // Check if all coins have been `eaten' up. If so, create the target // somewhere randomly on our screen. if (this.AllCoinsEaten() && this.target == null) { // Until the target has been set... while (this.target == null) { int rndX = SplashKit.Rnd(width); int rndY = SplashKit.Rnd(height); Position rndPos = this.GetPositionAt(rndX, rndY); // Find a random position that has no sprites and place // the target there :) if (!rndPos.HasSprite()) { this.target = new Target(rndPos); this.sprites.Add(this.target); } } } } }
static void StartEverything(IMovable something) { something.Start(); }
public BackwardCommand(IMovable movable) { Movable = movable; }
protected string model; // модель автомобиля public Car(int num, string model, IMovable mov) { this.passengers = num; this.model = model; Movable = mov; }
public override void Move(Field field, IMovable movable) { throw new NotImplementedException(); }
public void BeginMove(IMovable movable, Directions direction, string animationname) { this.AddToCache(movable, new MovementItem(ScreenPoint.Zero, MovementType.TileBased, direction, animationname)); movable.OnStartedMoving(this, EventArgs.Empty); }
public Car(int pass, string mod, IMovable movable) { passengers = pass; model = mod; Movable = movable; }
public int GetMoveCount(IMovable movable) { if(!this.movablecache.ContainsKey (movable)) return 0; else return this.movablecache[movable].Count; }
public CUnitPositionChangedEventArgs(IMovable unit, ICell oldCell, ICell newCell) { Unit = unit; OldCell = oldCell; NewCell = newCell; }
public ElementMovedEvent(IMovable element, Point locationOld, Point locationNew) { Element = element; OldLocation = locationOld; NewLocation = locationNew; }
public void AddToHerd(IMovable movable) { this.list.Add(movable); }
/// <summary> /// Initializes the Unit Facade. /// </summary> /// <param name="unitObject">The unit game object.</param> public virtual void Initialize(GameObject unitObject) { _props = unitObject.As<IUnitProperties>(false, true); _movable = unitObject.As<IMovable>(false, false); _moving = unitObject.As<IMovingObject>(false, true); _speeder = unitObject.As<IDefineSpeed>(false, true); _pathFinderOptions = unitObject.As<IPathFinderOptions>(false, false) ?? new PathFinderOptions(); _pathNavOptions = unitObject.As<IPathNavigationOptions>(false, false) ?? new PathNavigationOptions(); this.isMovable = _movable != null; if (!this.isMovable) { _movable = new MovableDummy(unitObject.name); } this.gameObject = unitObject; this.transform = unitObject.transform; this.collider = unitObject.GetComponent<Collider>(); this.isAlive = true; this.hasArrivedAtDestination = true; }
public static bool CheckTouch(IMovable mob, int x, int y) { return((mob.X == x && mob.Y == y) || (mob.MX == x && mob.MY == y)); }
private static Point GetRelativeLocation(IMovable child, Rect parentBounds) { var localLeft = child.Left - parentBounds.Left; var localTop = child.Top - parentBounds.Top; var leftProportion = localLeft / parentBounds.Width; var topProportion = localTop / parentBounds.Height; return new Point(leftProportion, topProportion); }
public override void Initialize(GameObject go) { base.Initialize(go); _movable = Self.GetComponent <IMovable>(); _magicable = Self.GetComponent <IMagicable>(); }