// Start is called before the first frame update
 void Start()
 {
     rb2D        = this.gameObject.GetComponent <Rigidbody2D>();
     uiControl   = GameObject.Find("Canvas").GetComponent <UIControllerScript>();
     myAudio     = this.gameObject.GetComponent <AudioSource>();
     towerScript = FindObjectOfType <Tower>();
 }
示例#2
0
    // Start is called before the first frame update
    void Start()
    {
        //lerpDuration is the time in seconds for movement
        lerpDuration = 1f / unitsPerSecond;

        //We set aVector and bVector to your initial position
        aVector = transform.position;
        bVector = aVector;


        //We cache the initial position
        initialPosition = transform.position;

        //We create the four detectorcubes
        dcmap.Add(Vector2.up, Instantiate(detectorCube));
        dcmap.Add(Vector2.down, Instantiate(detectorCube));
        dcmap.Add(Vector2.left, Instantiate(detectorCube));
        dcmap.Add(Vector2.right, Instantiate(detectorCube));

        uiController = uiPrefab.GetComponent <UIControllerScript>();

        foreach (var item in dcmap)
        {
            //Set each detectorcube to the corresponding direction
            item.Value.transform.position = transform.position + new Vector3(item.Key.x, 0, item.Key.y);

            //Toggle the collider so we reset the collision logic
            item.Value.GetComponent <Collider>().enabled = false;
            item.Value.GetComponent <Collider>().enabled = true;

            dcdcmap.Add(item.Key, item.Value.GetComponent <DetectorController>());
        }
    }
示例#3
0
 // Start is called before the first frame update
 void Start()
 {
     startPosition = this.transform.localPosition;
     rb2D          = this.gameObject.GetComponent <Rigidbody2D>();
     myAudio       = this.gameObject.GetComponent <AudioSource>();
     uiControl     = GameObject.Find("Canvas").GetComponent <UIControllerScript>();
 }
示例#4
0
 private void Start()
 {
     uiController = GetComponent <UIControllerScript>();
     Cash         = 10000;
     Food         = 6;
     JobsCeiling  = 10;
 }
示例#5
0
 // Start is called before the first frame update
 void Start()
 {
     rb2D          = this.gameObject.GetComponent <Rigidbody2D>();
     myAudio       = this.gameObject.GetComponent <AudioSource>();
     uiControl     = GameObject.Find("Canvas").GetComponent <UIControllerScript>();
     startPosition = GameObject.FindGameObjectWithTag("Player").transform.position;
 }
示例#6
0
    private void FillPlayerInventoryPanel()
    {
        //Get the player's inventory
        UIControllerScript uic            = otherCanvas.GetComponent <UIControllerScript>();
        List <Placeable>   inventoryData  = uic.getInventoryData();
        List <int>         inventoryCount = uic.getInventoryCount();

        //Get the panel to add to
        RectTransform pip = GameObject.Find("playerInventoryPanel").GetComponent <RectTransform>();

        for (int ii = 0; ii < fpc.inventorySize; ii++)
        {
            //Add item to player inventory rect
            //Build the slot regardless of whether or not it will be empty
            GameObject slotObject = Instantiate(playerInventorySlotPrefab, pip);
            MenuSlot   slot       = slotObject.GetComponent <MenuSlot>();
            slot.slotIndex = ii;

            //Add an item to the slot if it shouldn't be empty
            if (inventoryData[ii] != null && inventoryCount[ii] > 0)
            {
                //Add the slot item to the slot
                GameObject   itemObject = Instantiate(slotItemPrefab, slot.GetComponent <RectTransform>());
                MenuSlotItem item       = itemObject.GetComponent <MenuSlotItem>();
                item.setID(inventoryData[ii].id, inventoryData[ii].isFlower);
                item.setCount(inventoryCount[ii]);

                slot.GetComponent <MenuSlot>().setItem(item);
            }
        }
    }
示例#7
0
 // Use this for initialization
 void Start()
 {
     pooler           = GameObject.FindObjectOfType <ObjectPoolerScript>();
     playerCtrl       = FindObjectOfType <PlayerControllerScript>();
     uiCtrl           = FindObjectOfType <UIControllerScript>();
     spawnedEnemyList = new List <EnemyControllerScript>();
     earnedCurrency   = 200f;
 }
