Esempio n. 1
0
    public void Effect(PlayerStatusController playerStatusController,
                       PlayerHorizontalMovement playerHorizontalMovement, PlayerStatusVariables playerStatusVariables)
    {
        this.playerHorizontalMovement = playerHorizontalMovement;
        this.playerStatusController   = playerStatusController;
        this.playerStatusVariables    = playerStatusVariables;


        if (playerStatusVariables.isAdrenalineActive)
        {
            var range = Random.Range(0, 11);
            if (range <= 5)
            {
                playerStatusController.Die();
            }
            else
            {
                playerStatusVariables.isMorphinActive = true;
                playerStatusController.RegenLifeTemporary(duration, lifeRegenAmount, true);
            }
        }
        else
        {
            playerStatusVariables.isMorphinActive = true;
            playerStatusController.RegenLifeTemporary(duration, lifeRegenAmount, false);
            currentTimeMorphinEffect = Time.time + duration;
            CoroutineManager.AddCoroutine(MorphinEffectCoroutine(staminaRegenMultiplier, velocityMultiplier),
                                          "MorphinEffectCoroutine", this);
        }
    }
Esempio n. 2
0
    void Start()
    {
        //PlayerStatusVariables = new PlayerStatusVariables();
        PlayerStatusVariables  = GetComponent <PlayerStatusVariables>();
        PlayerStatusController = GetComponent <PlayerStatusController>();

        PlayerCollisionHandler = new BasicCollisionHandler(this, maxAngle, layerMaskForCollisions);

        PlayerController = new PlayerController(transform);

        HorizontalMovement = new PlayerHorizontalMovement(this, maxSpeed, acceleration,
                                                          dodgeForce, crouchingSpeed, PlayerCollisionHandler, PlayerController, PlayerStatusVariables,
                                                          PlayerStatusController);

        VerticalMovement = new PlayerVerticalMovement(this, jumpForce, climbingLadderSmoothness,
                                                      climbingObstacleSmoothness, climbLadderVelocity, minimumFallingDistanceForDamage, minimumDamageForFalling,
                                                      PlayerCollisionHandler,
                                                      PlayerController,
                                                      PlayerStatusVariables, PlayerStatusController);

        MiscellaneousMovement = new PlayerMiscellaneousMovement(this, cameraZoomSize, PlayerCollisionHandler,
                                                                PlayerController,
                                                                PlayerStatusVariables, Inventory, diary, InGameMenuController);

        CombatMovement = new PlayerCombatMovement(this, PlayerCollisionHandler, PlayerController,
                                                  PlayerStatusVariables, PlayerStatusController, HorizontalMovement, Inventory, cqcDistance, cqcDamage,
                                                  offsetForThrowableItemPosition,
                                                  rangeForShortThrowableItemPosition);
    }
Esempio n. 3
0
 private void Start()
 {
     _animator   = GetComponent <Animator>();
     _mouseInput = Camera.main.GetComponent <MouseInput>();
     //_spriteRenderer = GetComponent<SpriteRenderer>();
     _playerHorizontalMovement = GetComponentInParent <PlayerHorizontalMovement>();
 }
Esempio n. 4
0
    void Start()
    {
        // Initialize player state
        health = startingHealth;
        //health = 50;
        moving              = false;
        attacking           = false;
        deathStarted        = false;
        movedWhileAttacking = false;
        isSuperActive       = false;
        inAir    = false;
        crouched = false;
        listeningForDoubleDownTap = false;
        remainingJumps            = 1;
        superMeterCharge          = 0f;
        superBar               = GameObject.Find("Super Bar").GetComponent <Slider>();
        superBarGlow           = superBar.transform.GetChild(0).GetComponent <Image>();
        superBar.maxValue      = maxSuperCharge;
        superBarGlow.color     = new Color(0.8784314f, 1f, 0f, 0f);
        blockNormalJumpAnims   = false;
        daronListeningForParry = false;
        serjFlightActive       = false;
        performFriction        = false;

        // Player-specific attack
        blockAttackProgress = true;

        // Get components from gameobjects
        sr     = transform.GetChild(1).gameObject.GetComponent <SpriteRenderer>();
        srLegs = transform.GetChild(0).gameObject.GetComponent <SpriteRenderer>();

        rb                = gameObject.GetComponent <Rigidbody2D>();
        shortRange        = shortRangeHitbox.GetComponent <Animator>();
        lowerBodyHitbox   = gameObject.GetComponent <BoxCollider2D>();
        lowOriginalOffset = lowerBodyHitbox.offset;
        lowOriginalSize   = lowerBodyHitbox.size;

        // Configure other player scripts
        paa    = playerUpperBody.GetComponentInChildren <PlayerAttackAnims>();
        phm    = GetComponent <PlayerHorizontalMovement>();
        pj     = GetComponent <PlayerJump>();
        paa.ps = this;
        phm.ps = this;
        pj.ps  = this;

        // Empty check on bandmember name
        if (currentBandMember == "")
        {
            currentBandMember = "John";
        }

        //Get the starting control scheme
        updateControlScheme();
    }
Esempio n. 5
0
    public void Effect(PlayerStatusController playerStatusController,
                       PlayerHorizontalMovement playerHorizontalMovement, PlayerStatusVariables playerStatusVariables)
    {
        this.playerHorizontalMovement = playerHorizontalMovement;
        this.playerStatusController   = playerStatusController;
        this.playerStatusVariables    = playerStatusVariables;

        playerStatusVariables.isAdrenalineActive = true;


        if (playerStatusVariables.isMorphinActive)
        {
            var range = Random.Range(0, 11);
            if (range <= 5)
            {
                playerStatusController.Die();
            }
        }

        currentTimeAdrenalineEffect = Time.time + duration;
        CoroutineManager.AddCoroutine(AdrenalineEffectCoroutine(staminaRegenMultiplier, velocityMultiplier),
                                      "AdrenalineEffectCoroutine", this);
    }
Esempio n. 6
0
 public void GetPlayerHorizontalMovement(GameObject player)
 {
     _playerMovement = player.GetComponent <PlayerHorizontalMovement>();
 }