Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (ghost)
        {
            set_alpha(0.5f);

            Transform nearest_platform = get_nearest_platform();

            if (nearest_platform != null)
            {
                gameObject.transform.position = nearest_platform.position;

                if (Input.GetMouseButtonDown(0))
                {
                    gameObject.transform.parent = nearest_platform;
                    ghost = false;
                    set_alpha(1.0f);
                    manager.turret_built(value);
                }
            }
            else
            {
                gameObject.transform.position = Vector3.one * 1000;

                if (Input.GetMouseButtonDown(0))
                {
                    manager.destroy_current();
                }
            }

            return;
        }
    }