상속: MonoBehaviour
    private void OnMouseDown()
    {
        GameObject   game         = transform.root.gameObject;
        GameBehavior gameBehavior = game.GetComponent <GameBehavior>();

        gameBehavior.OnTileRightClick(Coordinates);
    }
예제 #2
0
    //death animation function
    void Die()
    {
        dead = true;
        legAnimator.SetBool ("IsDead", true);
        torsoAnimator.SetBool ("IsDead", true);
        bothAnimator.SetBool ("dead", true);
        isShooting = false;
        Destroy (transform.GetComponent<BoxCollider2D> ());

        var player = GameObject.FindGameObjectWithTag("Player");
        player.GetComponent<Player> ().IncrementXp (experience);
        if(Random.Range(1,4) == 2){
            Instantiate( bulletBox[Random.Range(0,(bulletBox.Length))],transform.position,transform.rotation);
        }

        behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent<GameBehavior>();
        behave.incCoins (coinsWhenDie);
        behave.enemiesKilled++;

        if(Application.loadedLevelName == "HordeMode"){

            behave.currentHordeKills++;

        }
    }
예제 #3
0
    void Start()
    {
        behave = GameObject.FindGameObjectWithTag ("Behaviour").GetComponent<GameBehavior> ();
        player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();

        skillsInGame = GameObject.Find ("SkillsInGame").GetComponentsInChildren<Image> ();
        database = GetComponent<ItemDatabase> ();

        //		survivorImage = GameObject.FindGameObjectWithTag ("SkillSurvivor").GetComponent<Image> ();
        //		survivorAnimator = transform.GetComponent<Animator> ();

        for (int i = 0; i < behave.abilityIndex ; i++) {
            AddItem(behave.abilityIDs[i]);
        }

        if (behave.abilityIndex > 0) {
            int index = 0;
            foreach (Image image in skillsInGame) {
                if (image.name == "ImageSlot0" || image.name == "ImageSlot1" || image.name == "ImageSlot2") {
                    if(behave.abilityIndex > index){
                        image.GetComponentInChildren<Image>().sprite = skills[index].Sprite;

                            var x = image.GetComponentInChildren<Image>();
                            x.color = Color.white;
                        print (x.color.a);

                    }
                    index++;
                }
            }
        }
    }
예제 #4
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag.Equals("Arrow"))
     {
         GameBehavior.getInstance().audioController.playBalloonSound();
         int totalScore = GameBehavior.getInstance().maxScore;
         canvasController.ScaleUpScore(50, totalScore);
         int index = (int)(poolItems)System.Enum.Parse(typeof(poolItems), "BalloonBurstEffect" + transform.parent.name.Replace("Balloon", ""));
         collision.gameObject.GetComponent <Rigidbody>().velocity = Vector3.zero;
         GameBehavior.getInstance().IncrementScore(50);
         foreach (GameObject item in pool[index])
         {
             if (!item.activeInHierarchy)
             {
                 item.SetActive(true);
                 item.transform.position = Camera.main.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0)) + new Vector3(0, 0, 1f); //transform.parent.localPosition  + transform.forward*(-3f) + Vector3.up * 1f;
                 break;
             }
         }
         transform.GetComponent <Collider>().enabled = false;
         transform.GetComponentInChildren <MeshRenderer>().enabled           = false;
         collision.transform.GetComponent <Collider>().enabled               = false;
         collision.transform.GetComponentInChildren <MeshRenderer>().enabled = false;
         StartCoroutine(uiControlScript.Timer("50"));
     }
 }
예제 #5
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
예제 #6
0
    void Update()
    {
        if (this.startCounter)
        {
            if (timer >= incrementTime)
            {
                if (this.incrementEnemies < behave.enemiesKilled)
                {
                    this.incrementEnemies++;
                    this.enemiesKilled.text = this.incrementEnemies.ToString();
                    this.incrementCoins    += this.coinsPerEnemy;
                    this.coinsEarned.text   = this.incrementCoins.ToString();


                    //instanciar cabeca de inimigo;
                    var imageAux = GameBehavior.Instantiate(enemyImage);
                    imageAux.transform.SetParent(heads.transform);
                    audioCoin.Play();

                    timer = 0;
                }
                else
                {
                    this.startCounter     = false;
                    this.coinsEarned.text = behave.getEarnedCoins().ToString();
                }
            }
            else
            {
                timer += Time.deltaTime;
            }
        }
    }
