Untitled

 avatar
unknown
plain_text
a month ago
7.3 kB
2
Indexable
using UnityEngine;
using UnityEngine.SceneManagement;

public class TapToStart : MonoBehaviour
{
        void Update()
            {
                        if (Input.GetMouseButtonDown(0)) // Detect tap or mouse click
                                {
                                                SceneManager.LoadScene("MainGame"); // Load the main game scene
                                }
            }
}using UnityEngine;
using UnityEngine.UI;

public class TaskManager : MonoBehaviour
{
        public Text taskText;
            private string[] tasks = { "Cook food", "Wash dishes", "Clean floor", "Do laundry" };
                private int currentTaskIndex = 0;

                    void Start()
                        {
                                    UpdateTask();
                        }

                            public void CompleteTask()
                                {
                                            if (currentTaskIndex < tasks.Length - 1)
                                                    {
                                                                    currentTaskIndex++;
                                                                                UpdateTask();
                                                    }
                                                            else
                                                                    {
                                                                                    taskText.text = "All tasks completed!";
                                                                    }
                                }

                                    void UpdateTask()
                                        {
                                                    taskText.text = "Task: " + tasks[currentTaskIndex];
                                        }
}using UnityEngine;
using UnityEngine.UI;

public class ChopVegetable : MonoBehaviour
{
        public int tapsRequired = 5; // Number of taps needed to chop
            private int currentTaps = 0;
                public Image vegetableImage; // Assign in Inspector
                    public Sprite choppedSprite; // Chopped version of the vegetable

                        void OnMouseDown() // Detect tap/click
                            {
                                        currentTaps++;

                                                if (currentTaps >= tapsRequired)
                                                        {
                                                                        ChopComplete();
                                                        }
                            }

                                void ChopComplete()
                                    {
                                                if (choppedSprite != null)
                                                        {
                                                                        vegetableImage.sprite = choppedSprite; // Change image to chopped version
                                                        }
                                                                Debug.Log("Vegetable Chopped!");
                                    }
}using UnityEngine;

public class DragClothes : MonoBehaviour
{
        private Vector3 offset;
            private bool isDragging = false;
                public Transform washingMachine; // Assign in Inspector

                    void OnMouseDown()
                        {
                                    offset = transform.position - GetMouseWorldPos();
                                            isDragging = true;
                        }

                            void OnMouseDrag()
                                {
                                            if (isDragging)
                                                    {
                                                                    transform.position = GetMouseWorldPos() + offset;
                                                    }
                                }

                                    void OnMouseUp()
                                        {
                                                    isDragging = false;

                                                            if (Vector3.Distance(transform.position, washingMachine.position) < 1.5f)
                                                                    {
                                                                                    Debug.Log("Clothes inside the washing machine!");
                                                                                                gameObject.SetActive(false); // Hide clothes after dragging
                                                                    }
                                        }

                                            Vector3 GetMouseWorldPos()
                                                {
                                                            Vector3 mousePoint = Input.mousePosition;
                                                                    mousePoint.z = Camera.main.WorldToScreenPoint(transform.position).z;
                                                                            return Camera.main.ScreenToWorldPoint(mousePoint);
                                                }
}using UnityEngine;

public class TapToChop : MonoBehaviour
{
        public int tapsRequired = 5;
            private int currentTaps = 0;

                void Update()
                    {
                                if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
                                        {
                                                        Chop();
                                        }
                    }

                        void Chop()
                            {
                                        currentTaps++;
                                                if (currentTaps >= tapsRequired)
                                                        {
                                                                        Debug.Log("Chopping Complete!");
                                                        }
                            }
}
                                                        }
                            }
                                        }
                    }
}
                                                }
                                                                    }
                                        }
                                                    }
                                }
                        }
}
                                                        }
                                    }
                                                        }
                            }
}
                                        }
                                                                    }
                                                    }
                                }
                        }
}
                                }
            }
}
Editor is loading...
Leave a Comment