示例#1
0
 // Use this for initialization
 void Start()
 {
     instance  = this;
     meter     = gameObject;
     happiness = 0;
     init();
 }
示例#2
0
    void Awake()
    {
        backgroundSprites = IconController.GetAllHexBackgrounds();
        player = FindObjectOfType<Player>();
        turnTimer = FindObjectOfType<TurnTimer>();
        iconControl = FindObjectOfType<IconController>();
        hud = GetComponentInChildren<HexHUD>();
        Sprites = GetComponentsInChildren<SpriteRenderer>();
        happyMeter = GetComponentInChildren<HappinessMeter>();
        hudItems = GetComponentsInChildren<HexHudItem>();

        Main = FindObjectOfType<Camera>();
        Transform parentTransform = FindObjectOfType<MapController>().transform;
        transform.SetParent(parentTransform);

        if(!restrictionsPanel){
            restrictionsPanel = GetComponentInChildren<HexRestrictions>();
        }

        EnableHex();

        Sprites[0].material.color = new Color32(140, 140 , 140, 220);
        Sprites[1].color = SetTempColors();
        Sprites[2].sprite = SetBiomeSprite();

        localPlantFood = DefineMaxPlantFood();
        insectFood = DefineMaxInsectFood();
        fishFood = DefineMaxFishFood();
        meatHealth = .99f;

        if(localType == BiomeType.SALTWATER){
            fishFood *= 2;
        }
        else if(localType == BiomeType.FRESHWATER)
        {
            fishFood *= 1.5f;
        }

        CalculateFishHealth();
        CalculateInsectHealth();
        GrowFood();
        meatHealth = CalculateMeatHealth();
        CalculateWasteFood(previousExcessMeatFood);

        //print ("Hex# " + number + "  - Plants: " + localPlantFood + "  - Insects: " + insectFood + "  - Fish: " + fishFood + "\r\n");
    }