void OnCollisionEnter2D(Collision2D collison)
    {
        movePlayer move_script = collison.otherCollider.gameObject.GetComponent <movePlayer>();

        if (collison.gameObject.tag.Contains("Player"))
        {
            InventoryScript inventory = collison.gameObject.GetComponent <InventoryScript>();
            if (inventory != null)
            {
                SoundEffectScript.Instance.playUpgradeSound(gameObject.transform.position);
                inventory.addPuntigamerCount(1);

                // spwan puntigamer icon
                Vector3    position = collison.gameObject.transform.position + new Vector3(0.0f, 3.0f, 0.0f);
                GameObject icon     = Instantiate(puntigamer_sprite, position, Quaternion.identity);
                icon.transform.SetParent(collison.gameObject.transform);

                ParticleEffectsScript.Instance.speedBoostEffect(position, collison.gameObject, 1.0f);

                Destroy(gameObject);
            }
        }
        else
        {
            if (collison.relativeVelocity.magnitude > max_impact)
            {
                SoundEffectScript.Instance.playBreakingGlass(gameObject.transform.position);
                Collider2D collider = gameObject.GetComponent <Collider2D>();
                Vector3    offset   = new Vector3(0.0f, collider.bounds.max.y * 0.5f, 0.0f);
                ParticleEffectsScript.Instance.beerExplosion(transform.position + offset);
                Destroy(gameObject);
            }
        }
    }
    public void setInfo(movePlayer currentPlayer)
    {
        GameTileColors = GetComponent <organizeGameSpaces>().colorList;
        string ownings = "";
        //create a dictionary of the categories of properties the player owns
        Dictionary <Color, int> playerCategories = new Dictionary <Color, int>();

        foreach (GameObject prop in currentPlayer.player.owned)
        {
//			ownings += prop.name + "\n";
            realEstate real = prop.GetComponent <realEstate> ();
            int        posY = 0;
            //this is for determining whether user can buy hotels
            if (playerCategories.ContainsKey(real.tile.category))
            {
                playerCategories [real.tile.category]++;
//				Debug.Log (currentPlayer);
                if (playerCategories [real.tile.category] == GameTileColors[real.tile.category])
                {
//					Debug.Log ("buy a hotel");
                    propUp.upgrade(real.tile.category);
                }
            }
            else
            {
                playerCategories.Add(real.tile.category, 1);
            }

            ownings += prop.name + "\n";
        }

        info.text = "Player: " + currentPlayer.gameObject.name + "\nMoney: " + currentPlayer.player.money + "\n" + ownings;
    }
Exemple #3
0
 // Start is called before the first frame update
 void Start()
 {
     move_script      = GetComponent <movePlayer>();
     combat_script    = GetComponent <CombatScript>();
     inventory_script = GetComponent <InventoryScript>();
     grab_script      = GetComponent <GrabScript>();
 }
    public void rentInfo(GameObject tile, movePlayer player)
    {
//		Debug.Log ("RENTING");
        realEstate prop = tile.GetComponent <realEstate> ();
        Text       txt  = rentInfoText.GetComponent <Text> ();

        txt.text = "Would you like to pay rent to " + prop.tile.owner + "\nAt: " + prop.tile.name + "\nFor: " + prop.tile.rent;
    }
//	public void proposeTrade(){
//		Dictionary<Color,int> categoriesOwned;
//		foreach(GameObject property in _playerBuys.player.owned){
//			realEstate realestate = property.GetComponent<realEstate> ();
//          if (categoriesOwned.ContainsKey (realestate.tile.category)) {
//				categoriesOwned [realestate.tile.category]++;
//			} else {
//				categoriesOwned.Add (realestate.tile.category, 1);
//			}
//		}
//		//TODO prioritize what property you want to trade, based on if any multiples are owned within a color category.
//		//the AI will propose a trade every turn
//		//They select the highest priority category they want to buy from, and see if any other player has property in that category
//		//iterate through list from highest priority to lowest priority, looking to see if other players own property in that category.
//		//propose a trade, with details sent to the target player's moveplayer.player class,
//		//and on Turn() function it verifies if there is any wanting trades, and processes whether it accepts the terms.
//		//can either trade property or cash
//		//maybe i should do the prioritizing in the AI brain script
//	}

    public void endTurn()
    {
        _playerBuys = null;
        _propBuys   = null;
        endTurnButton.SetActive(false);
        turnButton.SetActive(true);
        Turn();
    }
Exemple #6
0
    // Start is called before the first frame update
    void Start()
    {
        PlayerMoveScript = Player.GetComponent <movePlayer>();
        PowerUpScriptVar = SpeedPU.GetComponent <SpeedPowerUpScript>();
        PlayerLifeScript = Player.GetComponent <PlayerLifeCountAndDie>();
        IPUScript        = InvinciblePU.GetComponent <InvincibilityCharacterScript>();

        SpeedTrail.SetActive(false);
    }
    void Start()
    {
        if (isClient && isServer && isLocalPlayer)
        {
            test();
        }

        movePlayer = gameObject.GetComponent<movePlayer>();
    }
