public WorldState(PlayerInRange playerInRange, HasObstacle hasObstacle, AtObstacle atObstacle, PlayerDead playerDead) { this.playerInRange = playerInRange; this.hasObstacle = hasObstacle; this.atObstacle = atObstacle; this.playerDead = playerDead; }
public static void UnSubscribePerLevelEvents() { GameStart.UnSubscribeAll(); PlayerSpawn.UnSubscribeAll(); PlayerDead.UnSubscribeAll(); GameQuit.UnSubscribeAll(); }
// Start is called before the first frame update void Start() { scoreCount = 0; activeSpawn = Random.Range(0, itemSpawners.Length); coinInstantiated = Instantiate(coin, itemSpawners[activeSpawn].position, Quaternion.identity); playerDead = FindObjectOfType <PlayerDead>(); }
void OnEnemyDied(NetworkMessage netMsg) { PlayerDead playerDied = netMsg.ReadMessage <PlayerDead>(); enemy victim = players[playerDied.victim].GetComponent <enemy>(); if (playerDied.killer == id) { addKill(); if (kills > maxPoints) { setRecordHolder(-1, kills); } if (baseDamage == -1 && victim.getMedia() != -1) { player.GetComponent <PController>().applyBoost(victim.getMedia()); } else if (baseDamage != -1 && victim.getMedia() == -1) { player.GetComponent <PController>().applyBoost(-1); } } else { enemy en = players[playerDied.killer].GetComponent <enemy>(); en.addKill(); if (en.getKills() > maxPoints) { setRecordHolder(en.getId(), en.getKills()); } } victim.die(); }
private void CreateNetwork() { dead = new PlayerDead(this); walking = new PlayerWalking(this); jumping = new PlayerJumping(jumpBufferTime, this); rising = new PlayerRising(this); falling = new PlayerFalling(this); flipping = new PlayerFlipping(flipTime, flipOffset, this); walking.AddTransition(dead); walking.AddTransition(jumping); walking.AddTransition(rising); walking.AddTransition(falling); walking.AddTransition(flipping); jumping.AddTransition(dead); jumping.AddTransition(walking); jumping.AddTransition(rising); jumping.AddTransition(falling); jumping.AddTransition(flipping); rising.AddTransition(dead); rising.AddTransition(walking); rising.AddTransition(falling); rising.AddTransition(flipping); falling.AddTransition(dead); falling.AddTransition(walking); falling.AddTransition(rising); flipping.AddTransition(walking); flipping.AddTransition(falling); activeState = walking; }
public void HumanDelete(Human human) { if (_humans.Count == 1) { _humans[0].StopRun(); _humans[0].Dead(); PlayerDead?.Invoke(); return; } if (human != null) { _humans[0].StopRun(); _humans[_humans.Count - 1].StopWaving(); PullOutHuman(human); if (_humans.Count != 1) { _humans[_humans.Count - 1].Waving(); } _humans[0].Run(); AttractCheckers(human); HumanAdded?.Invoke(_humans.Count); } }
private void LateUpdate() { PlayerLeftText.text = "Left: " + PlayerLeft.ToString(); PlayerDangerText.text = "Danger: " + Players.Where(x => !x.MustRemove).Sum(x => x.Count).ToString(); PlayerDeadText.text = "Dead: " + PlayerDead.ToString(); PlayerSafeText.text = "Safe: " + PlayerSafe.ToString(); }
public static void UnSubscribeAll() { GameStart.Unsubscribe(); RunningStart.Unsubscribe(); SpeedIncrease.Unsubscribe(); PlayerDead.Unsubscribe(); GameOverBackToMain.Unsubscribe(); }
// Function(s) for Dead State public void GoToDeadState() { isAlive = false; myState.Exit(); myState = new PlayerDead(this); Debug.Log(myState); myState.Enter(); }
const float GRAVITY = 9.8f; // Value of gravity, used to simulate falling, if a bridge type platform is spawned. // Use this for initialization void Start() { mController = GetComponent <CharacterController>(); ScoreKeeper scoreKeeper = GameObject.FindGameObjectWithTag("HUD").GetComponent <ScoreKeeper>(); mPlayerMoving = scoreKeeper.OnPlayerMoving; mPlayerDead = scoreKeeper.OnPlayerDeath; }
void OnCollisionEnter(Collision other) { if (other.gameObject.CompareTag("FatalGround")) { PlayerDead?.Invoke(); StartCoroutine(DieWithDelay()); } }
private void Awake() { playerStat = GetComponent <Stat>(); rigid = GetComponent <Rigidbody2D>(); playerMove = GetComponent <PlayerMove>(); pr = GetComponent <PlayerRenderer>(); dead = GetComponent <PlayerDead>(); dir = 1; evasion = false; }
public void PlayerDead(PlayerDead d) { deadText.SetActive(true); print("You died!"); foreach (GameObject obj in playerUI) { obj.SetActive(false); } GameObject.Find("free_sword").SetActive(false); RestartButton.SetActive(true); }
public void RPC_TakeDamage() { currentHealthPoints--; healthSlider.value = currentHealthPoints; isInCooldown = true; if (currentHealthPoints == 0) { PlayerDead?.Invoke(this.transform.position); } }
public void ChangeHealth(int change) { if (!invencible) { if (health + change < health) { CancelInvoke("DamageFeedback"); InvokeRepeating("DamageFeedback", 0, fbRate); Invoke("StopFeedback", fbTime); } health = health + change; } if (health <= 0) { health = 0; //ENEMIGO KAMIKAZE //Si Health registra el compoonente kamikaze se ejecuta el siguiente código if (this.GetComponent <KamikazeEnemy>()) { //Kamikazing() devuelve un booleano que indica su estado (enemigo normal/ kamikaze) if (!this.GetComponent <KamikazeEnemy>().Kamikazing() && !invencible) { //Si devuelve false (está en modo normal) ejecuta el método kamikaze, que induce al enemigo en su estado de kamikaze y le otorga una pequeña cantidad de vida this.GetComponent <KamikazeEnemy>().Kamikaze(); invencible = true; health = 50; Invoke("Invencible", 2); } //Si devuelve true, ya está en estado kamikaze, y ñe hace explotar else if (this.GetComponent <KamikazeEnemy>().CheckDie()) { this.GetComponent <KamikazeEnemy>().Explode(); } } else { PlayerDead die = GetComponent <PlayerDead>(); if (die) { die.OnDead(); } Enemy en = GetComponent <Enemy>(); if (en) { en.OnDead(); } } } else if (health > maxHealth) { health = maxHealth; } }
private void Died() { //PlayerDead(); // Hiba, ha nincs felirakozva senki // 1. kezelési mód: /*if (PlayerDead != null) * PlayerDead();*/ // 2. kezelési mód: PlayerDead?.Invoke(); }
public void Death() { currentHP--; PlayerDead?.Invoke(); isDead = true; if (currentHP <= 0) { StartCoroutine(DeathCoroutine()); } else { StartCoroutine(RespawnCoroutine()); } }
private void Start() { playerRigidbody = GetComponent <Rigidbody2D>(); animator = GetComponentInChildren <Animator>(); stateMachine = gameObject.AddComponent(typeof(StateMachine)) as StateMachine; idleState = new PlayerIdle(this, stateMachine); hurtState = new PlayerHurt(this, stateMachine); deadState = new PlayerDead(this, stateMachine); bounceVelocity = Vector3.zero; bounceTimer = maxBounceTime; hurtTimer = maxHurtTime; stateMachine.SetState(idleState); mainCamera = Camera.main; transform = gameObject.transform; }
public void RPC_TakeDamageFromEnemy() { if (isInCooldown) { return; } Debug.Log("Forced damage from enemy"); currentHealthPoints--; healthSlider.value = currentHealthPoints; if (currentHealthPoints == 0) { PlayerDead?.Invoke(this.transform.position); } }
private void Awake() { playerStats = GetComponent <Player>(); sPlayerWait = new PlayerWait(this); sPlayerDead = new PlayerDead(this); sPlayerChaseBall = new PlayerChaseBall(this); sPlayerRunAndDribble = new PlayerRunAndDribble(this); sPlayerActionDecision = new PlayerActionDecision(this); sPlayerMovementDecision = new PlayerMovementDecision(this); sPlayerMovingToPosition = new PlayerMovingToPosition(this); //load an HP bar from the resources folder. GameObject g = (GameObject)Instantiate(Resources.Load("Prefabs/HealthBar")); g.SendMessage("SetOwner", playerStats); }
void Start() { layer = ~(1 << 12 | 1 << 13); go_Player = GameManager.player; camSlope = this.transform.rotation.eulerAngles.x * Mathf.Deg2Rad; myCam = this.gameObject.GetComponent <Camera>(); player_Transform = go_Player.GetComponent <Transform>(); IsPlayerDead = go_Player.GetComponent <AHeroes>().IsDead; camSpeed = 7.5f; zoomSpeed = 1.0f; minDistance = 5.0f; maxDistance = 16.5f; currentDistance = 16.5f; this.transform.position = new Vector3(player_Transform.position.x, +Mathf.Sin(camSlope) * currentDistance, -Mathf.Cos(camSlope) * currentDistance); doOnce = false; StartCoroutine(Zoom()); }
private void Start() { playerFSM = new FSM(); var idle = new PlayerIdle(E_FSM_State_Type.PlayerIdle, this); var victory = new PlayerVictory(E_FSM_State_Type.PlayerVictory, this); var jump = new PlayerJump(E_FSM_State_Type.PlayerJump, this); var look = new PlayerLook(E_FSM_State_Type.PlayerLook, this); var defeat = new PlayerDefeat(E_FSM_State_Type.PlayerDefeat, this); var Dead = new PlayerDead(E_FSM_State_Type.PlayerDead, this); playerFSM.RegistState(idle); playerFSM.RegistState(victory); playerFSM.RegistState(jump); playerFSM.RegistState(look); playerFSM.RegistState(defeat); playerFSM.RegistState(Dead); playerFSM.Go(idle); FW.MonoMgr.Instance.AddUpdateListener(playerControl.Updates); }
void OnDead(NetworkMessage netMsg) { //take care of killer id NetInt dead = netMsg.ReadMessage <NetInt>(); PlayerDead playerDead = new PlayerDead(); playerDead.victim = netMsg.conn.connectionId; playerDead.killer = dead.value; sendToAllExcept(netMsg.conn.connectionId, 914, playerDead); ConnectedUsers.Find(x => x.id == netMsg.conn.connectionId).dead = true; /*foreach(User u in ConnectedUsers.FindAll(x => x.id != netMsg.conn.connectionId)){ * NetworkServer.SendToClient(u.id,914,playerDead); * }*/ StartCoroutine(respawn(netMsg.conn.connectionId)); User u = ConnectedUsers.Find(x => x.id == dead.value); u.kills++; if (u.kills >= config.kills) { timeLeft = 0; } }
void Start() { playerMovement = GetComponent<PlayerMovement>() as PlayerMovement; playerDead = GetComponent<PlayerDead>() as PlayerDead; }
private void InvokePlayerDead() { PlayerDead?.Invoke(this, EventArgs.Empty); }
public void OnPlayerDead() { PlayerDead?.Invoke(); }
void Death() //the event that lets all subscribers know u ded { PlayerDead?.Invoke(); //the exact same thing as saying "if(PlayerDead != null) { PlayerDead }" }
public static void UnsubscribeAllSubscriber() { if (NextPhase != null) { System.Delegate[] delegates = NextPhase.GetInvocationList(); for (int i = 0; i < delegates.Length; i++) { NextPhase -= delegates [i] as NextPhaseEvent; } } if (AllowCurrentPlayerToMove != null) { System.Delegate[] delegates = AllowCurrentPlayerToMove.GetInvocationList(); for (int i = 0; i < delegates.Length; i++) { AllowCurrentPlayerToMove -= delegates [i] as AllowCurrentPlayerToMoveEvent; } } if (DisallowCurrentPlayerToMove != null) { System.Delegate[] delegates = DisallowCurrentPlayerToMove.GetInvocationList(); for (int i = 0; i < delegates.Length; i++) { DisallowCurrentPlayerToMove -= delegates [i] as DisallowCurrentPlayerToMoveEvent; } } if (AllowCurrentPlayerToFire != null) { System.Delegate[] delegates = AllowCurrentPlayerToFire.GetInvocationList(); for (int i = 0; i < delegates.Length; i++) { AllowCurrentPlayerToFire -= delegates [i] as AllowCurrentPlayerToFireEvent; } } if (DisallowCurrentPlayerToFire != null) { System.Delegate[] delegates = DisallowCurrentPlayerToFire.GetInvocationList(); for (int i = 0; i < delegates.Length; i++) { DisallowCurrentPlayerToFire -= delegates [i] as DisallowCurrentPlayerToFireEvent; } } if (NextPlayer != null) { System.Delegate[] delegates = NextPlayer.GetInvocationList(); for (int i = 0; i < delegates.Length; i++) { NextPlayer -= delegates [i] as NextPlayerEvent; } } if (PlayerDead != null) { System.Delegate[] delegates = PlayerDead.GetInvocationList(); for (int i = 0; i < delegates.Length; i++) { PlayerDead -= delegates [i] as PlayerDeadEvent; } } if (PlayerWon != null) { System.Delegate[] delegates = PlayerWon.GetInvocationList(); for (int i = 0; i < delegates.Length; i++) { PlayerWon -= delegates [i] as PlayerWonEvent; } } if (TimerEnd != null) { System.Delegate[] delegates = TimerEnd.GetInvocationList(); for (int i = 0; i < delegates.Length; i++) { TimerEnd -= delegates [i] as TimerEndEvent; } } if (PlayerCast != null) { System.Delegate[] delegates = PlayerCast.GetInvocationList(); for (int i = 0; i < delegates.Length; i++) { PlayerCast -= delegates [i] as PlayerCastEvent; } } if (SpellEnd != null) { System.Delegate[] delegates = SpellEnd.GetInvocationList(); for (int i = 0; i < delegates.Length; i++) { SpellEnd -= delegates [i] as SpellEndEvent; } } if (NextPlayerButtonClick != null) { System.Delegate[] delegates = NextPlayerButtonClick.GetInvocationList(); for (int i = 0; i < delegates.Length; i++) { NextPlayerButtonClick -= delegates [i] as NextPlayerButtonClickEvent; } } }
public void PlayerDeathEvent() { PlayerDead?.Invoke(); }
private void Awake() { m_Rigidbody2D = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); deadM = GetComponent <PlayerDead>(); }
void Awake() { instance = this; }