예제 #7
0
        public TimeClass(string canvasTextName, Canvas canvas, GameBehavior game)
        {
            switch (canvasTextName)
            {
            case "TimeText":
                type     = GLOBAL_TIME_TEXT_DIGITS;
                time     = new float[type];
                timeText = canvas.gameObject.transform.Find(canvasTextName).GetComponent <Text>();
                break;

            case "AbilityTimeText":
                type     = ABILITY_TIME_TEXT_DIGITS;
                time     = new float[type];
                timeText = canvas.gameObject.transform.Find("AbilityButton").Find(canvasTextName).GetComponent <Text>();
                break;

            default:
                time = new float[4];
                Debug.Log("Invalid canvasTextName");
                break;
            }

            m_game = game;

            m_startTime = game.startTime;
        }
    // Use this for initialization
    void Start()
    {
        behave        = GameObject.FindGameObjectWithTag("Behaviour").GetComponent <GameBehavior>();
        atributeImage = GetComponent <Image>();

        //verifica se jogador tem pontos de atributos para gastar
        if (behave.expendPoints != 0)
        {
            atributeImage.enabled = true;

            int imageIndex = behave.expendPoints;

            //verifica se tem uma imagem que represente esse numero de atributos
            if (imageIndex <= sprites.Length)
            {
                atributeImage.sprite = sprites [imageIndex - 1];
            }
            else
            {
                atributeImage.sprite = sprites [sprites.Length - 1];
            }
        }
        else
        {
            atributeImage.enabled = false;
        }
    }
예제 #9
0
    // Use this for initialization
    void Start()
    {
        var x = GameObject.FindGameObjectWithTag("Behaviour");

        script = x.GetComponent <GameBehavior>();
        UpdatePoints();
        behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent <GameBehavior>();

        if (behave.showTutorial)
        {
            //logica para pegar a altura de algum dos panels
            height = GameObject.Find("PanelStrength").GetComponent <RectTransform>().rect.height;
            behave.inventory[1]   = 0;
            behave.inventory[2]   = 0;
            behave.inventory[3]   = 0;
            behave.abilityIDs[0]  = 0;
            behave.abilityIndex   = 0;
            behave.selectedWeapon = 0;

            //DELETAR INVENTORY IN MISSION
//			slots = GameObject.Find

            behave.bullets[1] = 0;             // balas da mp-9
            behave.bullets[2] = 0;             //balas de shotgun
            behave.coins      = 350;

            AttributeTutorial.SetActive(true);
            Agility.SetActive(false);
            Perception.SetActive(false);
            Vitality.SetActive(false);
            GameObject.Find("AttributeTutorialText").GetComponent <Text> ().text = "Strength increases damage";
            GameObject.Find("AttributeTutorialText").GetComponent <TranslateText>().Refresh();
        }
    }
예제 #10
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.transform.tag.Equals("Border"))
        {
            StartCoroutine(uiControlScript.Timer("Missed"));
            GameBehavior.getInstance().IncrementScore(0);
            GameBehavior.getInstance().inputActive = true;

            /*arrowCamObj.GetComponent<Camera>().gameObject.SetActive(false);
             * arrowCamObj.transform.parent = arrowView.transform;
             * MainCamera.gameObject.SetActive(true);
             * gameObject.SetActive(false);*/
            transform.GetComponent <Collider>().enabled = false;
            gameObject.GetComponentInChildren <MeshRenderer>().enabled = false;
        }

        if (collision.transform.tag.Equals("Score")) //&& GameBehavior.getInstance().takeScore)
        {
            GameBehavior.getInstance().takeScore = false;
            transform.GetComponent <Rigidbody>().velocity = Vector3.zero;
            gameObject.transform.parent = transform;

            GameBehavior.getInstance().audioController.playScoreBoardSound();
            GameBehavior.getInstance().IncrementScore(Convert.ToInt32(collision.gameObject.name));
            transform.GetComponent <Collider>().enabled = false;
            transform.GetChild(0).transform.GetComponent <MeshRenderer>().enabled = false;
            canvasController.ScaleUpScore(Convert.ToInt32(collision.gameObject.name), GameBehavior.getInstance().maxScore);
            StartCoroutine(uiCntrlScript.Timer(collision.gameObject.name));
        }
    }
