private void Awake()
    {
        s_singleton = this;

        XperItem[]   items = Enum.GetValues(typeof(XperItem)) as XperItem[];
        XperAction[] types = Enum.GetValues(typeof(XperAction)) as XperAction[];

        List <XperAction> flagedTypes = new List <XperAction>();

        foreach (XperItem item in items)
        {
            flagedTypes.Clear();

            foreach (XperAction type in types)
            {
                XperAction tmp     = AttributionsOf(item);
                bool       hasFlag = (((int)tmp == -1) || ((tmp & type) > 0));
                if (hasFlag)
                {
                    flagedTypes.Add(type);
                }
            }

            if (flagedTypes.Count > 0)
            {
                m_xperFirstIntroduced.Add(item, flagedTypes[UnityEngine.Random.Range(0, flagedTypes.Count)]);
            }
        }
    }
Beispiel #2
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        XperManager xperManager = target as XperManager;


        XperItem[] items = Enum.GetValues(typeof(XperItem)) as XperItem[];

        m_showActionFields.target = EditorGUILayout.ToggleLeft("Actions", m_showActionFields.target);

        if (EditorGUILayout.BeginFadeGroup(m_showActionFields.faded))
        {
            foreach (XperItem item in items)
            {
                xperManager.SetAttributionsOf(item, (XperAction)EditorGUILayout.EnumMaskField(item.ToString(), xperManager.AttributionsOf(item)));
            }
        }

        EditorGUILayout.EndFadeGroup();
        EditorGUILayout.Separator();

        m_showRangeFields.target = EditorGUILayout.ToggleLeft("Portées", m_showRangeFields.target);

        if (EditorGUILayout.BeginFadeGroup(m_showRangeFields.faded))
        {
            foreach (XperItem item in items)
            {
                xperManager.SetRangeModeOf(item, (XperRange)EditorGUILayout.EnumMaskField(item.ToString(), xperManager.RangeModeOf(item)));
            }
        }

        EditorGUILayout.EndFadeGroup();
    }
Beispiel #3
0
    private IEnumerator FailCoroutine(FailCondition failCondition)
    {
        Debug.Log("FAIL : " + failCondition.failType);

        if (failCondition.failureIncludesExplosion)
        {
            m_explosionAudioSource.transform.position = failCondition.failurePosition;
            m_explosionAudioSource.Play();

            m_explosionParticuleSystem.transform.position = failCondition.failurePosition;
            m_explosionParticuleSystem.Play();

            if (failCondition.failType == FailCondition.FailType.EthoxyethaneExplosion)
            {
                m_ethoxyethaneMeshExplosion.Explode(failCondition.failurePosition);
            }

            yield return(new WaitForSeconds(m_explosionAudioSource.clip.length + 0.25f));
        }

        if (failCondition.failType == FailCondition.FailType.BrokenGlass)
        {
            yield return(new WaitForSeconds(2));
        }

        Instructor.PlayFailSound();

        yield return(new WaitForSeconds(2));

        XperManager.SaveEntries();
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
    }
 protected void ReportInteraction()
 {
     if (!m_interactionDown)
     {
         return;
     }
     XperManager.AddEntry(new XperEntry(m_interactionActionType, m_interactionRange, m_itemType));
 }
Beispiel #5
0
 public XperEntry(XperAction type, XperRange range, XperItem item)
 {
     m_type            = type;
     m_item            = item;
     m_range           = range;
     m_timeOfEntry     = Time.time;
     m_introducedFirst = XperManager.FirstInteractionIntroduced(item);
     m_height          = StageManager.stageHeight;
 }
 private bool CheckWandAction(ViveWand wand, XperAction action, XperRange range)
 {
     return(wand.IsInteractionPressed(action) && XperManager.Allows(m_itemType, action, range));
 }