Exemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     marked          = false;
     thisTransform   = GetComponent <Transform>();
     rotater         = GetComponent <RotateAroundOnCommand>();
     targetTransform = GameObject.Find("EnemyAttackPhaseSprite").GetComponent <Transform>();
     StartCoroutine(FailSafe(10f));
 }
Exemplo n.º 2
0
 public IEnumerator Rotate(bool falseIsCWTrueIsCCW, float radius, int numRotations, float finalY)
 {
     Debug.Log("Hook Attack: Time to rotate");
     rotater = GetComponent <RotateAroundOnCommand>();
     yield return(StartCoroutine(rotater.StartRotation(falseIsCWTrueIsCCW, radius, numRotations, this.transform.position.y + radius + finalY)));
 }
Exemplo n.º 3
0
    public override IEnumerator SelectAttack()
    {
        //Pick a side
        int randPos    = Random.Range(0, 3);
        int randAttack = Random.Range(0, 4);

        switch (randPos)
        {
        case 0:
            yield return(MoveToSetpoint(SetPoints[12], .2f));

            break;

        case 1:
            yield return(MoveToSetpoint(SetPoints[3], .2f));

            break;

        case 2:
            yield return(MoveToSetpoint(SetPoints[6], .2f));

            break;

        case 3:
            yield return(MoveToSetpoint(SetPoints[9], .2f));

            break;
        }

        //Spawn the hook and rope
        GameObject hook       = SpawnSpecialNormalProjectile(1f, hookPrefab);
        HookAttack hookAttack = hook.GetComponent <HookAttack>();

        Instantiate(ropePrefab);
        RotateAroundOnCommand hookRotater = hook.GetComponent <RotateAroundOnCommand>();

        hookRotater._centre = GameObject.Find("EnemyAttackPhaseSprite").GetComponent <Transform>().position;
        yield return(StartCoroutine(hookAttack.MoveHook(.2f, 1f)));


        //pick an attack


        //perform that attack
        if (randPos == 0)
        {
            switch (randAttack)
            {
            case 0:
                yield return(StartCoroutine(hookAttack.Rotate(true, 1f, 3, 0f)));

                hookAttack.LaunchHook(new Vector3(.45f, -4.5f, 0f));
                break;

            case 1:
                yield return(StartCoroutine(hookAttack.Rotate(true, 1f, 5, -.1f)));

                hookAttack.LaunchHook(new Vector3(1.5f, -4.5f, 0f));
                break;

            case 2:
                yield return(StartCoroutine(hookAttack.Rotate(false, 1f, 5, -.1f)));

                hookAttack.LaunchHook(new Vector3(-1.5f, -4.5f, 0f));
                break;

            case 3:
                yield return(StartCoroutine(hookAttack.Rotate(false, 1f, 3, 0f)));

                hookAttack.LaunchHook(new Vector3(-.45f, -4.5f, 0f));
                break;
            }
        }
        else if (randPos == 1)
        {
            switch (randAttack)
            {
            case 0:
                yield return(StartCoroutine(hookAttack.Rotate(false, 1f, 4, -.95f)));

                hookAttack.LaunchHook(new Vector3(-4.5f, .45f, 0f));
                break;

            case 1:
                yield return(StartCoroutine(hookAttack.Rotate(false, 1f, 6, -0.9f)));

                hookAttack.LaunchHook(new Vector3(-4.5f, 1.5f, 0f));
                break;

            case 2:
                yield return(StartCoroutine(hookAttack.Rotate(true, 1f, 5, 0.9f)));

                hookAttack.LaunchHook(new Vector3(-4.5f, -1.5f, 0f));
                break;

            case 3:
                yield return(StartCoroutine(hookAttack.Rotate(true, 1f, 3, .9f)));

                hookAttack.LaunchHook(new Vector3(-4.5f, -.45f, 0f));
                break;
            }
        }
        else if (randPos == 2)
        {
            switch (randAttack)
            {
            case 0:
                yield return(StartCoroutine(hookAttack.Rotate(true, 1f, 4, 0f)));

                hookAttack.LaunchHook(new Vector3(-.45f, 4.5f, 0f));
                break;

            case 1:
                yield return(StartCoroutine(hookAttack.Rotate(true, 1f, 6, .1f)));

                hookAttack.LaunchHook(new Vector3(-1.5f, 4.5f, 0f));
                break;

            case 2:
                yield return(StartCoroutine(hookAttack.Rotate(false, 1f, 6, .1f)));

                hookAttack.LaunchHook(new Vector3(1.5f, 4.5f, 0f));
                break;

            case 3:
                yield return(StartCoroutine(hookAttack.Rotate(false, 1f, 4, 0f)));

                hookAttack.LaunchHook(new Vector3(.45f, 4.5f, 0f));
                break;
            }
        }
        else if (randPos == 3)
        {
            switch (randAttack)
            {
            case 0:
                yield return(StartCoroutine(hookAttack.Rotate(true, 1f, 4, -.95f)));

                hookAttack.LaunchHook(new Vector3(4.5f, .45f, 0f));
                break;

            case 1:
                yield return(StartCoroutine(hookAttack.Rotate(true, 1f, 6, -0.9f)));

                hookAttack.LaunchHook(new Vector3(4.5f, 1.5f, 0f));
                break;

            case 2:
                yield return(StartCoroutine(hookAttack.Rotate(false, 1f, 5, 0.9f)));

                hookAttack.LaunchHook(new Vector3(4.5f, -1.5f, 0f));
                break;

            case 3:
                yield return(StartCoroutine(hookAttack.Rotate(false, 1f, 3, .9f)));

                hookAttack.LaunchHook(new Vector3(4.5f, -.45f, 0f));
                break;
            }
        }
    }