예제 #11
0
 void Start()
 {
     _rb          = GetComponent <Rigidbody>();
     _col         = GetComponent <CapsuleCollider>();
     _gameManager = GameObject.Find("GameManager")
                    .GetComponent <GameBehavior>();
 }
예제 #12
0
        protected override void CreateScene()
        {
            // Lights
            DirectionalLight light = new DirectionalLight("light", new Vector3(-10f, 7f, -5f));

            EntityManager.Add(light);

            RenderManager.FrustumCullingEnabled = false;

            // Game Behavior
            GameBehavior gameBehavior = new GameBehavior();

            // Create Player
            this.Player = this.modelFactoryService.CreatePlayer(gameBehavior);
            EntityManager.Add(this.Player);

            // Create Camera
            var camera = new FixedCamera("mainCamera", Vector3.Zero, Vector3.Zero); // Setted in GameBehavior Init

            camera.BackgroundColor = Color.CornflowerBlue;
            this.GameCamera        = camera.Entity.FindComponent <Camera3D>();
            EntityManager.Add(camera);

            // Add Scene Behavior
            this.AddSceneBehavior(gameBehavior, SceneBehavior.Order.PostUpdate);
        }
 // Update is called once per frame
 void Update()
 {
     if (GameBehavior.getInstance().getScore() == maxScore)
     {
         canvasController.gameOver = true;
     }
 }
예제 #14
0
 private void LateUpdate()
 {
     if (GameBehavior.getInstance().inputActive&& onHold)
     {
         BowMotion();
     }
 }
예제 #15
0
    //death animation function
    void Die()
    {
        dead = true;
        legAnimator.SetBool("IsDead", true);
        torsoAnimator.SetBool("IsDead", true);
        bothAnimator.SetBool("dead", true);
        isShooting = false;
        Destroy(transform.GetComponent <BoxCollider2D> ());

        var player = GameObject.FindGameObjectWithTag("Player");

        player.GetComponent <Player> ().IncrementXp(experience);
        if (Random.Range(1, 4) == 2)
        {
            Instantiate(bulletBox[Random.Range(0, (bulletBox.Length))], transform.position, transform.rotation);
        }

        behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent <GameBehavior>();
        behave.incCoins(coinsWhenDie);
        behave.enemiesKilled++;

        if (Application.loadedLevelName == "HordeMode")
        {
            behave.currentHordeKills++;
        }
    }
예제 #16
0
 // Use this for initialization
 void Start()
 {
     content                = (RectTransform)gameObject.transform;
     canvasRect             = (RectTransform)canvas.transform;
     behave                 = GameObject.FindGameObjectWithTag("Behaviour").GetComponent <GameBehavior>();
     distanceScrollable     = content.rect.height - canvasRect.rect.height;
     initialContentPosition = content.position.y;
 }
예제 #17
0
 // Start is called before the first frame update
 void Start()
 {
     gameManager = GameObject.Find("Game Manager").GetComponent <GameBehavior>();
     if (gameManager == null)
     {
         Debug.Log("PickupItem script failed to find a game manager!");
     }
 }
예제 #18
0
    void Start()
    {
        //You'll need to add a rigidbody to the marble first
        _rb  = GetComponent <Rigidbody>();
        jump = new Vector3(0.0f, 10.0f, 0.0f);

        gameBehavior = GetComponent <GameBehavior>();
    }
예제 #19
0
 // Start is called before the first frame update
 void Start()
 {
     agent       = GetComponent <NavMeshAgent>();
     player      = GameObject.Find("Player").transform;
     gameManager = GameObject.Find("GameManager").GetComponent <GameBehavior>();
     playerAnim  = GameObject.Find("TT_demo_male_A").GetComponent <Animator>();
     playerAnim.SetBool("Hit", true);
 }
