public void Initialize(HUDController controller, PlayerHealthComponent component) { this.controller = controller; displayedComponent = component; iconDisplay.sprite = displayedComponent.hudIcon; displayedComponent.onDeactivation.AddListener(IndicateDeactivation); }
//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; }
private void Start() { PlayerHealthComponent playerHealthComponent = GetComponent <PlayerHealthComponent>(); m_StunInfoSC = playerHealthComponent.GetStunInfoSubComponent(); m_ProximityGuardSC = playerHealthComponent.GetProximityGuardSubComponent(); }
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); } }
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); }
private void AddComponentDisplay(PlayerHealthComponent component, Transform parent) { var displayObject = Instantiate(componentDisplayPrefab, parent); var display = displayObject.GetComponent <HealthComponentDisplay>(); display.Initialize(this, component); componentDisplays.Add(display); }
public void Initialize(PlayerHealthComponent inPlayerHealthComponent, float inMaxShield) { _maxShield = inMaxShield; foreach (Transform child in transform) { child.gameObject.SetActive(true); } inPlayerHealthComponent.OnShieldChange += UpdateBar; }
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(); } } }
// 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>(); }
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); }
public void Initialize(PlayerHealthComponent inHealthComponent) { inHealthComponent.OnHealthDamage += () => AddTrauma(0.3f); }
public void Initialize(PlayerHealthComponent inHealthComponent) { inHealthComponent.OnHealthDamage += () => AddTrauma(Vector3.one * 0.25f); inHealthComponent.OnShieldDamage += () => AddTrauma(Vector3.one * 0.20f); }
public void Initialize(PlayerHealthComponent inHealthComponent, float inMaxHealth) { _playerMaxHealth = inMaxHealth; inHealthComponent.OnHealthChange += SetTraumaRelativeToHealth; }
void Start() { this.healthComponent = GetComponent <PlayerHealthComponent>(); this.playerAnimator = GetComponent <Animator>(); this.fallState = FallState.Setup; }