Example #1
0
    public bool RunFixAction()
    {
        Vector2 fixLocation;

        if (actions.Count > 0)
        {
            if (actions[0].GetActionType() == UnitAction.ActionType.FIX)
            {
                actionTimer += Time.deltaTime;
                fixLocation  = actions[0].GetActionTarget();

                if (actionTimer >= ACTION_TIME)
                {
                    if (Random.value < GetFixChance(fixLocation))
                    {
                        SkillStorage.AddUpgradePoint();
                        TileManager.Instance.ClearDisaster(actions[0].GetActionTarget());
                    }
                    else
                    {
                        SoundSystem.Instance.PlaySound(SoundEvents.DisasterRepairFailure);
                    }
                    Debug.Log("Attempted fix at " + Time.time);
                    actionTimer = 0f;
                    actions.RemoveAt(0);

                    return(true);
                }

                return(false);
            }
        }

        return(true);
    }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        remainingPoints.text = SkillStorage.GetRemainingPoints().ToString();

        if (Input.GetKeyDown(KeyCode.Space))
        {
            SkillStorage.AddUpgradePoint();
        }
    }