Exemplo n.º 1
0
    private void OnEnable()
    {
        btnImage = GetComponent <Image>();
        if (fuzeActionOptions == null)
        {
            Debug.LogWarning("Fuze Button is missing fuze Options", gameObject);
        }
        else
        {
            fuzeActionOptionsList = fuzeActionOptions.GetActionSequence();
            if (fuzeActionOptionsList.Length <= 0)
            {
                Debug.LogWarning("Fuze Options in Button are empty.", gameObject);
            }
            else
            {
                currOptionIndex = ((int)(Random.value * 100)) % fuzeActionOptionsList.Length;

                if (!fuzeActionOptionsList[currOptionIndex].GetType().Equals(typeof(FuzeAction)))
                {
                    Debug.LogWarning($"Fuze Options contians Element that isn't a Fuze Action. At Index {currOptionIndex}", gameObject);
                }
                else
                {
                    currentFuzeAction = (FuzeAction)fuzeActionOptionsList[currOptionIndex];
                    btnImage.sprite   = currentFuzeAction.GetFuzeImage();
                }
            }
        }
    }
Exemplo n.º 2
0
    bool CheckCorrectSequence()
    {
        FuzeboxActionList combinedPlayerSequence = GetCombinedPlayerSequence();

        if (combinedPlayerSequence.Length < correctSequenceList.Length)
        {
            Debug.Log("Player input Sequence too short.");
            return(false);
        }

        #region Debug Test
        //Debug.Log($"Correct Sequence: {correctSequenceList.ToString()}");
        //foreach(FuzeboxAction action in correctSequenceList)
        //{
        //    Debug.Log(action.GetValue());
        //}

        //Debug.Log($"Input Sequence: {combinedPlayerSequence.ToString()}");
        //foreach (FuzeboxAction action in combinedPlayerSequence)
        //{
        //    Debug.Log(action.GetValue());
        //}
        #endregion

        for (int i = 0; i < correctSequenceList.Length; i++)
        {
            if (!correctSequenceList[i].Equals(combinedPlayerSequence[i]))
            {
                return(false);
            }
        }
        return(true);
    }
Exemplo n.º 3
0
    FuzeboxActionList GetCombinedPlayerSequence()
    {
        FuzeboxActionList combinedSequences = new FuzeboxActionList();

        foreach (FuzeboxActionManager fam in actionManagers)
        {
            FuzeboxActionList fal = fam.GetActionsSequenceList();
            if (fal == null)
            {
                throw new System.Exception($"Empty list in {fam}.");
            }

            foreach (FuzeboxAction fa in fam.GetActionsSequenceList())
            {
                combinedSequences.Add(fa);
            }
        }
        return(combinedSequences);
    }
Exemplo n.º 4
0
    public FuzeboxActionList GetFuzeList()
    {
        FuzeboxActionList selectedFuzes = new FuzeboxActionList();

        if (fuzeSlots.Length <= 0)
        {
            throw new System.Exception("FuzeManager is missing Fuze Slots.");
        }

        foreach (FuzeActionButton fuzeSlot in fuzeSlots)
        {
            selectedFuzes.Add(fuzeSlot.GetSelectedFuze());
        }

        if (selectedFuzes.Length <= 0)
        {
            throw new System.Exception("FuzeSlots of FuzeManager are missing selected Fuzes.");
        }


        return(selectedFuzes);
    }
Exemplo n.º 5
0
 void loadCorrectSequence()
 {
     correctSequenceList = correctActionSequence.GetActionSequence();
 }