예제 #20
0
 void Start()
 {
     agent  = GetComponent <NavMeshAgent>();
     player = GameObject.Find("Player").transform;
     InitializePatrolRoute();
     MoveToNextPatrolLocation();
     gameManager = GameObject.Find("GameManager").GetComponent <GameBehavior>();
 }
예제 #21
0
	public bool entered = false; // You need this flag or the game will try to read EVERY instance of the collison!

	// Use this for initialization
	void Start () {

		Vector2 newVelocity = Vector2.zero;
		newVelocity.y = -3.0f;
		rigidbody2D.velocity = newVelocity;
		globals = Camera.main.GetComponent<GameBehavior>();
	
	}
예제 #22
0
 // Use this for initialization
 void Start()
 {
     content = (RectTransform)gameObject.transform;
     canvasRect = (RectTransform)canvas.transform;
     behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent<GameBehavior>();
     distanceScrollable = content.rect.height - canvasRect.rect.height;
     initialContentPosition = content.position.y;
 }
예제 #23
0
 // Use this for initialization
 void Start()
 {
     game          = GameObject.FindGameObjectWithTag("Manager").GetComponent <GameBehavior>();
     thisRigidbody = this.GetComponent <Rigidbody2D>();
     sr            = gameObject.GetComponent <SpriteRenderer>();
     orb           = Instantiate(orbPrefab);
     orbScript     = orb.GetComponent <OrbBehavior>();
     orb.SetActive(false);
 }
예제 #24
0
    void Start()
    {
        this.behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent<GameBehavior>();

        GameObject[] enemiesCount = GameObject.FindGameObjectsWithTag ("Enemy");
        print ("QUANTIDADE DE INIMIGOS NA CENA " + enemiesCount.Length);

        behave.totalEnemies = enemiesCount.Length;
    }
예제 #25
0
 // Start is called before the first frame update
 void Start()
 {
     rigidbody       = GetComponent <Rigidbody>();
     playereCollider = GetComponent <CapsuleCollider>();
     gameManager     = GameObject.Find("GameManager").GetComponent <GameBehavior>();
     playerAnim      = GameObject.Find("TT_ww1_demo_british_A").GetComponent <Animator>();
     playerAnim.SetBool("Run", true);
     playerAnim.SetBool("Shoot", true);
 }
예제 #26
0
    void Start()
    {
        this.behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent <GameBehavior>();

        GameObject[] enemiesCount = GameObject.FindGameObjectsWithTag("Enemy");
        print("QUANTIDADE DE INIMIGOS NA CENA " + enemiesCount.Length);

        behave.totalEnemies = enemiesCount.Length;
    }
예제 #27
0
    private void OnMouseDown()
    {
        GameObject   game         = transform.root.gameObject;
        GameBehavior gameBehavior = game.GetComponent <GameBehavior>();

        int[] coords = this.GetComponentInParent <TileObjectScript>().GetCoordinates();

        gameBehavior.OnUnitLeftClick(UnitId, coords);
    }
 // Start is called before the first frame update
 void Start()
 {
     // Finds RigidBody component of the attatched GameObject
     _rb = GetComponent <Rigidbody>();
     // Finds CapsuleCollider component of attatched GaemObject
     _col = GetComponent <CapsuleCollider>();
     // Finds and returns GameBehvaior script on GameManager GameObject
     _gameManager = GameObject.Find("GameManager").GetComponent <GameBehavior>();
 }
예제 #29
0
    // Start is called before the first frame update

    void Start()
    {
        Time.timeScale = 1;
        endObjects     = GameObject.FindGameObjectsWithTag("ShowOnEnd");
        hideEnd();
        Status   = GameObject.Find("Status").GetComponent <Text>();
        instance = this;
        instance.marbleHealth   = 100;
        instance.goalsCollected = 0;
    }
예제 #30
0
 // Use this for initialization
 void Start()
 {
     behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent <GameBehavior>();
     totalCoinsText.text      = behave.totalCoins.ToString();
     hordeKillsText.text      = behave.maxHordeKills.ToString();
     enemiesKilledText.text   = behave.totalEnemiesKilled.ToString();
     ammoSpentText.text       = behave.ammoSpent.ToString();
     totalExperienceText.text = behave.totalExperience.ToString();
     knifeKillsText.text      = behave.knifeKills.ToString();
 }
