Example #1
0
	public void Grab(GameObject go)
    {
		PickUpData pu = CopyPickUpData(go.GetComponent<PickUp>());

		if (InventorySlot1.Name == null || InventorySlot2.Name == null) {

			if (InventorySlot1.Name != pu.Name && InventorySlot2.Name != pu.Name) {	
				if (!(pu.Type == PickUp.PickUpType.Victim) && InventorySlot1.Name == null) {
					InventorySlot1 = pu;
                    GameController.RefreshInventory(this.gameObject, pu);
					Destroy (go);
				} else if (!(pu.Type == PickUp.PickUpType.Victim) && InventorySlot2.Name == null) {
					InventorySlot2 = pu;
                    GameController.RefreshInventory(this.gameObject, pu);
                    Destroy (go);
				}
			}
		}
        
        if (pu.Type == PickUp.PickUpType.Victim && pu.Name == TargetVictim && CanKill ()) {
            GameController.SetWinningPlayer(PlayerName);
            GameController.SetGameState (GameController.GameState.End);
            Destroy (go);
		}
    }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            PickUpData    Dri    = new PickUpData();
            List <String> driver = Dri.LoadDriver(comboBox1.Text, textBox3.Text);
            DateTime      dd     = DateTime.Now;

            foreach (var item in driver)
            {
                comboBox2.Items.Add(item);
            }
            textBox6.Text = dd.ToString();
        }
    void SetPickUp(PickUp pickUp, Tile tile)
    {
        PickUpTier tier = GetTier();
        PickUpData data = GetData();

        pickUp.type  = data.type;
        pickUp.value = data.value * tier.multiplier;
        pickUp.spriterRenderer.sprite = data.sprite;
        pickUp.spriterRenderer.color  = tier.color;

        pickUp.tile  = tile;
        tile.content = TileContentType.Collectable;
        tile.pickUp  = pickUp;

        pickUp.manager = this;
    }
Example #4
0
    private void SpawnPickUp()
    {
        PickUpData pickUpType    = this.SelectRandomPickUpType();
        Vector3    spawnPosition = this.SelectRandomSpawnLocation();

        GameObject pickUpGameObject = Instantiate(this.pickupPrefab, spawnPosition, Quaternion.identity);

        if (pickupContainer != null)
        {
            pickUpGameObject.transform.parent = pickupContainer.transform;
        }

        PickUp pickUp = pickUpGameObject.GetComponent <PickUp>();

        pickUp.SetOnPicked(this.OnPickUpDestoryed);
        pickUp.SetMaterial(pickUpType.material);

        this.currentNumberOfPickUps++;
    }
    PickUpData GetData()
    {
        if (typesProbability.Count == 0)
        {
            for (int i = 0; i < datas.Count; i++)
            {
                for (int j = 0; j < datas[i].rarity; j++)
                {
                    typesProbability.Add(datas[i].type);
                }
            }
        }

        int        id   = Random.Range(0, typesProbability.Count);
        PickUpType type = typesProbability[id];

        typesProbability.Remove(type);

        PickUpData data = dicDatas[type];

        return(data);
    }
Example #6
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (textBox1.Text == "")
     {
         MessageBox.Show("You should enter Name ");
     }
     else if (textBox2.Text == "")
     {
         MessageBox.Show("Phone number should be enter");
     }
     else if (textBox3.Text == "")
     {
         MessageBox.Show("Enter Customer Current Location");
     }
     else if (textBox4.Text == "")
     {
         MessageBox.Show(" Enter Destination");
     }
     else if (!comboBox1.Text.Any())
     {
         MessageBox.Show("Select a Driver");
     }
     else
     {
         var result = MessageBox.Show("Click save to store data in database", "Save", MessageBoxButtons.YesNo);
         if (result == DialogResult.No)
         {
             Cleartextboxes();
         }
         else
         {
             PickUpData ad = new PickUpData();
             ad.Pickupinitialization(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, comboBox1.Text, comboBox2.Text, dateTimePicker1.Value, richTextBox1.Text);
         }
     }
 }
Example #7
0
 public PickUpDiamond()
 {
     pickUpData      = new PickUpData();
     pickUpData.type = PickUpType.Diamond;
 }
Example #8
0
	public void RemoveAndInstantiateInventoryItem(int index, int direction, PickUpData pud){
		GameObject PickUp = (GameObject) Instantiate(Resources.Load<GameObject>("Prefabs/PickUps/"+pud.Name), new Vector2(transform.position.x+DropDistance*direction, transform.position.y), Quaternion.identity);
		PickUpData pu;
		pu.Name = null;
		pu.Type = (PickUp.PickUpType) 0;
		switch (index) {
		case 0:
			pu = InventorySlot1;
			InventorySlot1.Name = null;
			break;
		case 1:
			pu = InventorySlot2;
			InventorySlot2.Name = null;
			break;
		}
		PickUp.GetComponent<PickUp> ().Name = pu.Name;
		PickUp.GetComponent<PickUp> ().Type = pu.Type;
	}