Exemple #8
0
    private void Start()
    {
        move_script   = GetComponent <movePlayer>();
        health_script = GetComponent <HealthScript>();
        combat_script = GetComponent <CombatScript>();

        consume_doener      = false;
        consume_frankfurter = false;
        consume_puntigamer  = false;
    }
Exemple #9
0
    // Start is called before the first frame update
    void Start()
    {
        //Basically just repeats the function spawn
        //      InvokeRepeating("spawn", 0, 4);
        Invoke("spawn", 4);

        thePlayer          = FindObjectOfType <movePlayer>();
        lastPlayerPosition = thePlayer.transform.position;

        // Invoke("hello", 2);
    }
    // Update is called once per frame
    public void setOwner(movePlayer buyer)
    {
        GameObject ownerText = new GameObject("Owner");

        ownerText.transform.parent = transform;
        TextMesh textM = ownerText.AddComponent <TextMesh> ();

        textM.text          = buyer.gameObject.name;
        textM.characterSize = 0.02f;
        textM.fontSize      = 65;
        textM.color         = new Color(0, 0, 0);
        ownerText.transform.localPosition = new Vector3(-0.452f, 0.528f, -0.2f);
        ownerText.transform.rotation      = Quaternion.Euler(90, 0, 0);
    }
    //this determines whether the player lands on a property or game mech tile.
    //It plays after the dice is rolled, and triggers the end turn button
    private void turnAction(GameObject thisTile, movePlayer thisPlayer)
    {
        setPlayerInfo info = GetComponent <setPlayerInfo> ();

        info.setInfo(thisPlayer);
        //is it a property tile or a game mechanic tile?
        if (thisTile.GetComponent <realEstate>() != null)
        {
            realEstate property = thisTile.GetComponent <realEstate> ();
            Debug.Log("real estate tile");

            //is it owned by a player?
            if (property.tile.owner != null)
            {
                Debug.Log("Someone Owns it");
                //is it owned by the player?
                if (thisPlayer.gameObject == property.tile.owner)
                {
                    Debug.Log("You Owns it");
                }
                else
                {
                    //the player chooses to pay rent or no
                    Debug.Log(thisPlayer.gameObject.name + " Owns it");
                    rentButton.SetActive(true);
                    _playerBuys = thisPlayer;
                    _propBuys   = thisTile;
                    info.rentInfo(thisTile, thisPlayer);
                }
                info.setInfo(thisPlayer);
//				turnButton.SetActive (true);
            }
            else
            {
                //the player can buy the tile
                //set info for this specific tile
                buyButtonInfo.GetComponent <Text>().text = "Would you like to buy " + thisTile.name + "?\nPrice: " + property.tile.price + "\nRent: " + property.tile.rent;
                buyButton.SetActive(true);
                _playerBuys = thisPlayer;
                _propBuys   = thisTile;
            }
        }
        else if (thisTile.GetComponent <goTile>() != null)
        {
            Debug.Log("game mechanic tile");
            info.setInfo(thisPlayer);
        }
        endTurnButton.SetActive(true);
    }
Exemple #12
0
    void GotoNextPoint()
    {
        // Returns if no points have been set up
        if (points.Length == 0)
        {
            return;
        }

        // Set the agent to go to the currently selected destination.
        agent.destination = points[destPoint].position;

        // Choose the next point in the array as the destination,
        // cycling to the start if necessary.
        destPoint = (destPoint + 1) % points.Length;

        GameObject obj = GameObject.FindGameObjectWithTag("Player");

        movePl = obj.GetComponent <movePlayer>();
    }
    public void payRent(bool rent)
    {
        setPlayerInfo info       = GetComponent <setPlayerInfo> ();
        realEstate    realestate = _propBuys.GetComponent <realEstate> ();
        movePlayer    owner      = realestate.tile.owner.GetComponent <movePlayer> ();

        if (rent == true)
        {
            int rentNumber = GetComponent <determineRent>().rentCalc(realestate);
            _playerBuys.player.money -= realestate.tile.rent;
            owner.player.money       += realestate.tile.rent;
            rentButton.SetActive(false);
            info.setInfo(_playerBuys);
        }
        else
        {
            rentButton.SetActive(false);
        }
    }
