void Awake() { follow = GetComponent <FollowDirection>(); anim = GetComponent <Animator>(); health = GetComponent <TORv0Health>(); audioSource = GetComponent <AudioSource>(); }
private void Awake() { lr = GetComponent <LineRenderer>(); follow = GetComponent <FollowDirection>(); anim = GetComponent <Animator>(); audioSource = GetComponent <AudioSource>(); }
private void Awake() { followDirection = GetComponent <FollowDirection>(); shooting = transform.GetChild(0).GetComponent <Shooting>(); anim = GetComponent <Animator>(); rb = GetComponent <Rigidbody2D>(); }
private void Awake() { follow = GetComponent <FollowDirection>(); anim = GetComponent <Animator>(); shooting = transform.GetChild(0).GetComponent <VoluntarioShooting>(); meleeTimer = meleeCooldown; }
private void Awake() { lr = GetComponentInChildren <LineRenderer>(); followDirection = GetComponent <FollowDirection>(); shooting = transform.GetChild(0).GetComponent <Shooting>(); weapon = transform.GetChild(0).gameObject; rb = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); }
public static PathFollower FollowPath(this Transform transform, string pathName, float moveSpeed, FollowType followType = FollowType.Once, FollowDirection followDirection = FollowDirection.Forward) { PathData pathData = WaypointManager.instance.GetPathData(pathName); var pathFollower = PathFollower.Create(transform); if (pathData != null) pathFollower.Follow(pathData, moveSpeed, followType, followDirection); else Debug.LogError(string.Format("[WaypointManager] couldn't find path('{0}')", pathName)); return pathFollower; }
public void Follow(PathData pathData, float moveSpeed, FollowType followType, FollowDirection followDirection) { this.pathData = pathData; this.moveSpeed = moveSpeed; this.followType = followType; this.followDirection = followDirection; StopFollowing(); var closestLineIndex = GetClosestLineIndex(_transform.position); _currentIndex = GetClosestPointIndex(closestLineIndex * 20, _transform.position); StartCoroutine("FollowPath"); }
public void FollowToPoint(PathData pathData, float moveSpeed, Vector2 targetPos) { this.pathData = pathData; this.moveSpeed = moveSpeed; this.followType = FollowType.Once; StopFollowing(); var closestLineIndex = GetClosestLineIndex(_transform.position); _currentIndex = GetClosestPointIndex(closestLineIndex * 20, _transform.position); closestLineIndex = GetClosestLineIndex(targetPos); var targetIndex = GetClosestPointIndex(closestLineIndex * 20, targetPos); this.followDirection = (_currentIndex < targetIndex) ? FollowDirection.Forward : FollowDirection.Backward; StartCoroutine("FollowPathToPoint", targetIndex); }
public static PathFollower FollowPath(this Transform transform, string pathName, float moveSpeed, FollowType followType = FollowType.Once, FollowDirection followDirection = FollowDirection.Forward) { PathData pathData = WaypointManager.instance.GetPathData(pathName); var pathFollower = PathFollower.Create(transform); if (pathData != null) { pathFollower.Follow(pathData, moveSpeed, followType, followDirection); } else { Debug.LogError(string.Format("[WaypointManager] couldn't find path('{0}')", pathName)); } return(pathFollower); }
void Start() { follow = GetComponent <FollowDirection>(); }
public IEnumerator <Transform> GetPathEnumerator(FollowDirection direction) { return(direction == FollowDirection.Forward ? GetPathEnumeratorForward() : GetPathEnumeratorBackward()); }
int GetNextIndex(int currentIndex) { int nextIndex = -1; switch (followType) { case FollowType.Once: if (followDirection == FollowDirection.Forward) { if (currentIndex < EndIndex()) { nextIndex = currentIndex + 1; } } else if (followDirection == FollowDirection.Backward) { if (currentIndex > EndIndex()) { nextIndex = currentIndex - 1; } } break; case FollowType.Loop: if (followDirection == FollowDirection.Forward) { if (currentIndex < EndIndex()) { nextIndex = currentIndex + 1; } else { nextIndex = StartIndex(); } } else if (followDirection == FollowDirection.Backward) { if (currentIndex > EndIndex()) { nextIndex = currentIndex - 1; } else { nextIndex = StartIndex(); } } break; case FollowType.PingPong: if (followDirection == FollowDirection.Forward) { if (currentIndex < EndIndex()) { nextIndex = currentIndex + 1; } else { followDirection = FollowDirection.Backward; nextIndex = currentIndex - 1; } } else if (followDirection == FollowDirection.Backward) { if (currentIndex > EndIndex()) { nextIndex = currentIndex - 1; } else { followDirection = FollowDirection.Forward; nextIndex = currentIndex + 1; } } break; } return(nextIndex); }
private void Start() { player = GameManager.instance.player.transform; follow = GetComponent <FollowDirection>(); }
void Start() { follow = GetComponent <FollowDirection>(); dronAss = GetComponent <DronAserradoController>(); }
/// <summary> /// Sets the players to watch and follow /// </summary> /// <param name="players">The list of players</param> /// <param name="direction">The direction the players are travelling in</param> public void SetPlayers(List <Transform> players, FollowDirection direction) { _players = players; _direction = direction; _enabled = true; }
private void Awake() { follow = GetComponent <FollowDirection>(); }
private void Awake() { followDirection = GetComponent <FollowDirection>(); moveRandom = GetComponent <MoveRandom>(); }
private void Awake() { follow = GetComponent <FollowDirection>(); anim = GetComponent <Animator>(); }
int GetNextIndex(int currentIndex) { int nextIndex = -1; switch (followType) { case FollowType.Once: if (followDirection == FollowDirection.Forward) { if (currentIndex < EndIndex()) nextIndex = currentIndex + 1; } else if (followDirection == FollowDirection.Backward) { if (currentIndex > EndIndex()) nextIndex = currentIndex - 1; } break; case FollowType.Loop: if (followDirection == FollowDirection.Forward) { if (currentIndex < EndIndex()) nextIndex = currentIndex + 1; else nextIndex = StartIndex(); } else if (followDirection == FollowDirection.Backward) { if (currentIndex > EndIndex()) nextIndex = currentIndex - 1; else nextIndex = StartIndex(); } break; case FollowType.PingPong: if (followDirection == FollowDirection.Forward) { if (currentIndex < EndIndex()) nextIndex = currentIndex + 1; else { followDirection = FollowDirection.Backward; nextIndex = currentIndex - 1; } } else if (followDirection == FollowDirection.Backward) { if (currentIndex > EndIndex()) nextIndex = currentIndex - 1; else { followDirection = FollowDirection.Forward; nextIndex = currentIndex + 1; } } break; } return nextIndex; }