Example #1
0
    /// <summary>
    /// Set the settings and enable the corresponding hat gameobject and
    /// </summary>
    /// <param name="settings"></param>
    public void SetSettings(MoleSettings settings)
    {
        if (m_settings.moleType != settings.moleType)
        {
            if (m_settings.moleType != MoleType.NORMAL)
            {
                transform.GetChild(1).GetChild(1).GetChild((int)m_settings.moleType - 1).gameObject.SetActive(false);
            }
            if (settings.moleType != MoleType.NORMAL)
            {
                transform.GetChild(1).GetChild(1).GetChild((int)settings.moleType - 1).gameObject.SetActive(true);
            }

            m_settings = settings;
            m_score    = m_settings.score;

            if (Random.Range(0.0f, 1.0f) <= m_settings.shinyProbability)
            {
                m_isShiny = true;
                transform.GetChild(1).GetChild(0).GetComponent <MeshRenderer>().material = m_shinyMaterial;
                m_score = (int)(m_score * GameSettings.shinyMultiplier);
            }
            else
            {
                m_isShiny = false;
                transform.GetChild(1).GetChild(0).GetComponent <MeshRenderer>().material = m_normalMaterial;
            }
        }
    }
Example #2
0
    /// <summary>
    /// Initialize this mole
    /// </summary>
    /// <param name="id"></param>
    /// <param name="onHide">Delegate to call when this mole is hidding</param>
    /// <param name="defaultSettings">default mole settings</param>
    public void Initialize(byte id, Communication onHide, MoleSettings defaultSettings, List <MoleSettings> moleSettings, List <int> settingsProbabilities, Vector3 hammerPosition)
    {
        ID     = id;
        OnHide = onHide;
        SetSettings(GetRandomSettings(moleSettings, settingsProbabilities));
        ResetTimerToHide();
        m_isHidden = true;

        m_moleInput = new ANN_MoleInput(m_isShiny, m_isHidden, Vector3.Distance(hammerPosition, m_position), m_settings.moleType);
    }