示例#1
0
    void OnTriggerStay(Collider other)
    {
        FurnitureProperty furScript = null;

        furScript = other.gameObject.GetComponent <FurnitureProperty> ();
        if (furScript != null)
        {
            if (furScript.furnitureTag == holdFlag)
            {
                Camera.main.GetComponent <CameraMovement> ().followState = 1;
                StartCoroutine(EnterGame(furScript.furnitureTag));
            }
        }
    }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            v3location = transform.position;

            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            //Debug.DrawLine (ray.origin, ray.origin + 300 * ray.direction, Color.red, 2f);
            if (Physics.Raycast(ray, out hitInfo, 300f, 1 << LayerMask.NameToLayer("Road")) && movementScript.navAgentOn)                //Navigate to the destination
            {
                v3destination = FineTuneDestination(hitInfo.point, hitInfo);
                destOn        = hitInfo.collider.gameObject.GetComponent <RoadProperty>().regionNumber;        //Determine the region destination is in
                GetComponent <AnimationController> ().holdFlag    = "";
                GetComponent <AnimationController> ().holdFlagTwo = false;
                camMovement.followState = 0;
                FurnitureProperty furScript = null;
                furScript = hitInfo.collider.gameObject.GetComponent <FurnitureProperty> ();
                if (furScript != null)
                {
                    if (hitInfo.collider.gameObject.GetComponent <FurnitureProperty> ().furnitureType.Equals("Game"))
                    {
                        Debug.Log("Goint to play game " + furScript.furnitureTag);
                        camMovement.SetFurniture(hitInfo.collider.gameObject);
                        GetComponent <AnimationController> ().holdFlag = furScript.furnitureTag;
                        v3destination = furScript.position;
                        //Debug.Log (v3destination);
                        Debug.DrawLine(v3destination, (v3destination + new Vector3(0f, 20f, 0f)), Color.red, 2f);
                    }
                }

                if (hitInfo.collider.gameObject.tag.Equals("RegionFour"))
                {
                    GetComponent <AnimationController> ().holdFlagTwo = true;
                }


                NavigateTo();
            }
        }

        if (Input.GetMouseButtonDown(1))          //For debug use only
        {
            navAgent.SetDestination(v3nodes[1]);  //Crossing
            GetComponent <AnimationController> ().holdFlag    = "";
            GetComponent <AnimationController> ().holdFlagTwo = false;
            camMovement.followState = 0;
        }
    }
示例#3
0
    public void LoadList(string category)
    {
        SpawnList spawnList = spawner.GetComponent <SpawnList>();

        currentCategory = category;
        // set title
        titleLabel.GetComponent <Text>().text = spawnList.getCategoryTitle(currentCategory);

        furnitures = spawnList.findBundle(category);

        int currentIndex = 0;

        if (pageHistory.ContainsKey(category))
        {
            currentIndex = pageHistory[category];
        }
        else
        {
            pageHistory[category] = 0;
        }

        int i = currentIndex * pageSize;

        foreach (GameObject furnitureBtn in furniturePage)
        {
            if (i < Math.Min(furnitures.Count, (currentIndex + 1) * pageSize))
            {
                furnitureBtn.SetActive(true);
                GameObject        f          = furnitures[i];
                FurnitureProperty properties = spawnList.findAssetProperties(category, f.name);
                furnitureBtn.GetComponent <FurnitureMenuItemProperty>().furnitureProperty = properties;
                furnitureBtn.GetComponent <FurnitureMenuItemProperty>().index             = i;
                if (!category.Contains("paint"))
                {
                    furnitureBtn.GetComponent <Image>().sprite   = spawnList.findAssetIcon(category, i);
                    furnitureBtn.GetComponent <Image>().material = null;
                }
                else
                {
                    furnitureBtn.GetComponent <Image>().sprite   = null;
                    furnitureBtn.GetComponent <Image>().material = spawnList.findPaintIcon(i);
                }
                i++;
            }
            else
            {
                furnitureBtn.SetActive(false);
            }
        }

        if (furnitures.Count <= pageSize)
        {
            forward.SetActive(false);
            backward.SetActive(false);
        }
        else if (currentIndex == 0)
        {
            forward.SetActive(true);
            backward.SetActive(false);
        }
        else if ((furnitures.Count - currentIndex * pageSize) <= pageSize)
        {
            forward.SetActive(false);
            backward.SetActive(true);
        }
        else
        {
            backward.SetActive(true);
            forward.SetActive(true);
        }
    }
 set => SetValue(FurnitureProperty, value);