Exemplo n.º 1
0
 void Start()
 {
     gameState = GameState.LEVELSTART;
     print("Switched to gameState " + gameState);
     levelStartActive = false;
     levelWonActive   = false;
     gameOver         = false;
     currentLevel     = 0;
     timerBehavior    = timer.GetComponent <TimerBehavior>();
     factoryBehavior  = GameObject.Find("Factory").GetComponent <FactoryBehavior>();
     worldManager     = GameObject.Find("GameManager").GetComponent <WorldManager>();
 }
Exemplo n.º 2
0
//	Necessary for Animation
//	Animator anim;
//
    void Start()
    {
        /*
         * A block of code to keep track of the resolution scales
         */
        print("Dimensions: " + Screen.width + ", " + Screen.height);
        print("Size of World Object: " + GameObject.Find("World").GetComponent <RectTransform>().sizeDelta);
        xResolutionScale = Screen.width / GameObject.Find("World").GetComponent <RectTransform>().lossyScale.x;
        yResolutionScale = Screen.height / GameObject.Find("World").GetComponent <RectTransform>().lossyScale.y;

        print("xResolutionScale: " + xResolutionScale);
        print("yResolutionScale: " + yResolutionScale);

//		anim = GetComponent<Animator>();
        carbonBoundRT = skyPanel.GetComponent <RectTransform>();
        carbonBoundRT = groundPanel.GetComponent <RectTransform>();
        SetState(this.carbonState);
        //factoryBoundMin.x = factoryPanel.transform.position.x - factoryPanel.GetComponent<RectTransform>().rect.width/2;
        //factoryBoundMin.y = factoryPanel.transform.position.y - factoryPanel.GetComponent<RectTransform>().rect.height/2;
        //factoryBoundMax.x = factoryPanel.transform.position.x + factoryPanel.GetComponent<RectTransform>().rect.width/2;
        //factoryBoundMax.y = factoryPanel.transform.position.y + factoryPanel.GetComponent<RectTransform>().rect.height/2;
        carbonGrabbed    = false;
        originalScale    = transform.localScale;
        originalLocation = transform.position;
        timeToComplete   = 5;
        factoryBehavior  = Factory.GetComponent <FactoryBehavior>();

        atmosphereSlots = new GameObject[skyPanel.transform.childCount];
        for (int i = 0; i < skyPanel.transform.childCount; i++)
        {
            atmosphereSlots[i] = skyPanel.transform.GetChild(i).gameObject;
        }

        undergroundSlots = new GameObject[groundPanel.transform.childCount];
        for (int i = 0; i < skyPanel.transform.childCount; i++)
        {
            undergroundSlots[i] = groundPanel.transform.GetChild(i).gameObject;
        }

        int rand = Random.Range(0, clouds.Length);

        transform.FindChild("AtmosphericCarbon").GetComponent <Image>().sprite = clouds[rand];
        transform.FindChild("UndergroundCarbon").GetComponent <Image>().sprite = coals[rand];

        if (this.carbonState == CarbonState.ATMOSPHERIC)
        {
            fillSlots("atmosphere");
        }
        if (this.carbonState == CarbonState.UNDERGROUND)
        {
            fillSlots("ground");
        }
    }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        factoryBehavior = Factory.GetComponent<FactoryBehavior>();

        atmosphericCarbonCount = 0f;
        undergroundCarbonCount = undergroundCarbonCapacity;

        isFlashing = false;
        redWarningFlash.color = new Color(0.87f, 0f, 0f, 0.0f);
        redWarningFlash.gameObject.SetActive(false);
        flashingRed = redWarningFlash.DOColor(new Color(.87f, 0f, 0f, 0.5f), 1.5f).SetLoops (-1, LoopType.Restart).SetEase (Ease.OutCubic);
        flashingRed.Pause();
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        factoryBehavior = Factory.GetComponent <FactoryBehavior>();

        atmosphericCarbonCount = 0f;
        undergroundCarbonCount = undergroundCarbonCapacity;

        isFlashing            = false;
        redWarningFlash.color = new Color(0.87f, 0f, 0f, 0.0f);
        redWarningFlash.gameObject.SetActive(false);
        flashingRed = redWarningFlash.DOColor(new Color(.87f, 0f, 0f, 0.5f), 1.5f).SetLoops(-1, LoopType.Restart).SetEase(Ease.OutCubic);
        flashingRed.Pause();
    }
Exemplo n.º 5
0
 void Start()
 {
     gameState = GameState.LEVELSTART;
     print("Switched to gameState " + gameState);
     levelStartActive = false;
     levelWonActive = false;
     gameOver = false;
     currentLevel = 0;
     timerBehavior = timer.GetComponent<TimerBehavior>();
     factoryBehavior = GameObject.Find("Factory").GetComponent<FactoryBehavior>();
     worldManager = GameObject.Find ("GameManager").GetComponent<WorldManager>();
 }
Exemplo n.º 6
0
    //    Necessary for Animation
    //    Animator anim;
    //
    void Start()
    {
        /*
         * A block of code to keep track of the resolution scales
         */
        print("Dimensions: " + Screen.width + ", " + Screen.height);
        print("Size of World Object: " + GameObject.Find ("World").GetComponent<RectTransform>().sizeDelta);
        xResolutionScale = Screen.width / GameObject.Find ("World").GetComponent<RectTransform>().lossyScale.x;
        yResolutionScale = Screen.height / GameObject.Find ("World").GetComponent<RectTransform>().lossyScale.y ;

        print("xResolutionScale: " + xResolutionScale);
        print("yResolutionScale: " + yResolutionScale);

        //		anim = GetComponent<Animator>();
        carbonBoundRT = skyPanel.GetComponent<RectTransform>();
        carbonBoundRT = groundPanel.GetComponent<RectTransform>();
        SetState(this.carbonState);
        //factoryBoundMin.x = factoryPanel.transform.position.x - factoryPanel.GetComponent<RectTransform>().rect.width/2;
        //factoryBoundMin.y = factoryPanel.transform.position.y - factoryPanel.GetComponent<RectTransform>().rect.height/2;
        //factoryBoundMax.x = factoryPanel.transform.position.x + factoryPanel.GetComponent<RectTransform>().rect.width/2;
        //factoryBoundMax.y = factoryPanel.transform.position.y + factoryPanel.GetComponent<RectTransform>().rect.height/2;
        carbonGrabbed = false;
        originalScale = transform.localScale;
        originalLocation = transform.position;
        timeToComplete = 5;
        factoryBehavior = Factory.GetComponent<FactoryBehavior>();

        atmosphereSlots = new GameObject[skyPanel.transform.childCount];
        for(int i = 0; i < skyPanel.transform.childCount; i++)
        {
            atmosphereSlots[i] = skyPanel.transform.GetChild(i).gameObject;
        }

        undergroundSlots = new GameObject[groundPanel.transform.childCount];
        for(int i = 0; i < skyPanel.transform.childCount; i++)
        {
            undergroundSlots[i] = groundPanel.transform.GetChild(i).gameObject;
        }

        int rand = Random.Range(0,clouds.Length);
        transform.FindChild("AtmosphericCarbon").GetComponent<Image>().sprite = clouds[rand];
        transform.FindChild("UndergroundCarbon").GetComponent<Image>().sprite = coals[rand];

        if (this.carbonState == CarbonState.ATMOSPHERIC){
            fillSlots("atmosphere");
        }
        if (this.carbonState == CarbonState.UNDERGROUND){
            fillSlots("ground");
        }
    }