public void SpawnTargetMarker(SpaceObject ship) { string spaceObjectFaction = ship.GetFaction(); GameObject markerPrefab = Resources.Load <GameObject>("Prefab/HUD/TargetMarker"); GameObject markerInstance = Instantiate(markerPrefab, ship.GetBody().transform.position, Quaternion.identity) as GameObject; markerInstance.GetComponent <Marker>().SetSpaceObject(ship); markerInstance.transform.SetParent(GameObject.Find("HUD/Markers/TargetMarkers").transform); }
IEnumerator Move(List <Tile> Path) { float currentMoveSpeed = 0; float currentRotationSpeed = 0; int waypointNumber = 0; Vector3 Destination = Path [Path.Count - 1].transform.position; Vector3 currentWaypoint = Path [waypointNumber].transform.position; while (Vector3.Distance(Destination, transform.position) > 0) { Vector3 dir = currentWaypoint - m_MySpaceObject.GetBody().transform.position; currentMoveSpeed = Mathf.Lerp(currentMoveSpeed, m_MySpaceObject.GetMoveSpeed(), Time.fixedDeltaTime); m_MySpaceObject.GetBody().transform.rotation = Quaternion.Lerp(m_MySpaceObject.GetBody().transform.rotation, Quaternion.LookRotation(currentWaypoint - transform.position), m_MySpaceObject.GetRotationSpeed() * Time.fixedDeltaTime); transform.position = Vector3.MoveTowards(transform.position, currentWaypoint, m_MySpaceObject.GetMoveSpeed() * Time.deltaTime); if (transform.position == currentWaypoint && currentWaypoint != Destination) { waypointNumber++; currentWaypoint = Path [waypointNumber].transform.position; } yield return(new WaitForEndOfFrame()); } yield return(StartCoroutine(Align())); }
public virtual HashSet <Tile> ComputeAttackRange(SpaceObject objectSelected) { List <Tile> startTiles = objectSelected.GetTiles(); return(Utilities.ComputeTileInDistance(startTiles, objectSelected.GetBody().transform.position, m_RangeMin, m_RangeMax)); }
public void ValidAttack() { StartCoroutine(AnimationManager.Instance.LaunchAnimations(ActionManager.Instance.GetWeaponSelected(), m_SpaceObjectTargeted.GetBody())); }
public void SetPosition() { if (m_MyShipRenderer != null) { if (m_MyShipRenderer.isVisible == true) { m_MarkerImage.enabled = true; } else { m_MarkerImage.enabled = false; } if (m_MarkerImage.enabled == true) { MyRectTransform.position = RectTransformUtility.WorldToScreenPoint(Camera.main, m_SpaceObject.GetBody().transform.position); } } }