예제 #1
0
    //private Plant _adjacentPlant; // I think the bean multipler will be done in a different script

    public void Start()
    {
        var _raycastFerTile = Physics2D.Raycast(transform.position + new Vector3(0.5f, 0.5f), Vector2.zero, 1, 1 << LayerMask.NameToLayer("Fertile"));

        if (_raycastFerTile.collider == null)
        {
            Debug.LogError("No Fertile found below plant");
            return;
        }

        //Debug.Log(_raycastFerTile.transform.GetComponent<Fertile>());
        _occupiedTile = _raycastFerTile.transform.GetComponent <Fertile>();
        _occupiedTile.toggleCropRotation();
        _occupiedTile.setCurrentCrop(this);

        SetFertileFertilityModifier(_occupiedTile);

        FindObjectOfType <PlantManager>().AddPlant(this);
    }
예제 #2
0
    public void TakePopulationDamage(int damage)
    {
        Debug.Log("TakingDamage");
        population -= damage;
        CivWorld.SetActive(false);
        ThrivingWorld.SetActive(false);
        Fertile.SetActive(false);
        Broken.SetActive(false);
        Bad.SetActive(false);
        Apocalyptic.SetActive(false);

        if (population > 2000)
        {
            CivWorld.SetActive(true);
        }
        if (population > 1500)
        {
            ThrivingWorld.SetActive(true);
        }
        if (population > 1200)
        {
            Fertile.SetActive(true);
        }
        if (population > 900)
        {
            Broken.SetActive(true);
        }
        if (population > 600)
        {
            Bad.SetActive(true);
        }
        if (population > 0)
        {
            Apocalyptic.SetActive(true);
        }

        if (population < 0)
        {
            GameOver();
        }
    }
예제 #3
0
    //private void beanMaizeMultiplyer() //the bean maize phenomenon
    //{
    //    if (this.name.Equals("Bean")){
    //        //left
    //        var _raycastMaize = Physics2D.Raycast(transform.position+transform.right *-0.5f, Vector2.zero);
    //        if (_raycastMaize.collider != null)
    //        {
    //            _adjacentPlant = _raycastMaize.transform.GetComponent<Plant>();
    //        }
    //        //right
    //        _raycastMaize = Physics2D.Raycast(transform.position + transform.right * 1.5f, Vector2.zero);
    //        if (_raycastMaize.collider != null)
    //        {
    //            _adjacentPlant = _raycastMaize.transform.GetComponent<Plant>();
    //        }
    //        if (_adjacentPlant.name.Equals("Maize"))
    //        {
    //            _fertilityModifier += 0.25f;
    //        }
    //    }
    //}

    private void SetFertileFertilityModifier(Fertile _ferTile)
    {
        _fertilityModifier = _ferTile.getFertilityModifier();
    }