private void playerDied(LocalEventNotifier.Event e) { --_playerCount; if (_playerCount <= 0) this.GameOver(); }
private void playerDied(LocalEventNotifier.Event e) { if (_player != null && (e as PlayerDiedEvent).PlayerIndex == _player.PlayerIndex) { _rectTransform.position = new Vector3(-99999, -99999, _rectTransform.position.z); _player = null; } }
private void playerSpawned(LocalEventNotifier.Event e) { PlayerSpawnedEvent playerSpawnedEvent = e as PlayerSpawnedEvent; if (playerSpawnedEvent.PlayerIndex == this.PlayerIndex) { _targetPlayerTransform = playerSpawnedEvent.PlayerObject.transform; } }
private void pointsReceived(LocalEventNotifier.Event e) { SessionPlayer player = DynamicData.GetSessionPlayer(this.PlayerIndex); if (player.HasJoined && player.PlayerIndex == ((PlayerPointsReceivedEvent)e).PlayerIndex) { this.UpdateLength(ProgressData.GetHealthForPlayer(this.PlayerIndex), ProgressData.MAX_HEALTH); } }
private void playerSpawned(LocalEventNotifier.Event e) { PlayerSpawnedEvent playerSpawnedEvent = e as PlayerSpawnedEvent; PlayerController playerController = playerSpawnedEvent.PlayerObject.GetComponent<PlayerController>(); playerController.Slots = new List<ProgressData.SlotWrapper>(ProgressData.WeaponSlotsByPlayer[playerSpawnedEvent.PlayerIndex]); _playerControllers[playerSpawnedEvent.PlayerIndex] = playerController; playerController.SetInitialHealth(ProgressData.GetHealthForPlayer(playerSpawnedEvent.PlayerIndex)); }
/** * Private */ private void playerSpawned(LocalEventNotifier.Event playerSpawnedEvent) { PlayerSpawnedEvent spawnEvent = playerSpawnedEvent as PlayerSpawnedEvent; if (spawnEvent.PlayerIndex == this.PlayerIndex) { GlobalEvents.Notifier.RemoveListenersForOwnerAndEventName(this, PlayerPointsReceivedEvent.NAME); spawnEvent.PlayerObject.GetComponent<Damagable>().OnHealthChangeCallbacks.Add(healthUpdated); } }
private void playerScoreUpdated(LocalEventNotifier.Event e) { PlayerPointsReceivedEvent pointsEvent = e as PlayerPointsReceivedEvent; if (pointsEvent.PlayerIndex == this.PlayerIndex) { this.ScoreText.text = _prefix + ProgressData.GetPointsForPlayer(this.PlayerIndex); } }
public void UpdateVisual(LocalEventNotifier.Event localEvent) { SCAttack attack = ((CharacterUpdateFinishedEvent)localEvent).CurrentAttack; _attackChanged = _currentAttack != null && _currentAttack != attack; _currentAttack = attack; _stateMachine.Update(); this.transform.localScale = new Vector3((_characterController.CurrentFacing == SCCharacterController.Facing.Left ? -1 : 1) * Mathf.Abs(this.transform.localScale.x), this.transform.localScale.y, this.transform.localScale.z); }
private void pointsReceived(LocalEventNotifier.Event e) { SessionPlayer player = DynamicData.GetSessionPlayer(this.PlayerIndex); if (player.HasJoined && player.PlayerIndex == ((PlayerPointsReceivedEvent)e).PlayerIndex) { for (int i = 0; i < this.Slots.Length; ++i) { this.Slots[i].UpdateWithSessionPlayer(player); } } }
private void levelComplete(LocalEventNotifier.Event e) { for (int i = 0; i < _playerControllers.Length; ++i) { PlayerController playerController = _playerControllers[i]; ProgressData.SlotWrapper[] slots = playerController != null ? playerController.Slots.ToArray() : new ProgressData.SlotWrapper[0]; ProgressData.UpdatePlayerSlots(i, slots); if (DynamicData.GetSessionPlayer(i).HasJoined) ProgressData.SetHealthForPlayer(i, playerController != null ? playerController.GetComponent<Damagable>().Health : 0); } }
/** * Private */ private void playerSpawned(LocalEventNotifier.Event playerSpawnedEvent) { PlayerSpawnedEvent spawnEvent = playerSpawnedEvent as PlayerSpawnedEvent; if (spawnEvent.PlayerIndex == this.PlayerIndex) { GlobalEvents.Notifier.RemoveListenersForOwnerAndEventName(this, PlayerPointsReceivedEvent.NAME); foreach (UISlot slot in this.Slots) { slot.SetPlayer(spawnEvent.PlayerObject); } } }
void choiceMade(LocalEventNotifier.Event e) { MenuElementSelectedEvent selectionEvent = e as MenuElementSelectedEvent; if (selectionEvent.Action.ToLower() == "choice_a") { PersistentData.RegisterAcceptedMaster(); } else if (selectionEvent.Action.ToLower() == "choice_b") { GlobalEvents.Notifier.SendEvent(new PlayMusicEvent()); PersistentData.RegisterRefusedMaster(); } }
public void OnHit(LocalEventNotifier.Event localEvent) { GameObject hit = ((HitEvent)localEvent).Hit; if (((1 << hit.layer) & this.DamagableLayers) != 0 && !_alreadyHitThisUpdate.Contains(hit)) { Damagable damagable = hit.GetComponent<Damagable>(); if (damagable != null && !damagable.Invincible) { damagable.ReceiveDamage(this); this.ApplyDamage(damagable); } } }
private void menuSelection(LocalEventNotifier.Event e) { MenuElementSelectedEvent menuSelectionEvent = e as MenuElementSelectedEvent; if (menuSelectionEvent.Element == _menuElement) { if (this.SlotType != WeaponData.Slot.Empty) { if (ProgressData.GetPointsForPlayer(this.PlayerIndex) >= _cost) { ProgressData.SmartSlot[] smartSlots = ProgressData.GetSmartSlots(this.PlayerIndex); bool ok = true; for (int i = 0; i < smartSlots.Length; ++i) { if (smartSlots[i].SlotType == this.SlotType) { ok = smartSlots[i].Level < WeaponData.GetMaxSlotsByType()[this.SlotType] || smartSlots[i].Ammo < WeaponData.GetSlotDurationsByType()[this.SlotType]; break; } } if (ok) { this.SelectionImage.color = _normalColor; ProgressData.ApplyPointsDeltaForPlayer(this.PlayerIndex, -_cost); ProgressData.PickupSlot(this.PlayerIndex, this.SlotType); GlobalEvents.Notifier.SendEvent(new PlayerPointsReceivedEvent(this.PlayerIndex, -_cost)); updateDisplay(); } else { this.SelectionImage.color = this.NotEnoughColor; } } else { this.SelectionImage.color = this.NotEnoughColor; } } else if (ProgressData.GetHealthForPlayer(this.PlayerIndex) < ProgressData.MAX_HEALTH && ProgressData.GetPointsForPlayer(this.PlayerIndex) >= _cost) { this.SelectionImage.color = _normalColor; ProgressData.SetHealthForPlayer(this.PlayerIndex, ProgressData.GetHealthForPlayer(this.PlayerIndex) + 1); ProgressData.ApplyPointsDeltaForPlayer(this.PlayerIndex, -_cost); GlobalEvents.Notifier.SendEvent(new PlayerPointsReceivedEvent(this.PlayerIndex, -_cost)); updateDisplay(); } else { this.SelectionImage.color = this.NotEnoughColor; } } }
private void playerSpawned(LocalEventNotifier.Event e) { PlayerSpawnedEvent playerSpawnedEvent = e as PlayerSpawnedEvent; if (playerSpawnedEvent.PlayerIndex == this.PlayerIndex) { SessionPlayer p = DynamicData.GetSessionPlayer(this.PlayerIndex); if (p.HasJoined && !ReInput.players.GetPlayer(p.RewiredId).controllers.hasMouse) { _player = p; _playerController = playerSpawnedEvent.PlayerObject.GetComponent<PlayerController>(); _playerController.SetUsingController(); } } }
public void OnHit(LocalEventNotifier.Event localEvent) { if (this.Invincible) return; GameObject hit = ((HitEvent)localEvent).Hit; if (((1 << hit.layer) & this.DamagerLayers) != 0 && !_alreadyHitThisUpdate.Contains(hit)) { Damager damager = hit.GetComponent<Damager>(); if (damager != null) { damager.ApplyDamage(this); this.ReceiveDamage(damager); } } }
public void OnLaserCast(LocalEventNotifier.Event localEvent) { LaserCastEvent castEvent = (LaserCastEvent)localEvent; CollisionManager.RaycastResult raycast = castEvent.RaycastResult; IntegerVector distance = raycast.FarthestPointReached - castEvent.Origin; if (distance.X == 0 && distance.Y == 0) return; GameObject lineObject = Instantiate(LinePrefab, this.transform.position, Quaternion.identity) as GameObject; lineObject.transform.parent = this.transform; lineObject.transform.position = new Vector3(castEvent.Origin.X, castEvent.Origin.Y, this.transform.position.z); lineObject.GetComponent<LineRenderer>().SetPosition(1, new Vector3(raycast.FarthestPointReached.X - castEvent.Origin.X, raycast.FarthestPointReached.Y - castEvent.Origin.Y, 0)); lineObject.GetComponent<AllegianceColorizer>().UpdateVisual(castEvent.AllegianceInfo); }
public void OnInvincibilityToggle(LocalEventNotifier.Event localEvent) { _activated = ((InvincibilityToggleEvent)localEvent).ToggledOn; if (_activated) { _normalColor = this.spriteRenderer.color; flashOn(); } else { _blinking = false; this.spriteRenderer.color = _normalColor; _blinkTimer = 0.0f; } }
public void OnCollide(LocalEventNotifier.Event localEvent) { CollisionEvent collision = localEvent as CollisionEvent; bool bounced = false; foreach (GameObject hit in collision.Hits) { LayerMask hitLayerMask = (1 << hit.layer); if (_bouncesRemaining > 0 && (hitLayerMask & this.BounceLayerMask) != 0) { if (!bounced) bounce(hit, collision.VelocityAtHit, collision.VelocityApplied); } else if ((hitLayerMask & this.HaltMovementMask) != 0) { scheduleDestruction(this.transform.position); } } }
private void playerSpawned(LocalEventNotifier.Event e) { _targets.Add((e as PlayerSpawnedEvent).PlayerObject.transform); }
private void playerDied(LocalEventNotifier.Event e) { _targets.Remove((e as PlayerDiedEvent).PlayerObject.transform); }
private void playMusic(LocalEventNotifier.Event e) { play(); }
private void gameplayBegin(LocalEventNotifier.Event e) { this.GetComponent<BossSpawner>().BeginSpawn(); }
private void playerDied(LocalEventNotifier.Event playerDiedEvent) { this.Targets.Remove((playerDiedEvent as PlayerDiedEvent).PlayerObject.transform); }
private void menuItemSelected(LocalEventNotifier.Event e) { if ((e as MenuElementSelectedEvent).Action == this.DismissalString) Hide(); }
public void OnCollide(LocalEventNotifier.Event localEvent) { CollisionEvent collision = localEvent as CollisionEvent; foreach (GameObject hit in collision.Hits) { if (this.CollisionWeaponType != null && this.CollisionWeaponType.SpecialEffect == WeaponType.SPECIAL_EXPLOSION && ((1 << hit.layer) & this.GetComponent<Damager>().DamagableLayers) != 0) { // Explode on impact Damagable damagable = this.GetComponent<Damagable>(); while (damagable.Health > 0) { damagable.ReceiveDamage(this.GetComponent<Damager>()); } } else if (((1 << hit.layer) & this.BounceLayerMask) != 0) { _actor.Bounce(hit, collision.VelocityAtHit, collision.VelocityApplied, this.BounceLayerMask, 0.0f); break; } } }
private void playerSpawned(LocalEventNotifier.Event playerSpawnedEvent) { PlayerSpawnedEvent spawnEvent = playerSpawnedEvent as PlayerSpawnedEvent; this.PlayerControllers[spawnEvent.PlayerIndex] = spawnEvent.PlayerObject.GetComponent<PlayerController>(); }
private void gameplayBegin(LocalEventNotifier.Event e) { this.GetComponent<TimedCallbacks>().AddCallback(this, SpawnPlayers, this.SpawnPlayersDelay); }
private void gameplayBegin(LocalEventNotifier.Event e) { _timedCallbacks.AddCallback(this, begin, this.InitialDelay); }
private void begin(LocalEventNotifier.Event e) { this.GetComponent<TimedCallbacks>().AddCallback(this, this.LevelStartIn, this.IntroDelay); }