예제 #31
0
 // Use this for initialization
 void Start()
 {
     behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent<GameBehavior>();
     totalCoinsText.text = behave.totalCoins.ToString();
     hordeKillsText.text = behave.maxHordeKills.ToString();
     enemiesKilledText.text = behave.totalEnemiesKilled.ToString();
     ammoSpentText.text = behave.ammoSpent.ToString();
     totalExperienceText.text = behave.totalExperience.ToString();
     knifeKillsText.text = behave.knifeKills.ToString();
 }
 // Use this for initialization
 void Start()
 {
     arrowView        = GameObject.Find("Arrow View");
     MainCamera       = GameObject.Find("Main Camera").GetComponent <Camera>();
     scoreText        = GameObject.Find("Score Text");
     gameController   = GameObject.Find("Game Controller");
     uiControlScript  = gameController.GetComponent <UIController>();
     canvasController = GameObject.Find("Canvas").GetComponent <CanvasController>();
     totalScoreCount  = 0; maxScore = GameBehavior.getInstance().maxScore;
     uiCntrlScript    = GameObject.Find("Game Controller").GetComponent <BalloonUIController>();
 }
예제 #33
0
    void Start()
    {
        this.behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent <GameBehavior>();

        RectTransform headRect = heads.GetComponent <RectTransform> ();

        maxSize       = headRect.rect.height;
        maxCollumn    = 6;
        amountCollumn = Mathf.Floor(behave.enemiesKilled / 11) + 1;
        if (amountCollumn > maxCollumn)
        {
            amountCollumn = maxCollumn;
        }


        float imageSize;

        if (behave.enemiesKilled == 0)
        {
            this.coinsPerEnemy = 0;
            imageSize          = 0;
        }
        else
        {
            imageSize = (headRect.rect.width / behave.enemiesKilled) * amountCollumn;             //define tamanho de cada imagem sendo: area_total/total_de_inimigos
            if (imageSize > maxSize)
            {
                imageSize = maxSize;
            }
            this.coinsPerEnemy = (behave.getEarnedCoins() / behave.enemiesKilled);
        }


        headsGrid          = heads.GetComponent <GridLayoutGroup> ();
        headsGrid.cellSize = new Vector2(imageSize, imageSize);

        if (behave.totalEnemies == 0)
        {
            this.totalEnimies.text = "∞";
        }
        else
        {
            this.totalEnimies.text = behave.totalEnemies.ToString();
        }


        if (this.coinsPerEnemy < 1)
        {
            coinsPerEnemy = 1;
        }

        this.startIncrementCoins();
    }
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag.Equals("Arrow"))
     {
         CollisionHolder = collision;
         collision.transform.GetComponent <Rigidbody>().velocity = Vector3.zero;
         collision.gameObject.transform.parent = transform;
         GameBehavior.getInstance().audioController.playScoreBoardSound();
         GameBehavior.getInstance().IncrementScore(50);
         collision.transform.GetComponent <Collider>().enabled = false;
         collision.transform.GetChild(0).transform.GetComponent <MeshRenderer>().enabled = false;
         StartCoroutine(uiCntrlScript.Timer("50"));
     }
 }
