Exemplo n.º 1
0
    private void Update()
    {
        if (canInteract)
        {
            if (Input.GetKeyDown(interactKey1) || Input.GetKeyDown(interactKey2))
            {
                if (target == null)
                {
                    return;
                }

                DirtTile dirt = target.GetComponent <DirtTile>();
                if (dirt != null)
                {
                    for (int i = 0; i < tool.seeds.Length; i++)
                    {
                        if (tool.seeds[i].isSelected)
                        {
                            crop = tool.seeds[i].crop;
                        }
                    }
                    dirt.Interact(crop, tool, this);
                    crop = new Crop(null);
                }

                TrashCan trashcan = target.GetComponent <TrashCan>();
                {
                    if (trashcan)
                    {
                        //trashcan.Interact(crop, tool, this);
                    }
                }

                Fishing fishing = target.GetComponent <Fishing>();
                {
                    if (fishing)
                    {
                        fishing.Interact(tool, this);
                    }
                }

                RefillWater refillWater = target.GetComponent <RefillWater>();
                {
                    if (refillWater)
                    {
                        refillWater.Interact(tool, this);
                    }
                }
            }
        }
    }
Exemplo n.º 2
0
    private void Update()
    {
        if (Input.GetKeyDown(interactKey))
        {
            if (target == null)
            {
                return;
            }

            DirtTile dirt = target.GetComponent <DirtTile>();
            if (dirt != null)
            {
                dirt.Interact(crop, tool, this);
            }

            TableTile table = target.GetComponent <TableTile>();
            if (table != null)
            {
                table.Interact(crop, tool, this);
            }

            TrashCan trashCan = target.GetComponent <TrashCan>();
            if (trashCan != null)
            {
                trashCan.Interact(crop, tool, this);
            }

            Truck truck = target.GetComponent <Truck>();
            if (truck != null)
            {
                truck.Interact(crop, this);
            }

            SeedBarrel barrel = target.GetComponent <SeedBarrel>();
            if (barrel != null)
            {
                barrel.Interact(crop, tool, this);
            }
        }
    }