コード例 #1
0
    private void SantaActionWithoutCtrl()
    {
        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        if (Physics.Raycast(ray, out hit, 10000, ClickableLayer))
        {
            //Caching the hit object
            GameObject hitObject = hit.collider.gameObject;

            //Caching the santa component
            Santa santaComponent = selectedSanta.GetComponent <Santa>();

            if (hitObject.tag == "Gift")
            {
                santaComponent.clickDestination(hitObject.GetComponent <Gift>());
                hitObject.GetComponent <Gift>().SelectGift(santaComponent.id);
            }

            if (hitObject.tag == "House")
            {
                santaComponent.clickDestination(hitObject.GetComponent <House>());
                hitObject.GetComponent <House>().SelectHouse(santaComponent.id);
            }
        }
    }