예제 #35
0
        static void Main(string[] args)
        {
            ClientClass server = new ClientClass();

            // byte[] data = new byte[Constants.SIZE_OF_BYTES_NULL];

            int[,] board = new int[10, 10];                                     //Game field
            int X1 = Constants.COORDINATE_NULL, Y1 = Constants.COORDINATE_NULL,
                X2 = Constants.COORDINATE_NULL, Y2 = Constants.COORDINATE_NULL; //from (Х1, Y1) to (X2, Y2)
            int me    = Constants.ID_PLAYER1;                                   //my ID
            int enemy = Constants.ID_PLAYER2;                                   //enemy ID

            if (server.FirstConnection_ChangeMyId().Item1 == true)              //Connect to server
            {
                me    = Constants.ID_PLAYER2;
                enemy = Constants.ID_PLAYER1;
            }
            Console.WriteLine(me.ToString());

            int t = 0;

            while (true)
            {
                Console.WriteLine(t++.ToString());

                byte[] data = server.GetStatus(); //ПGet cur status
                board = GameBehavior.ParseStatus(data);
                Console.WriteLine("Get data");


                if (GameBehavior.IsMeCurPlayer(data, me) == false) //Not my move
                {
                    continue;
                }

                //You need to get X1, Y1, X2, Y2
                //CODE HERE
                //CODE HERE
                //CODE HERE

                X1 = 2; Y1 = 6; X2 = 3; Y2 = 7; //Example

                Console.WriteLine(X1.ToString() + " " + Y1.ToString() + " " + X2.ToString() + " " + Y2.ToString());

                data = GameBehavior.ConvertMoveToByte(X1, Y1, X2, Y2);
                server.SendMove(data); //Send move
                Console.WriteLine("Send data");
            }
        }
예제 #36
0
    void Start()
    {
        behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent<GameBehavior>();

            canvasRect = this.GetComponentInParent<Canvas> ().GetComponent<RectTransform>();
            database = GetComponent<ItemDatabase> ();

            for (int i = 0; i < database.getItemDataLength() ; i++) {
                items.Add (new Item());
            }

            for (int i = 0; i < database.getItemDataLength(); i++) {
                AddItem(i);
            }
    }
예제 #37
0
    // Use this for initialization
    void Start()
    {
        inputActive = false; takeScore = false;
        MainCamera  = GameObject.Find("Main Camera");
        DontDestroyOnLoad(crossSceneObj);
        timerScript      = GameObject.Find("Canvas").transform.Find("TimerBg").transform.Find("Timer").GetComponent <Image>();
        canvasController = GameObject.Find("Canvas").GetComponent <CanvasController>();
        GameBehavior.getInstance().objectPool.addToPool(new PoolObject(Resources.Load <GameObject>("Prefabs/BalloonBurstEffect0"), 10, true));
        GameBehavior.getInstance().objectPool.addToPool(new PoolObject(Resources.Load <GameObject>("Prefabs/BalloonBurstEffect1"), 10, true));
        GameBehavior.getInstance().objectPool.addToPool(new PoolObject(Resources.Load <GameObject>("Prefabs/BalloonBurstEffect2"), 10, true));
        GameBehavior.getInstance().objectPool.addToPool(new PoolObject(Resources.Load <GameObject>("Prefabs/BalloonBurstEffect3"), 10, true));
        GameBehavior.getInstance().objectPool.addToPool(new PoolObject(Resources.Load <GameObject>("Prefabs/Sphere"), 10, true));

        StartCoroutine(LateStart());
    }
예제 #38
0
        public void Start()
        {
            Connection = new GameConnection(IPAddress.Parse(m_server.ServerAddress), m_server.ServerPort);
            m_behavior = new GameBehavior(this);

            GameClientPacket packet = new GameClientPacket(CtosMessage.PlayerInfo);
            packet.Write(Program.Config.Username + "$" + (IsCheckmate ? Program.Config.Password : DevClient.Token.ToString()), 20);
            Connection.Send(packet);

            byte[] junk = {0xCC, 0xCC, 0x00, 0x00, 0x00, 0x00};
            packet = new GameClientPacket(CtosMessage.JoinGame);
            packet.Write(Version);
            packet.Write(junk);
            packet.Write(m_roomInfos, 30);
            Connection.Send(packet);
        }