示例#8
0
 // Start is called before the first frame update
 void Start()
 {
     rb2D          = this.gameObject.GetComponent <Rigidbody2D>();
     myAudio       = this.gameObject.GetComponent <AudioSource>();
     startPosition = this.transform.position;
     closestTower  = null;
     uiControl     = GameObject.Find("Canvas").GetComponent <UIControllerScript>();
 }
示例#9
0
 // Start is called before the first frame update
 void Start()
 {
     tower         = GameObject.Find("Tower").GetComponent <Tower>();
     rigidbody2D   = this.gameObject.GetComponent <Rigidbody2D>();
     myAudio       = this.gameObject.GetComponent <AudioSource>();
     uiController  = GameObject.Find("Canvas").GetComponent <UIControllerScript>();
     startPosition = new Vector2(this.gameObject.transform.position.x, this.gameObject.transform.position.y);
 }
示例#10
0
 private void Start()
 {
     rb2D          = GetComponent <Rigidbody2D>();
     UIControl     = UICanvas.GetComponent <UIControllerScript>();
     myAudio       = GetComponent <AudioSource>();
     startPosition = transform.position;
     startRotation = transform.rotation;
 }
示例#11
0
 //private bool _gameOver = false;
 // Start is called before the first frame update
 void Start()
 {
     health = 3;
     heart1.gameObject.SetActive(true);
     heart2.gameObject.SetActive(true);
     heart3.gameObject.SetActive(true);
     uiControl = GameObject.Find("Canvas").GetComponent <UIControllerScript>();
     //_gameOver = false;
 }
    void Start()
    {
        playerRb   = this.gameObject.GetComponent <Rigidbody2D>();
        uiControl  = GameObject.Find("Canvas").GetComponent <UIControllerScript>();
        crashAudio = this.gameObject.GetComponent <AudioSource>();

        startPosition  = this.transform.position;
        Time.timeScale = 1;
    }
示例#13
0
 // Start is called before the first frame update
 void Start()
 {
     //move the object
     startPosition = transform.position;
     startRotation = transform.rotation;
     rb2d          = this.gameObject.GetComponent <Rigidbody2D> ();
     uIController  = GameObject.Find("Canvas").GetComponent <UIControllerScript> ();
     myAudio       = this.gameObject.GetComponent <AudioSource> ();
 }
    void Start()
    {
        GUIController = GameObject.Find("_GUIController");
        UIController  = (UIControllerScript)GUIController.GetComponent(typeof(UIControllerScript));
        //UIController.PuppetControllerAlphaAmount = GUIDataManager.guiData.controllerAlphaAmountValue;
        //Debug.Log(UIController.name);
        //puppetControllerVisibity
        //puppetControllerAlphaAmount

        //c.OnVariableChange += VariableChangeHandler;
    }
 // Start is called before the first frame update
 void Start()
 {
     mainCamera    = Camera.main;
     uIControllerS = UIController.GetComponent <UIControllerScript>();
     regexList     = new Regex[regexFilters.Length];
     for (int i = 0; i < regexFilters.Length; i++)
     {
         regexList[i] = new Regex(regexFilters[i]);
     }
     isOnOnlinePlanet = SceneManager.GetActiveScene() == SceneManager.GetSceneByName("onlinePlanet");
 }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }
