Beispiel #1
0
        public override void TrackThumbStickAxis(Vector2 axis)
        {
            if (axis.x >= _turnAxisAmount && _lastTurnDirection == WrenchDirection.Left)
            {
                _lastTurnDirection = WrenchDirection.Right;
                HoldingPlayer.ToolBubble.ShowThumbLeft();

                _turnEffectTrigger.Trigger();
            }
            else if (axis.x <= -_turnAxisAmount && _lastTurnDirection == WrenchDirection.Right)
            {
                _lastTurnDirection = WrenchDirection.Left;
                HoldingPlayer.ToolBubble.ShowThumbRight();

                _turnEffectTrigger.Trigger();

                _successfulTurns++;
            }

            if (_successfulTurns >= GameManager.Instance.GameGameData.WrenchSuccessfulTurns)
            {
                if (!RepairPoint.IsRepaired)
                {
                    RepairPoint.Repair();
                }
            }
        }
Beispiel #2
0
        public virtual bool SetRepairPoint(RepairPoint repairPoint)
        {
            if (repairPoint == RepairPoint)
            {
                return(true);
            }

            if (null != RepairPoint)
            {
                RepairPoint.RepairedEvent -= RepairPointRepairedEventHandler;
            }

            _repairPoint = repairPoint;

            if (null != RepairPoint)
            {
                _repairPoint.RepairedEvent += RepairPointRepairedEventHandler;

                if (HoldingPlayer.CanUseTool)
                {
                    ShowBubble();
                }
            }
            else
            {
                HoldingPlayer.ToolBubble.Hide();
            }

            return(true);
        }
Beispiel #3
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (rPoint != null)
     {
         fsm.ChangeState(RepairStates.Idle);
         rPoint = null;
     }
 }
Beispiel #4
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        rPoint = collision.gameObject.GetComponent <RepairPoint>();


        if (rPoint != null && !rPoint.isRepaired)
        {
            fsm.ChangeState(RepairStates.AbleRepair);
        }
    }
Beispiel #5
0
        public override bool SetRepairPoint(RepairPoint repairPoint)
        {
            if (!base.SetRepairPoint(repairPoint))
            {
                return(false);
            }

            _holdTimer.Stop();

            return(true);
        }
Beispiel #6
0
        public override bool SetRepairPoint(RepairPoint repairPoint)
        {
            if (!base.SetRepairPoint(repairPoint))
            {
                return(false);
            }

            _successfulTurns = 0;

            return(true);
        }
Beispiel #7
0
        protected override void Awake()
        {
            base.Awake();

            _holdTimer = TimeManager.Instance.AddTimer();
            _holdTimer.TimesUpEvent += (sender, args) => {
                if (!RepairPoint.IsRepaired)
                {
                    RepairPoint.Repair();
                }
            };
        }
Beispiel #8
0
    public void SetRepaired(RepairPoint repaired)
    {
        bool allRepaired = true;

        foreach (RepairPoint rp in repairPoints)
        {
            Debug.Log("repaired:" + rp + " " + rp.isRepaired, rp.gameObject);
            if (!rp.isRepaired)
            {
                allRepaired = false;
            }
        }
        if (allRepaired)
        {
            Debug.Log("Win");
            NextLevel.Instance.winCodition();
        }
    }
Beispiel #9
0
        protected override void OnUseToolEffectEnd()
        {
            base.OnUseToolEffectEnd();

            base.EndUse();

            HoldingPlayer.ToolBubble.ShowUnpressedButton();

            _succesfulHits++;
            if (_succesfulHits < GameManager.Instance.GameGameData.HammerSuccessfulHits)
            {
                return;
            }

            if (!RepairPoint.IsRepaired)
            {
                RepairPoint.Repair();
            }
        }
Beispiel #10
0
 public bool CanRepair(RepairPoint repairPoint)
 {
     return(null != repairPoint && !repairPoint.IsRepaired && repairPoint.CurrentDamageType == DamageType);
 }
Beispiel #11
0
 public void AddRepairPoint(RepairPoint p)
 {
     repairPoints.Add(p);
 }