예제 #39
0
    // Use this for initialization
    void Start()
    {
        behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent<GameBehavior>();
        coins.text = behave.coins.ToString();

        for(int i = 0;i < behave.currentMission; i++){

            missions[i].SetActive(true);

        }

        //tutorial

        if (behave.showTutorial && behave.showAttributes) {
            //N DEIXANDO CLICAR EM NENHUM BUTTON, EXCETO O DO ATTRIBUTE
            buttons[1].GetComponent<Button>().interactable = false;
            buttons[2].GetComponent<Button>().interactable = false;
            buttons[3].GetComponent<Button>().interactable = false;
            buttons[4].GetComponent<Button>().interactable = false;
            buttons[5].GetComponent<Button>().interactable = false;

            MapTutorialCanvas.SetActive(true);
            arrows[0].SetActive(true); //SETA INDICANDO OS ATRIBUTOS ATIVADA
            arrows[1].SetActive(false);//SETA INDICANDO A STORE DESATIVADA
        //			GameObject.Find ("MapTutorialText").GetComponent<Text> ().text = "Clique em attributes";
            StartCoroutine(BlinkArrow(0));
        }

        if (behave.showTutorial && behave.showStore) {
            buttons[0].GetComponent<Button>().interactable = false;
            buttons[1].GetComponent<Button>().interactable = false;
            buttons[2].GetComponent<Button>().interactable = true;
            buttons[3].GetComponent<Button>().interactable = false;
            buttons[4].GetComponent<Button>().interactable = false;
            buttons[5].GetComponent<Button>().interactable = false;

            MapTutorialCanvas.SetActive(true);
            arrows[0].SetActive(false); //SETA INDICANDO OS ATRIBUTOS desativada
            arrows[1].SetActive(true);//SETA INDICANDO A STORE ATIVADA
        //			GameObject.Find ("MapTutorialText").GetComponent<Text> ().text = "Clique em store";
            StartCoroutine(BlinkArrow(1));
        }
    }
예제 #40
0
    // Use this for initialization
    void Start()
    {
        behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent<GameBehavior>();
        atributeImage = GetComponent<Image>();

        //verifica se jogador tem pontos de atributos para gastar
        if (behave.expendPoints != 0) {

            atributeImage.enabled = true;

            int imageIndex = behave.expendPoints;

            //verifica se tem uma imagem que represente esse numero de atributos
            if (imageIndex <= sprites.Length) {
                atributeImage.sprite = sprites [imageIndex - 1];
            } else {
                atributeImage.sprite = sprites [sprites.Length - 1];
            }
        } else {
            atributeImage.enabled = false;
        }
    }
예제 #41
0
    void Start()
    {
        this.behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent<GameBehavior>();

        RectTransform headRect = heads.GetComponent<RectTransform> ();
        maxSize = headRect.rect.height;
        maxCollumn = 6;
        amountCollumn = Mathf.Floor(behave.enemiesKilled / 11) + 1;
        if (amountCollumn > maxCollumn)
            amountCollumn = maxCollumn;

        float imageSize;
        if (behave.enemiesKilled == 0) {
            this.coinsPerEnemy = 0;
            imageSize = 0;
        } else {

            imageSize = (headRect.rect.width / behave.enemiesKilled) * amountCollumn; //define tamanho de cada imagem sendo: area_total/total_de_inimigos
            if(imageSize > maxSize)
                imageSize = maxSize;
            this.coinsPerEnemy = (behave.getEarnedCoins () / behave.enemiesKilled);
        }

        headsGrid = heads.GetComponent<GridLayoutGroup> ();
        headsGrid.cellSize = new Vector2(imageSize,imageSize);

        if (behave.totalEnemies == 0)
            this.totalEnimies.text = "∞";
        else
            this.totalEnimies.text = behave.totalEnemies.ToString ();

        if (this.coinsPerEnemy < 1)
            coinsPerEnemy = 1;

        this.startIncrementCoins ();
    }
예제 #42
0
	public void setGameScript(Camera cam){
		gameScript = cam.GetComponent<GameBehavior>();
	}
예제 #43
0
    // Use this for initialization
    void Start()
    {
        behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent<GameBehavior>();
        timer = -100;

        if (behave.showTutorial) {
            Time.timeScale = 1;
            this.level = 9;
            behave.pause = true;

            print(behave.pause);
            print("pausado");
            canvasTutorial.SetActive (true);
            textTutorial.GetComponent<Text> ().text = "Now you will learn about the controls of the game and play a little!\nTap for the next step";
            textTutorial.GetComponent<TranslateText>().Refresh();
        //			arrows [index].SetActive (true);
        }
    }
