Beispiel #1
0
    public void DragonDead()
    {
        UIController.UpdatePages(UIMode.Vitory);
        bTimerActive = false;
        PlayerMovementScript playerMovement = FindObjectOfType <PlayerMovementScript>();

        playerMovement.GetAnimator().Play("Win");
        Vector3 Direction = bossBehaviour.transform.position - playerMovement.transform.position;

        if (Direction.x > 0)
        {
            if (playerMovement.GetSkeleton().Skeleton.ScaleX < 0)
            {
                playerMovement.GetSkeleton().Skeleton.ScaleX = -playerMovement.GetSkeleton().Skeleton.ScaleX;
            }
        }
        else
        {
            if (playerMovement.GetSkeleton().Skeleton.ScaleX > 0)
            {
                playerMovement.GetSkeleton().Skeleton.ScaleX = -playerMovement.GetSkeleton().Skeleton.ScaleX;
            }
        }

        if (PrincePrefab)
        {
            princeGO = Instantiate(PrincePrefab, bossBehaviour.transform.position, Quaternion.identity);

            GameObject VFX = Instantiate(WinVFX, bossBehaviour.transform.position, Quaternion.identity);
            Destroy(VFX, 5.0f);
            bossBehaviour.gameObject.SetActive(false);

            if (princeGO)
            {
                SkeletonAnimation PrinceSkeleton = princeGO.GetComponentInChildren <SkeletonAnimation>();
                if (Direction.x > 0)
                {
                    if (PrinceSkeleton.Skeleton.ScaleX < 0)
                    {
                        PrinceSkeleton.Skeleton.ScaleX = -PrinceSkeleton.Skeleton.ScaleX;
                    }
                }
                else
                {
                    if (PrinceSkeleton.Skeleton.ScaleX > 0)
                    {
                        PrinceSkeleton.Skeleton.ScaleX = -PrinceSkeleton.Skeleton.ScaleX;
                    }
                }
            }
        }

        cameraBehaviour.FocusCamera(playerMovement.transform.position, bossBehaviour.transform.position);
    }
    // Update is called once per frame
    void Update()
    {
        if (!GameRule.get.IsGameActive())
        {
            return;
        }

        if (Input.GetButtonDown("Jump"))
        {
            if (HasProjectile)
            {
                if (!playerMovementComponent.GetAnimator().GetCurrentAnimatorStateInfo(0).IsName("Attack"))
                {
                    playerMovementComponent.GetAnimator().Play("Attack");
                }
            }
        }

        if (HasProjectile == false && SpawnedProjectile == null)
        {
            HasProjectile = true;
        }
    }