Exemplo n.º 1
0
    public void Init(PlantScriptableObj plantScript, Vector2Int plantGridPos)
    {
        m_GrowthTime        = plantScript.m_GrowthTime;
        m_PlantTime         = plantScript.m_PlantTime;
        m_TemperatureToGrow = plantScript.m_TemperatureToGrow;
        m_CurrentHealth     = plantScript.m_PlantHealth;

        m_PlantGridPos = plantGridPos;

        m_PlantType = plantScript.m_PlantType;

        //set sprite stuff
        m_SpriteRenderer.sprite       = plantScript.m_PlantSprite;
        m_SpriteRenderer.color        = Color.white;
        m_SpriteRenderer.sortingOrder = (int)(transform.position.y * -100);

        m_Dead = false;
        if (m_Animator != null)
        {
            m_Animator.ResetTrigger("Shaking");
            m_Animator.ResetTrigger("Dying");
        }

        Temperature temperature = GameStats.Instance.m_Temperature;

        if (temperature != null)
        {
            CheckTemperatureUpdate(temperature.m_CurrTempType);
        }
    }
Exemplo n.º 2
0
    public void Init()
    {
        PlantScriptableObj plantData = MapManager.Instance.GetPlantDataBase().GetPlantData(m_PlantType);

        if (plantData == null)
        {
            return;
        }

        m_Price     = plantData.m_Price;
        m_PlantType = plantData.m_PlantType;

        m_PlantNameText.text       = plantData.m_PlantName;
        m_PlantDesriptionText.text = plantData.m_PlantDescription;

        switch (plantData.m_TemperatureToGrow)
        {
        case TemperatureType.EXTREMELY_HOT:
            m_TemperatureToGrowText.text = "Can survive all temperatures";
            break;

        case TemperatureType.VERY_HOT:
            m_TemperatureToGrowText.text = "Survive Scorch and below";
            break;

        case TemperatureType.HOT:
            m_TemperatureToGrowText.text = "Survive hot and below";
            break;

        case TemperatureType.NICE:
            m_TemperatureToGrowText.text = "Survive only nice temperature";
            break;
        }

        m_PlantPrice.text    = "Price: $" + m_Price.ToString() + " per seed";
        m_MaxPlant           = plantData.m_MaxNumberToPlant;
        m_SpriteImage.sprite = plantData.m_PlantSprite;
    }