Ejemplo n.º 1
0
    void OnTrigger(BlockContorl blockContorl)
    {
        Collider collider = blockContorl.OnCollider;

        blockContorl.OnCollider = null;

        if (collider == null)
        {
            return;
        }

        Block block = new Block(collider.gameObject);

        if (block.GetColor() == Color.black)
        {
            GameContorl.GoodGame();
        }


        foreach (var item in FoodContorl.FoodList)
        {
            if (item.GameObject == collider.gameObject)
            {
                Body body = Body.BodyFrom(item);
                if (!Head.BodyList.Contains(body))
                {
                    Head.AddBody(body);
                    FoodContorl.FoodList.Remove(item);
                }
                return;
            }
        }
    }
Ejemplo n.º 2
0
    public void Init(string Name, Color Color, float Size, Vector3 pos, GameObject Perent)
    {
        GameObject.name = Name;
        GameObject.transform.SetParent(Perent.transform);

        BlockContorl = GameObject.GetComponent <BlockContorl>();
        //Animation = Gameobject.GetComponent<Animation>();
        Transform = GameObject.GetComponent <Transform>();

        Transform.position = pos;

        SetColor(Color);
        SetSize(Size);
    }