Exemple #14
0
    // Update is called once per frame
    void Update()
    {
        if (collision_damage > 0.0f)
        {
            takeHealth(collision_damage);
            collision_damage = 0.0f;
        }

        //check health and destroy game object (or other stuff)
        if (health <= 0 && gameObject.tag == "Player")
        {
            // Player died, fall down and disable animations
            game_over_timer -= Time.deltaTime;

            // fall down
            Rigidbody2D rigidbody = gameObject.GetComponent <Rigidbody2D>();
            if (rigidbody != null)
            {
                Vector3 force = new Vector3(0.01f, 0.0f, 0.0f);
                rigidbody.AddForce(force);
                rigidbody.freezeRotation = false;
            }

            // disable movement and animations
            movePlayer move_script = gameObject.GetComponent <movePlayer>();
            if (move_script != null)
            {
                move_script.animator.SetInteger("WalkState", 0);
                move_script.enabled = false;
            }


            // display game over screen
            if (game_over_timer <= 0.0f)
            {
                PlayerPrefs.SetString("LastScene", SceneManager.GetActiveScene().name);
                SceneManager.LoadScene("GameOver");
            }
        }
    }
    public void buyHouses(GameObject property)
    {
        realEstate realestate = property.GetComponent <realEstate> ();
        movePlayer player     = realestate.tile.owner.GetComponent <movePlayer> ();

        //find out if there's any houses on the property
        if (realestate.tile.houses == 4)
        {
            Debug.Log("hotel");
            //delete all children houses of that tile
            foreach (Transform child in property.transform)
            {
                Debug.Log(child.gameObject.name);
                if (child.gameObject.tag == "house")
                {
                    Destroy(child.gameObject);
                }
            }
            GameObject thisHotel = (GameObject)Instantiate(hotel, property.transform.position + new Vector3((Random.Range(0.1f, 3) / 10f) - 0.3f, 1, (Random.Range(0, 10) / 10f)), Quaternion.identity, property.transform);
            realestate.tile.hotels++;
            realestate.tile.houses = 0;
            player.player.money   -= realestate.tile.housePrice;
            GetComponent <setPlayerInfo> ().setInfo(player);
        }
        else if (realestate.tile.hotels == 1)
        {
            //the property is full of houses, etc
            Debug.Log("no more hotels, houses");
        }
        else
        {
            GameObject thisHouse = (GameObject)Instantiate(house, property.transform.position + new Vector3((Random.Range(0.1f, 3) / 10f) - 0.3f, 1, (Random.Range(0, 10) / 10f)), Quaternion.identity, property.transform);
            realestate.tile.houses++;
            player.player.money -= realestate.tile.housePrice;
            Debug.Log("house");
        }

        realestate.updateRent(GetComponent <determineRent>());
    }
    //The Turn function is first triggered after the players are create in addPlayers.cs, and subsequently is
    //activated by the endTurn function.
    public void Turn()
    {
        setPlayerInfo info = GetComponent <setPlayerInfo> ();

        if (playerNumber == 0)
        {
            playerNumber = playerList.Count;
        }
        //determine the current player
        GameObject currentPlayer = playerList[currentTurn];

        camera.GetComponent <moveCamera> ().move(currentPlayer);
        _playerBuys = currentPlayer.GetComponent <movePlayer> ();
        if (currentTurn == playerNumber - 1)
        {
            currentTurn = 0;
        }
        else
        {
            currentTurn++;
        }
        turnButton.SetActive(true);
        info.setInfo(_playerBuys);
    }
 void Start()
 {
     movePlayer = PlayerGameObject.GetComponent <movePlayer>();
 }
Exemple #18
0
 // Use this for initialization
 void Start()
 {
     coins = player.gameObject.GetComponent<movePlayer>();
 }
Exemple #19
0
 // Start is called before the first frame update
 void Start()
 {
     thePlayer          = FindObjectOfType <movePlayer>();
     lastPlayerPosition = thePlayer.transform.position;
 }
Exemple #20
0
 void Start()
 {
     movePlayer = PlayerGameObject.GetComponent <movePlayer>();
     GetComponent <Renderer>().material = InActiveMaterial;
 }
 void Start()
 {
     mp = PlayerGameObject.GetComponent <movePlayer>();
     v  = transform.localPosition;
 }
Exemple #22
0
 void Awake()
 {
     playerCtrl = transform.root.GetComponent <movePlayer>();
     CharInv    = transform.root.GetComponent <Inventory>();
     speed      = 2f;                                // The speed the rocket will fire at.
 }
 void Start()
 {
     this.movePlayerScript = this.girlPlayer.GetComponent <movePlayer>();
 }
 void Start()
 {
     myPlayer = GameObject.Find("CapsulePlayer").GetComponent <movePlayer> ();
 }
 void Start()
 {
     myPlayer = GameObject.Find ("CapsulePlayer").GetComponent<movePlayer> ();
 }
Exemple #26
0
 void Start()
 {
     move_script   = GetComponent <movePlayer>();
     health_script = GetComponent <HealthScript>();
     combat_script = GetComponent <CombatScript>();
 }
Exemple #27
0
    public void mutatedMethod()
    {
        movePlayer player = FindObjectOfType <movePlayer>();

        player.mutate(player.moveRight);
    }
Exemple #28
0
 void Start()
 {
     ResumeButton.SetActive(false);
     MoveScript = Player.GetComponent <movePlayer>();
 }
Exemple #29
0
 void Start()
 {
     MoveScript = Player.GetComponent <movePlayer>();
 }
Exemple #30
0
 void Start()
 {
     mp  = PlayerGameObject.GetComponent <movePlayer>();
     tmr = FlashTime * 1.1f;
 }