示例#1
0
    IEnumerator Teleport()
    {
        boss.StopFloating();
        teleporting = true;

        Transform target = boss.Waypoint.transform.GetChild(0);

        Vector3 teleportLocation  = Vector3.zero;
        Vector2 randomDirection2D = Random.insideUnitCircle;

        randomDirection2D.y = Mathf.Abs(randomDirection2D.y);

        Player player = Player.Instance;

        teleportLocation   = new Vector3(randomDirection2D.x, 0.0f, randomDirection2D.y) * 15.0f;
        teleportLocation.y = boss.transform.position.y;


        Vector3 originalScale = boss.transform.localScale;
        float   shrinkTime    = 0.0f;

        while (boss.transform.localScale.sqrMagnitude != 0)
        {
            shrinkTime += Time.deltaTime;
            shrinkTime  = Mathf.Clamp(shrinkTime, 0.0f, 1.0f);
            boss.transform.localScale = originalScale - (originalScale * (shrinkTime / 1.0f));
            yield return(null);
        }

        boss.Waypoint.transform.position = new Vector3(player.transform.position.x, 0.0f, player.transform.position.z);

        target.localPosition    = teleportLocation;
        boss.transform.position = target.position;

        boss.transform.localScale = Vector3.zero;
        float growthTime = 0.0f;

        while (boss.transform.localScale.sqrMagnitude < originalScale.sqrMagnitude)
        {
            growthTime += Time.deltaTime;
            growthTime  = Mathf.Clamp(growthTime, 0.0f, 1.0f);
            boss.transform.localScale        = originalScale * (growthTime / 1.0f);
            boss.Waypoint.transform.position = new Vector3(player.transform.position.x, 0.0f, player.transform.position.z);
            boss.transform.position          = target.position;
            Debug.DrawLine(player.transform.position, target.position, Color.cyan);
            yield return(null);
        }
        boss.StartFloating();
        teleporting = false;
        inPosition  = true;
    }
示例#2
0
    IEnumerator Teleport()
    {
        boss.StopFloating();
        teleporting = true;
        Vector3 teleportLocation = Vector3.zero;
        bool    tooClose         = false;

        do
        {
            teleportLocation = Utility.RandomPointInBounds(boss.MovementBoundaries.bounds);
            tooClose         = false;
            for (int i = 0; i < projectiles.Length && !tooClose; i++)
            {
                //tooClose = (projectiles[i].transform.position - teleportLocation).sqrMagnitude < 16.0f;
                tooClose = (projectiles[i].transform.position - teleportLocation).sqrMagnitude < 4.0f;
            }
        } while (tooClose);
        Vector3 originalScale = boss.transform.localScale;
        float   shrinkTime    = 0.0f;

        while (boss.transform.localScale.sqrMagnitude != 0)
        {
            shrinkTime += Time.deltaTime;
            shrinkTime  = Mathf.Clamp(shrinkTime, 0.0f, 1.0f);
            boss.transform.localScale = originalScale - (originalScale * (shrinkTime / 1.0f));
            yield return(null);
        }
        boss.transform.position = teleportLocation;

        boss.transform.localScale = Vector3.zero;
        float growthTime = 0.0f;

        while (boss.transform.localScale.sqrMagnitude < originalScale.sqrMagnitude)
        {
            growthTime += Time.deltaTime;
            growthTime  = Mathf.Clamp(growthTime, 0.0f, 1.0f);
            boss.transform.localScale = originalScale * (growthTime / 1.0f);
            yield return(null);
        }
        boss.StartFloating();
        teleporting = false;
    }
示例#3
0
 public override void Exit()
 {
     boss4Pot.StopFloating();
 }
示例#4
0
 public override void Exit()
 {
     boss.StopFloating();
     boss.StopCoroutine(movingCoroutine);
     boss.StopCoroutine(spawningCoroutine);
 }