示例#17
0
    private void Start()
    {
        rb2D      = gameObject.GetComponent <Rigidbody2D>();
        myAudio   = gameObject.GetComponent <AudioSource>();
        uiControl = GameObject.Find("Canvas").GetComponent <UIControllerScript>();

        startPosition = transform.position;

        colorHookedTower  = new Color32(240, 150, 40, 255);
        colorClosestTower = new Color32(255, 220, 60, 255);

        isCrashed      = false;
        isLevelCleared = false;
        Time.timeScale = 1f;
    }
    //First called when the user wants to go to a different planet
    public void goToPlanet(int planetID)
    {
        //Check to see if there is a fade overlay
        if (fadeOverlay == null)
        {
            fadeOverlay = GameObject.Find("fadeOverlay");
        }

        //Set the destination to the given planet id
        targetPlanetID = planetID;
        WorldManager.currentPlanetID = planetID;

        if (planetID != Galaxy.ONLINE_PLANET_ID)
        {
            //Tell the planet that it has been visited
            Galaxy.instance.planetList[planetID].setVisited(true);

            if (Galaxy.instance.planetList[planetID].getType() == Planet.PlanetType.COLD)
            {
                Galaxy.instance.coldPlanetVisited = true;
            }
            if (Galaxy.instance.planetList[planetID].getType() == Planet.PlanetType.HOT)
            {
                Galaxy.instance.hotPlanetVisited = true;
            }
            if (Galaxy.instance.planetList[planetID].getType() == Planet.PlanetType.NEON)
            {
                Galaxy.instance.neonPlanetVisited = true;
            }
        }

        //Tell LateUpdate() that the game is "loading"
        isLoading = true;

        //Get the ui controller
        uic = GameObject.Find("UICanvas").GetComponent <UIControllerScript>();
        if (uic.currentQuestId == 18)
        {
            if (GetDestinationPlanet().getType() == Planet.PlanetType.HOT)
            {
                uic.completeQuest();
            }
        }
        uic.hideQuestPanel();


        engageWarpDrive();
    }
示例#19
0
 // Use this for initialization
 void Awake()
 {
     Time.timeScale = 1.0f;
     if (debug)
     {
         scenario = GameObject.Find("Remove").transform.GetChild(0).gameObject;
     }
     else
     {
         GameObject.Find("Remove").SetActive(false);
         scenario = Instantiate(Resources.Load("Scenarios/" + StaticData.scenario)) as GameObject;
         putTanks("Players", "Player", true);
     }
     playersCount = players.Count;
     putTanks("Bots", "Bot", false);
     botsCount = players.Count;
     uics      = GetComponent <UIControllerScript> ();
 }
    void Start()
    {
        uiScript = FindObjectOfType <UIControllerScript>();
        for (int i = 0; i < Birds.Count; i++)
        {
            Birds[i].OnBirdDestroyed += ChangeBird;
            Birds[i].OnBirdShot      += AssignTrail;
        }

        for (int i = 0; i < Enemies.Count; i++)
        {
            Enemies[i].OnEnemyDestroyed += CheckGameEnd;
        }

        TapCollider.enabled = false;
        SlingShooter.InitiateBird(Birds[0]);
        _shotBird = Birds[0];
    }
示例#21
0
 // Use this for initialization
 void Awake()
 {
     if (debug)
     {
         map = GameObject.Find("Remove").transform.GetChild(0).gameObject;
     }
     else
     {
         GameObject.Find("Remove").SetActive(false);
         map = Instantiate(Resources.Load("Levels/" + StaticData.level)) as GameObject;
     }
     time   = StaticData.time;
     player = GameObject.FindGameObjectWithTag("Player");
     player.transform.position = map.transform.Find("Skeleton/InitialPoint").transform.position;
     uics = GetComponent <UIControllerScript> ();
     uics.Setup();
     Time.timeScale = 1.0f;
 }
示例#22
0
 public static void AutenticaUsuario(string login, string senha)
 {
     Debug.Log("Verificando dados...");
     UpdateId();
     for (int i = 0; i <= id; i++)
     {
         if (login == PlayerPrefs.GetString("usuarioLogin" + i) && senha
             == PlayerPrefs.GetString("usuarioSenha" + i))
         {
             UIControllerScript.AutenticaOK();
             Debug.Log("Usuario Autenticado");
             break;
         }
         else
         {
             Debug.Log("Login ou senha inválidos");
         }
     }
 }
    public void setJetpackLevel(int level)
    {
        jetpackLevel = level;
        Galaxy.instance.unlockPlanetByJetpackLevel();
        GameObject canvasObject = GameObject.Find("UICanvas");

        uic = null;
        if (canvasObject != null)
        {
            uic = canvasObject.GetComponent <UIControllerScript>();
        }

        if (uic != null)
        {
            if (uic.currentQuestId == 17)
            {
                if (level > 0)
                {
                    uic.completeQuest();
                }
            }
        }
    }
