コード例 #1
0
 public void Initialize(HUDController controller, PlayerHealthComponent component)
 {
     this.controller    = controller;
     displayedComponent = component;
     iconDisplay.sprite = displayedComponent.hudIcon;
     displayedComponent.onDeactivation.AddListener(IndicateDeactivation);
 }
コード例 #2
0
    //public AbilityHyperDash abilityHyperDash;

    // Use this for initialization
    void Start()
    {
        //Physics.gravity = new Vector3 (0, 0, -9.81f);
        anim                  = GetComponent <Animator> ();
        basicMovement         = GetComponent <AbilityBasicMovement> ();
        attackAbility         = GetComponent <AttackAbility> ();
        shieldAbility         = GetComponent <AbilityShield> ();
        dodgeAbility          = GetComponent <AbilityDodgeRoll> ();
        sprintAttackAbility   = GetComponent <AbilitySprintAttack> ();
        chargedAttackAbility  = GetComponent <AbilityChargedAttack> ();
        warpStrikeAbility     = GetComponent <AbilityWarpStrike>();
        grabAbility           = GetComponent <AbilityGrab> ();
        flinchState           = GetComponent <PlayerStateFlinch> ();
        fallState             = GetComponent <AbilityFall> ();
        interactState         = GetComponent <AbilityInteract> ();
        dialogueState         = GetComponent <AbilityDialogue> ();
        hurtInfo              = GetComponent <HurtInfoReceiver> ();
        playerHealthComponent = GetComponent <PlayerHealthComponent>();
        //abilityHyperDash = GetComponent<AbilityHyperDash> ();

        //If Player doesn't exist yet
        if (!playerExists)
        {
            playerExists = true;
            DontDestroyOnLoad(transform.gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        //Starting state for player
        playerState = PlayerState.Default;
    }
コード例 #3
0
    private void Start()
    {
        PlayerHealthComponent playerHealthComponent = GetComponent <PlayerHealthComponent>();

        m_StunInfoSC       = playerHealthComponent.GetStunInfoSubComponent();
        m_ProximityGuardSC = playerHealthComponent.GetProximityGuardSubComponent();
    }
コード例 #4
0
    private void OnRoundOver_Internal()
    {
        if (!m_RoundIsOver)
        {
            PlayerHealthComponent player1HealthComp = GameManager.Instance.GetPlayerComponent <PlayerHealthComponent>(EPlayer.Player1);
            m_PlayersEndRoundHPPercentage[0] = player1HealthComp.GetHPPercentage();

            PlayerHealthComponent player2HealthComp = GameManager.Instance.GetPlayerComponent <PlayerHealthComponent>(EPlayer.Player2);
            m_PlayersEndRoundHPPercentage[1] = player2HealthComp.GetHPPercentage();

            if (m_PlayersEndRoundHPPercentage[0] > m_PlayersEndRoundHPPercentage[1])
            {
                UpdateRoundVictoryCounter(ELastRoundWinner.Player1);
            }
            else if (m_PlayersEndRoundHPPercentage[1] > m_PlayersEndRoundHPPercentage[0])
            {
                UpdateRoundVictoryCounter(ELastRoundWinner.Player2);
            }
            else
            {
                uint maxRoundsToWin = m_GameConfig.m_MaxRoundsToWin;
                if (GetPlayerRoundVictoryCounter(EPlayer.Player1) < maxRoundsToWin - 1 && GetPlayerRoundVictoryCounter(EPlayer.Player2) < maxRoundsToWin - 1)
                {
                    UpdateRoundVictoryCounter(ELastRoundWinner.Both);
                }
                m_LastRoundWinner = ELastRoundWinner.Both;
            }

            m_RoundIsOver = true;
            OnRoundOver?.Invoke(m_LastRoundWinner);

            m_PlayWonAndLostRoundAnimCoroutine = PlayWonAndLostRoundAnimation();
            GameManager.Instance.StartCoroutine(m_PlayWonAndLostRoundAnimCoroutine);
        }
    }
コード例 #5
0
 public PlayerProximityGuardSubComponent(PlayerHealthComponent healthComponent, PlayerMovementComponent movementComponent, Animator anim) : base(healthComponent.gameObject)
 {
     m_PlayerHealthComponent      = healthComponent;
     m_PlayerStunInfoSubComponent = m_PlayerHealthComponent.GetStunInfoSubComponent();
     m_PlayerMovementComponent    = movementComponent;
     m_Animator = anim;
     Utils.GetPlayerEventManager(m_Owner).StartListening(EPlayerEvent.ProximityBox, OnProximityBoxEvent);
 }
コード例 #6
0
    private void AddComponentDisplay(PlayerHealthComponent component, Transform parent)
    {
        var displayObject = Instantiate(componentDisplayPrefab, parent);
        var display       = displayObject.GetComponent <HealthComponentDisplay>();

        display.Initialize(this, component);

        componentDisplays.Add(display);
    }
コード例 #7
0
    public void Initialize(PlayerHealthComponent inPlayerHealthComponent, float inMaxShield)
    {
        _maxShield = inMaxShield;

        foreach (Transform child in transform)
        {
            child.gameObject.SetActive(true);
        }

        inPlayerHealthComponent.OnShieldChange += UpdateBar;
    }
コード例 #8
0
 private void Update()
 {
     if (m_PlayerStunInfoSC == null)
     {
         PlayerHealthComponent playerHealthComponent = GameManager.Instance.GetPlayerComponent <PlayerHealthComponent>(m_Target);
         if (playerHealthComponent != null)
         {
             m_PlayerStunInfoSC = playerHealthComponent.GetStunInfoSubComponent();
             m_PlayerStunInfoSC.OnGaugeValueChanged += OnGaugeValueChanged;
             OnGaugeValueChanged();
         }
     }
 }
コード例 #9
0
    // Use this for initialization
    void Start()
    {
        this.state                = InteractState.Check;
        this.animator             = GetComponent <Animator>();
        this.playerMovementSystem = GetComponent <AbilityBasicMovement>();
        this.playerDialogueState  = GameObject.Find("Player").GetComponent <AbilityDialogue>();
        this.DirectionSystem      = new FourDirectionSystem();
        this.holdItem.enabled     = false;

        this.HPHandler    = GetComponent <PlayerHealthComponent>();
        this.SPHandler    = GetComponent <PlayerSPComponent>();
        this.KeyInventory = GetComponent <PlayerKeyInventory>();
    }
コード例 #10
0
    private bool ArePlayersReady()
    {
        foreach (GameObject player in GameManager.Instance.GetPlayers())
        {
            PlayerHealthComponent playerHealth = player.GetComponent <PlayerHealthComponent>();
            if (playerHealth && !playerHealth.IsDead())
            {
                Animator          playerAnimator = player.GetComponentInChildren <Animator>();
                AnimatorStateInfo stateInfo      = playerAnimator.GetCurrentAnimatorStateInfo(0);
                if (playerAnimator != null && !playerAnimator.GetCurrentAnimatorStateInfo(0).IsTag(K_STANDIDLE_TAG))
                {
                    // If player's not dead and not playing StandIdle animation, then he's not ready to play end round animations
                    return(false);
                }
            }
        }

        return(true);
    }
コード例 #11
0
 public void Initialize(PlayerHealthComponent inHealthComponent)
 {
     inHealthComponent.OnHealthDamage += () => AddTrauma(0.3f);
 }
コード例 #12
0
 public void Initialize(PlayerHealthComponent inHealthComponent)
 {
     inHealthComponent.OnHealthDamage += () => AddTrauma(Vector3.one * 0.25f);
     inHealthComponent.OnShieldDamage += () => AddTrauma(Vector3.one * 0.20f);
 }
コード例 #13
0
 public void Initialize(PlayerHealthComponent inHealthComponent, float inMaxHealth)
 {
     _playerMaxHealth = inMaxHealth;
     inHealthComponent.OnHealthChange += SetTraumaRelativeToHealth;
 }
コード例 #14
0
 void Start()
 {
     this.healthComponent = GetComponent <PlayerHealthComponent>();
     this.playerAnimator  = GetComponent <Animator>();
     this.fallState       = FallState.Setup;
 }