예제 #44
0
    // Update is called once per frame
    void Update()
    {
        if(canvasTutorial.activeSelf){

            behave.pause = true;

        }

        //logica do tutorial

        //SE O GAMEPLAY TIVER TEMPO

        //		if (behave.showTutorial && startTime) {
        //			time += Time.deltaTime;
        //
        //			if(time >= 25){
        //				print ("ACABOU GAMEPLAY DO TUTORIAL");
        //				startTime = !startTime;
        //			}
        //
        //		}

        //		if (behave.selectedWeapon == 0)
        //			infinity.SetActive (true);
        //		else
        //			infinity.SetActive (false);

        bool alive = false;
        //checks if all enemies are dead
        count = enemiesInScene.Count;
        foreach(GameObject enemy in enemiesInScene){

            if(!enemy.GetComponent<Enemy>().dead){

                alive = true;
                count--;

            }

        }
        countingText.GetComponent<Text>().text = "" + count;
        totalText.GetComponent<Text>().text = "" + enemiesInScene.Count;

        //checks if alive

        if(!alive && timer > 9 )
        {
            timer = 8;
            clearedText.GetComponent<Text>().text = "cleared";
            clearedText.GetComponent<TranslateText>().Refresh();

            clearedText.GetComponent<Animator>().SetTrigger("cleared");
        }

        if(!alive)
        {
            if(timer > 2 && timer < 4){
                if(go){
                    behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent<GameBehavior>();
                    behave.CheckHordeAchievements((level - 1));
                    clearedText.GetComponent<Text>().text = "Horde " + level;
                    clearedText.GetComponent<Animator>().SetTrigger("cleared");
                    go = false;
                }

            }

            timer = timer - Time.deltaTime;
            if(timer <= 0)
            {

                Respawn();

            }

        }
    }
예제 #45
0
    // Use this for initialization
    void Start()
    {
        var x = GameObject.FindGameObjectWithTag("Behaviour");
        script = x.GetComponent<GameBehavior>();
        UpdatePoints();
        behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent<GameBehavior>();

        if (behave.showTutorial) {

            //logica para pegar a altura de algum dos panels
            height = GameObject.Find ("PanelStrength").GetComponent<RectTransform>().rect.height;
            behave.inventory[1] = 0;
            behave.inventory[2] = 0;
            behave.inventory[3] = 0;
            behave.abilityIDs[0] = 0;
            behave.abilityIndex = 0;
            behave.selectedWeapon = 0;

            //DELETAR INVENTORY IN MISSION
        //			slots = GameObject.Find

            behave.bullets[1] = 0; // balas da mp-9
            behave.bullets[2] = 0; //balas de shotgun
            behave.coins = 350;

            AttributeTutorial.SetActive(true);
            Agility.SetActive(false);
            Perception.SetActive(false);
            Vitality.SetActive(false);
            GameObject.Find ("AttributeTutorialText").GetComponent<Text> ().text = "Strength increases damage";
            GameObject.Find ("AttributeTutorialText").GetComponent<TranslateText>().Refresh();

        }
    }
예제 #46
0
 void Start()
 {
     behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent<GameBehavior>();
 }
예제 #47
0
    void Start()
    {
        behave = GameObject.FindGameObjectWithTag("Behaviour").GetComponent<GameBehavior>();
        coin = behave.coins;
        button = GameObject.Find ("BuyButton").GetComponent<Button>();
        CoinsPanel = GameObject.Find ("CoinAmount");
        CoinsPanel.GetComponent<Text> ().text = "x "+coin.ToString ();

        item = ListBank.Instance.itemToBuy;

        //tutorial
        if (behave.showTutorial) {
            StartCoroutine(ShowMessage("buy the Revolver"));
            StartCoroutine(BlinkArrow());
            storeCanvasTutorial.SetActive(true);
            StartCoroutine(BlinkArrow());
            activeBlink = false;
            buttonActivate = false;
            backButton.GetComponent<Button>().interactable = false;
        }
    }
예제 #48
0
	// Use this for initialization
	void Start () {
		//time = Time.time + shootSpeed + startShootTime;
		gameScript = Camera.main.GetComponent<GameBehavior>();
	}