Ejemplo n.º 1
0
 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;
     }
 }
Ejemplo n.º 2
0
 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;
         }
     }
 }
Ejemplo n.º 3
0
    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;
         }
     }
 }
Ejemplo n.º 5
0
 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;
     }
 }
Ejemplo n.º 6
0
    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);
        }
    }
Ejemplo n.º 7
0
    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;
        }
    }