Ejemplo n.º 1
0
    public void StartAttack(float duration)
    {
        set        = false;
        sliceCount = groundSections.rings[0].sections.Count;

        faceIndex       = player.faceIndex;
        storeFaceIndex  = player.faceIndex + sliceCount;
        allredFaceIndex = player.faceIndex + sliceCount;

        Vector3 lookAtPos = _player.position - bossContr.transform.position;

        lookAtPos.y = 0;
        bossContr.transform.rotation = Quaternion.LookRotation(lookAtPos);
        //bossContr.transform.Rotate(0, 90, 0);
        bossContr.StartSlam(duration);

        groundSections.rings[0].sections[faceIndex].isTarget = true;

        tilesAttack.AttackOnFace(duration, (storeFaceIndex + 2) % sliceCount);
        groundSections.SwitchFaceDelayed(player.ringIndex, (storeFaceIndex + 2) % sliceCount, true, duration);

        tilesAttack.AttackOnFace(duration, (storeFaceIndex - 2) % sliceCount);
        groundSections.SwitchFaceDelayed(player.ringIndex, (storeFaceIndex - 2) % sliceCount, true, duration);

        faceIndex += sliceCount;
    }
Ejemplo n.º 2
0
    public void StartAttack(float duration)
    {
        GroundSections     attackRing        = Instantiate(attackRingPrefab, Vector3.zero, Quaternion.identity);
        GroundColorChanger attackRingControl = attackRing.GetComponent <GroundColorChanger>();

        if (firstAtt)
        {
            int numFaces = playerGround.rings[0].sections.Count;
            int numRings = playerGround.rings.Count;
            Debug.Assert(numRings == 1);

            int playerRingPosCorrected = player.ringIndex + numRings;
            int playerSectPosCorrected = player.faceIndex + numFaces;
            hurtingFaces = new bool[numRings, numFaces];

            for (int i = 0; i < playerGround.rings.Count; i++)
            {
                for (int j = 0; j < playerGround.rings[i].sections.Count; j++)
                {
                    if ((j + numFaces + 1) % numFaces == player.faceIndex || (j + numFaces - 1) % numFaces == player.faceIndex)
                    {
                        hurtingFaces[i, j] = false;
                        playerGround.rings[i].sections[j].isTarget = false;
                    }
                    else
                    {
                        hurtingFaces[i, j] = true;
                        attackRing.rings[i].sections[j].gameObject.SetActive(true);
                        attackRingControl.ChangeColor(i, j, damageMat);
                        playerGroundControl.ChangeColorDelayed(i, j, damageMat, duration);
                        playerGround.SwitchFaceDelayed(i, j, duration);
                    }
                }
            }
            StartCoroutine(FindTargetFaces(hurtingFaces, duration - 0.15f));
            StartCoroutine(AttackCoroutine(duration, attackRing));
            firstAtt = false;
        }
        else
        {
            for (int i = 0; i < playerGround.rings.Count; i++)
            {
                for (int j = 0; j < playerGround.rings[i].sections.Count; j++)
                {
                    hurtingFaces[i, j] = !hurtingFaces[i, j];
                    if (hurtingFaces[i, j])
                    {
                        attackRing.rings[i].sections[j].gameObject.SetActive(true);
                        attackRingControl.ChangeColor(i, j, damageMat);
                        playerGroundControl.ChangeColorDelayed(i, j, damageMat, duration);
                        playerGround.SwitchFaceDelayed(i, j, true, duration);
                    }
                    else
                    {
                        attackRing.rings[i].sections[j].gameObject.SetActive(false);
                        playerGround.SwitchFaceDelayed(i, j, false, duration);
                    }
                }
            }
            StartCoroutine(FindTargetFaces(hurtingFaces, duration - 0.15f));
            StartCoroutine(AttackCoroutine(duration, attackRing));
        }
    }