示例#24
0
    /// <summary>
    /// Syncs the player inventory with the flowers in the player inventory home base panel
    /// </summary>
    private void PlayerInventorySync()
    {
        FlowerProperties   fp  = GameObject.Find("World").GetComponent <FlowerProperties>();
        UIControllerScript uic = otherCanvas.GetComponent <UIControllerScript>();

        //Now fill the other canvas and the UI inventory with the right items
        //Loop through the entire inventory
        for (int ii = 0; ii < fpc.inventorySize; ii++)
        {
            MenuSlot  hInventoryItem      = playerInventoryContainer.GetChild(ii).GetComponent <MenuSlot>();
            Placeable slotPlaceable       = uic.getInventoryDataAtSlot(ii);
            uint      currentSlotID       = 0;
            bool      currentSlotIsFlower = false;
            if (slotPlaceable != null)
            {
                currentSlotID       = slotPlaceable.id;
                currentSlotIsFlower = slotPlaceable.isFlower;
            }

            //If there's an item in the home base player inventory
            if (hInventoryItem.getItem() != null)
            {
                uic.inventoryClearSlot(ii);

                GameObject newObj;
                //Create a placeable based on the slot's id
                if (hInventoryItem.getItem().isFlower)
                {
                    //Make a flower
                    newObj = Instantiate(Resources.Load("Prefabs/FlowerPrefab", typeof(GameObject)) as GameObject);
                    FlowerObj p = newObj.GetComponent <FlowerObj>();
                    p.id = hInventoryItem.getItem().id;

                    int[] petal = new int[2] {
                        fp.getPetalIndexFromIndex(p.id), fp.getPetalColorIndexFromIndex(p.id)
                    };
                    int[] pistil = new int[2] {
                        fp.getPistilIndexFromIndex(p.id), fp.getPistilColorIndexFromIndex(p.id)
                    };
                    int[] leaf = new int[2] {
                        fp.getLeafIndexFromIndex(p.id), fp.getLeafColorIndexFromIndex(p.id)
                    };
                    int[] stem = new int[2] {
                        fp.getStemIndexFromIndex(p.id), fp.getStemColorIndexFromIndex(p.id)
                    };
                    int[] position = new int[2] {
                        -1, -1
                    };

                    p.init(petal, stem, pistil, leaf, position, transform.root);
                    p.alive = true;

                    uic.setSlot(ii, p);
                    uic.setSlotCount(ii, hInventoryItem.getItem().count);
                    Destroy(newObj);
                }
                else
                {
                    //Make a decoration
                    newObj = Instantiate(fp.getDecorationObject(hInventoryItem.getItem().id));
                    Placeable p = newObj.GetComponent <Placeable>();
                    p.id            = hInventoryItem.getItem().id;
                    p.isFlower      = hInventoryItem.getItem().isFlower;
                    p.flowerGridPos = new int[2] {
                        -1, -1
                    };
                    uic.setSlot(ii, p);
                    uic.setSlotCount(ii, hInventoryItem.getItem().count);
                    Destroy(newObj);
                }
            }
            else //If there's not an item in the home base player inventory slot
            {
                //Check to see if the player has an item in the inventory slot
                if (uic.getInventoryDataAtSlot(ii) != null)
                {
                    //The player had an item in the slot but moved it to the home base
                    //So clear the slot
                    uic.inventoryClearSlot(ii);
                }
            }
        }
    }
示例#25
0
 private void Start()
 {
     Instance = this;
 }
示例#26
0
    void OnEnable()
    {
        UIControllerScript gui = _GUIController.GetComponent <UIControllerScript>();

        gui.displayPuppetNameAndControlType(myName, controllerType, displayTime, fontSize);
    }
示例#27
0
 // Start is called before the first frame update
 void Start()
 {
     text = gameObject.GetComponent <Text>();
     uiControllerScript = uiControllerObject.GetComponent <UIControllerScript>();
 }