예제 #1
0
    // Use this for initialization
    public void Start()
    {
        playerMoveComp             = GetComponent <Movement>();
        playerHealthComp           = GetComponent <PlayerHealth>();
        playerThrowComp            = GetComponent <PlayerThrowing>();
        otherPlayer                = playerMoveComp.otherPlayer.gameObject;
        otherPlayerAnimatorManager = otherPlayer.GetComponent <PlayerPieceAnimatorManager>();
        for (int i = 0; i < playerMoveComp.pieces.Count; i++)
        {
            Animator pieceAnimator = playerMoveComp.pieces[i].gameObject.GetComponent <Animator>();
            if (pieceAnimator)
            {
                playerPieceAnimators.Add(pieceAnimator);
                playerPieceDictionary.Add(pieceAnimator, playerMoveComp.pieces[i]);                                   //add the pieces and their animators to a dictionary for ease of use
                playerFaceDictionary.Add(pieceAnimator, pieceAnimator.transform.GetComponentInChildren <Animator>()); //add face animators

                LookAtObject tempLookComp = pieceAnimator.gameObject.GetComponentInChildren <LookAtObject>();         //get the look at object component on the face and set the target look to the other player
                if (tempLookComp)
                {
                    tempLookComp.targetLook = otherPlayer.transform;
                }
            }
        }

        playerPieceAnimators[0].SetBool("baseCamper", true);
    }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        PlayerPieceAnimatorManager myScript = (PlayerPieceAnimatorManager)target;

        if (GUILayout.Button("Fix Player Sprites"))
        {
            myScript.FixPlayerSprites();
        }
    }
예제 #3
0
    public override void OnHeartCollide(float heartVal, DetachedPiece thisHeart)
    {
        if (catchingIsStopped == false)
        {
            if (NextPosFree())
            {
                health += heartVal;
                if (health > maxHealth)
                {
                    health = maxHealth;
                }
                BlockHealthCheck();
                SetHighlight();
                thisHeart.collidedOnce = true;

                LookAtObject newBoiFace   = playerBlockParent.GetChild((int)health - 1).GetComponentInChildren <LookAtObject>();
                LookAtObject looseBoiFace = thisHeart.GetComponentInChildren <LookAtObject>();
                newBoiFace.randomizeFace = false;
                if (!newBoiFace.alreadyGotSpecialFace)
                {
                    newBoiFace.GetComponent <SpriteRenderer>().sprite = looseBoiFace.GetComponent <SpriteRenderer>().sprite;
                }
                else if (latestFaceProfile != null)
                {
                    if (!looseBoiFace.alreadyGotSpecialFace)
                    {
                        newBoiFace.SetRandomFace(latestFaceProfile); //asign the lipstick on attachment now i guess
                    }
                    else
                    {
                        newBoiFace.GetComponent <SpriteRenderer>().sprite = looseBoiFace.GetComponent <SpriteRenderer>().sprite;
                    }
                }

                Destroy(thisHeart.gameObject);

                // play Get Piece sound
                fModGetPieceEvent.start();

                if (health > 1 && rotationIndicatorIcon.activeSelf == false)
                {
                    rotationIndicatorIcon.SetActive(true);
                }

                PlayerPieceAnimatorManager animationManager = GetComponent <PlayerPieceAnimatorManager>();
                if (animationManager)
                {
                    //animationManager.ActivateAnimatorTrigger("Catch");
                }
            }
        }
    }
예제 #4
0
    private void Awake()
    {
        playerMoveComp   = GetComponent <Movement>();
        playerHealthComp = GetComponent <PlayerHealth>();

        throwingProfile.diagonalUp   = new Throw(throwingProfile.diagonalUp.yDistance, throwingProfile.diagonalUp.xDistance, throwingProfile.diagonalUp.timeToApex);
        throwingProfile.diagonalDown = new Throw(throwingProfile.diagonalDown.yDistance, throwingProfile.diagonalDown.xDistance, throwingProfile.diagonalDown.timeToApex);
        throwingProfile.upwards      = new Throw(throwingProfile.upwards.yDistance, throwingProfile.upwards.xDistance, throwingProfile.upwards.timeToApex);
        throwingProfile.downwards    = new Throw(throwingProfile.downwards.yDistance, throwingProfile.downwards.xDistance, throwingProfile.downwards.timeToApex);
        throwingProfile.horizontals  = new Throw(throwingProfile.horizontals.yDistance, throwingProfile.horizontals.xDistance, throwingProfile.horizontals.timeToApex);

        playerPieceAnimatorComp = GetComponent <PlayerPieceAnimatorManager>();
    }