void Update() { if (IsHeroNearCentralWayout()) { _hero.IsInWayoutZone = true; if (_isDragListenerActivated) { if (_hero.IsDragging() && _centralWayout.OverlapPoint(GetCurrentMousePosition())) { if (_hero.GetDragTarget().name.Equals(_dragTrainingPassengerName)) { _trainingHandler.ShowNext(); _isDragListenerActivated = false; } } } } else { bool anyDoorIsReachable = false; for (int i = 0; i < _doors.Count; i++) { if (IsHeroNearWayout(_doors[i], false) && _timer.IsDoorOpenedByNumber(i)) { anyDoorIsReachable = true; break; } } _hero.IsInWayoutZone = anyDoorIsReachable; } }
public void KillStickPassenger() { foreach (var passengerSm in _passengers) { if (passengerSm.IsStick()) { if (!TrainingHandler.IsTrainingFinished()) { if (passengerSm.IsStickModifiedForTraining()) { TrainingHandler handler = MonobehaviorHandler.GetMonobeharior().GetObject <TrainingHandler>("TrainingHandler"); handler.SetIsGnomeSurvived(false); handler.ShowNext(); } } else { RegisterDeath(passengerSm); } if (passengerSm != null) { MonoBehaviour.Destroy(passengerSm.gameObject); } return; } } }
private void ShowNextTrainingMessage() { TrainingHandler handler = MonobehaviorHandler.GetMonobeharior().GetObject <TrainingHandler>("TrainingHandler"); handler.ShowNext(); }
public void OnMouseDown() { if (_window.Hide()) { if (_window.ShowNextAfterClick()) { _handler.ShowNext(); } else { Time.timeScale = 1; } } }
public void ActivateDrop(UnknownDrop drop) { if (!_droppedBonuses.Contains(drop)) { return; } ActivateBonus(drop.Bonus); foreach (var droppedBonus in _droppedBonuses) { Destroy(droppedBonus.gameObject); } _droppedBonuses.Clear(); if (_isDropListenerActivated) { TrainingHandler handler = MonobehaviorHandler.GetMonobeharior().GetObject <TrainingHandler>("TrainingHandler"); handler.ShowNext(); _isDropListenerActivated = false; } }
public void DropBonus(IBonus bonus, Vector3 coords) { if (_droppedBonuses == null) { _droppedBonuses = new List <UnknownDrop>(); } coords.z = -5; GameObject instantiatedDrop = GameObject.Instantiate(_unknownDropPrefab, coords, Quaternion.identity) as GameObject; if (_isDropListenerActivated) { TrainingHandler handler = MonobehaviorHandler.GetMonobeharior().GetObject <TrainingHandler>("TrainingHandler"); handler.ShowNext(); _isDropListenerActivated = false; } if (instantiatedDrop != null) { UnknownDrop newDrop = instantiatedDrop.GetComponent <UnknownDrop>(); newDrop.InitWithBonus(bonus); _droppedBonuses.Add(newDrop); } }
public virtual void AddDamage(MovableCharacterSM attacker) { AttackedStartTime = Time.time; ActivateState((int)MovableCharacterStates.Attacked); if (attacker.AttackStrength < 0) { MonobehaviorHandler.GetMonobeharior().GetObject <AudioPlayer>("AudioPlayer").PlayAudioById("heal"); } if (attacker.AttackStrength < 0 && Hp >= InitialLifes) { Hp = InitialLifes; return; } if (attacker.AttackStrength > 0) { MonobehaviorHandler.GetMonobeharior().GetObject <AudioPlayer>("AudioPlayer").PlayAudioById("lowkick"); } float currentStrength = attacker.AttackStrength * Randomizer.GetNormalizedRandom(); AttackTarget = attacker; AddDamageValue(currentStrength); if (_isHalfImmortal) { if (Hp < InitialLifes / 2) { Hp = InitialLifes / 2; } } if (IsAttackListenerActivated) { TrainingHandler handler = MonobehaviorHandler.GetMonobeharior().GetObject <TrainingHandler>("TrainingHandler"); handler.SetAttackedPassenger(this); handler.ShowNext(); IsAttackListenerActivated = false; } }