示例#1
0
    public Toy InitToyObj(Island_Button island_b, string toy_name, bool fake)
    {
        if (island_b.my_toy != null && island_b.my_toy.gameObject.activeSelf)
        {
            throw new Exception("Adding toy " + toy_name + " to an island " + island_b.name + " that already has a toy\n");
        }

        GameObject parent = island_b.parent;
        Vector3    posv   = parent.transform.position;

        island_b.setBlocked(true);
        GameObject toy_obj = zoo.getObject("Toys/" + toy_name, false);

        toy_obj.tag   = "Player";
        toy_obj.layer = 10;

        Toy toy = toy_obj.GetComponent <Toy>();

        toy_obj.transform.SetParent(parent.transform);
        toy_obj.transform.position      = posv;
        toy_obj.transform.localScale    = Vector3.one;// = Vector3.one;
        toy_obj.transform.localRotation = Quaternion.identity;
        toy_obj.SetActive(true);
        StationaryZ z = toy_obj.GetComponent <StationaryZ>();

        if (z != null)
        {
            z.Init();
        }

        return(toy);
    }
示例#2
0
    IEnumerator DisableMe()
    {
        while (my_time > 0)
        {
            yield return(new WaitForSeconds(interval));

            my_time -= interval;
        }
        my_button.setBlocked(false);
        my_button = null;

        Peripheral.Instance.zoo.returnObject(this.gameObject);

        yield return(null);
    }
示例#3
0
文件: Toy.cs 项目: Valensta/otherside
    public void Die(float delay)
    {
        if (tag.Equals("Player") && toy_type == ToyType.Normal && runetype != RuneType.Modulator)
        {
            Peripheral.Instance.decrementToys();
        }
        if (island != null)
        {
            island.my_toy = null;
            island.setBlocked(false);
            transform.SetParent(null);
        }



        StartCoroutine(DiePretty(delay));
    }