示例#1
0
        // private List<T> SkinnedMeshRenderer;
        // private List<T> MeshFilterer;

        public void Start()
        {
            Debug.Log("New Game Object:" + gameObject.name);
            // We will use this to add our components to draw list
            capture_volume = FindObjectOfType <VoxieCaptureVolume>();

            // VoxieDraw objects cannot degenerate
            if (gameObject.tag == "VoxieDraw")
            {
                can_degen = false;
            }

            // We always want animations to be computed (as otherwise they would only appear when a camera was active)
            if (gameObject.GetComponent <Animator>())
            {
                transform.root.gameObject.GetComponent <Animator>().cullingMode = AnimatorCullingMode.AlwaysAnimate;
            }

            foreach (SkinnedMeshRenderer child in gameObject.GetComponentsInChildren <SkinnedMeshRenderer>())
            {
                child.gameObject.AddComponent <Component>();
                capture_volume.AddComponent(child.gameObject.GetComponent <Component>());
            }

            foreach (MeshRenderer child in gameObject.GetComponentsInChildren <MeshRenderer>())
            {
                child.gameObject.AddComponent <Component>();
                capture_volume.AddComponent(child.gameObject.GetComponent <Component>());
            }
        }
示例#2
0
        public static float GetAxis(string axis_name)
        {
            int A = (int)InputController.Instance.GetAxis(axis_name, 1);
            VoxieCaptureVolume vcv = FindObjectOfType(typeof(VoxieCaptureVolume)) as VoxieCaptureVolume;

            return(vcv.GetAxis(A, 0));
        }
示例#3
0
        // Multiplayer Input
        public static bool GetButton(string button_name, int player)
        {
            VoxieCaptureVolume vcv = FindObjectOfType(typeof(VoxieCaptureVolume)) as VoxieCaptureVolume;
            short B = (short)InputController.Instance.GetButton(button_name, 1);
            int   r = vcv.GetButtons(player) & B;

            return(r > 0);
        }
示例#4
0
        public static bool GetMouseButton(string button_name)
        {
            VoxieCaptureVolume vcv = FindObjectOfType(typeof(VoxieCaptureVolume)) as VoxieCaptureVolume;
            int A            = (int)InputController.Instance.GetMouseButton(button_name);
            int button_state = vcv.GetMouse().bstat & A;

            return(button_state != 0);
        }
示例#5
0
        public static bool GetButtonUp(string button_name)
        {
            VoxieCaptureVolume vcv = FindObjectOfType(typeof(VoxieCaptureVolume)) as VoxieCaptureVolume;
            short B                = (short)InputController.Instance.GetButton(button_name, 1);
            int   button_state     = vcv.GetButtons(0) & B;
            int   old_button_state = vcv.GetOldButtons(0) & B;

            return(old_button_state > 0 & button_state == 0);
        }
示例#6
0
        public static bool GetButtonDown(string button_name, int player)
        {
            VoxieCaptureVolume vcv = FindObjectOfType(typeof(VoxieCaptureVolume)) as VoxieCaptureVolume;
            int B                = (int)InputController.Instance.GetButton(button_name, 1);
            int button_state     = vcv.GetButtons(player - 1) & B;
            int old_button_state = vcv.GetOldButtons(player - 1) & B;

            return(old_button_state == 0 & button_state > 0);
        }
    // Update is called once per frame
    void Update()
    {
        if (vcv == null)
        {
            vcv = FindObjectOfType <VoxieCaptureVolume>();
            if (vcv == null)
            {
                Debug.LogError("Capture Volume not found!");
            }
        }

        aspect_ratio = vcv.GetAspectRatio();
        if (Voxon.Input.GetKey("Grow"))
        {
            vcv.Scale           += 1;
            vcv.Scale            = Math.Min(vcv.Scale, 1000);
            transform.localScale = aspect_ratio * vcv.Scale;
            Debug.Log("Scale: " + vcv.Scale);
        }

        if (Voxon.Input.GetKey("Shrink"))
        {
            vcv.Scale -= 1;
            vcv.Scale  = Math.Max(vcv.Scale, 1);

            transform.localScale = aspect_ratio * vcv.Scale;
            Debug.Log("Scale: " + vcv.Scale);
        }

        if (Voxon.Input.GetKey("Up"))
        {
            transform.Translate(transform.up * Time.deltaTime, Space.World);
        }

        if (Voxon.Input.GetKey("Down"))
        {
            transform.Translate(-1 * transform.up * Time.deltaTime, Space.World);
        }

        if (Voxon.Input.GetKey("Forward"))
        {
            transform.Translate(-1 * transform.forward * Time.deltaTime, Space.World);
        }
        if (Voxon.Input.GetKey("Backward"))
        {
            transform.Translate(transform.forward * Time.deltaTime, Space.World);
        }
        if (Voxon.Input.GetKey("Left"))
        {
            transform.Translate(-1 * transform.right * Time.deltaTime, Space.World);
        }
        if (Voxon.Input.GetKey("Right"))
        {
            transform.Translate(transform.right * Time.deltaTime, Space.World);
        }
    }
示例#8
0
 private static void PlayStateChange(PlayModeStateChange state)
 {
     // Handle Editor play states (block Play when Input disabled / close VX when Play stopped)
     if (state == PlayModeStateChange.ExitingPlayMode)
     {
         Debug.Log("Editor Play Stopping : Shutting down VX1 Simulator");
         VoxieCaptureVolume capture_volume = FindObjectOfType <VoxieCaptureVolume>();
         capture_volume.ShutdownVX1();
     }
 }
示例#9
0
        private void ExceptionHandler(String custom_message, Exception E)
        {
            if (custom_message != "")
            {
                Debug.LogError(custom_message);
            }

            Debug.LogError(E.Message);
            VoxieCaptureVolume capture_volume = FindObjectOfType <VoxieCaptureVolume>();

            capture_volume.ShutdownVX1();
        }
示例#10
0
        // Use this for initialization
        void Start()
        {
            capture_volume = FindObjectOfType <VoxieCaptureVolume>();
            capture_volume.AddText(this);

            string Text = "";

            ts = enc.GetBytes(Text);

            pr.x = 0.1f; pd.x = 0.0f; pp.x = -0.75f;
            pr.y = 0.0f; pd.y = 0.5f; pp.y = +0.5f;
            pr.z = 0.0f; pd.z = 0.0f; pp.z = 0.0f;
        }
示例#11
0
        public static bool GetMouseButtonDown(string button_name)
        {
            VoxieCaptureVolume vcv = FindObjectOfType(typeof(VoxieCaptureVolume)) as VoxieCaptureVolume;
            int A                = (int)InputController.Instance.GetMouseButton(button_name);
            int button_state     = vcv.GetMouse().bstat & A;
            int old_button_state = vcv.GetMouse().obstat & A;

            if (old_button_state == 0 & button_state != 0)
            {
                vcv.SetMouseSeen(A);
                return(true);
            }
            else
            {
                return(false);
            }
        }
 // Use this for initialization
 void Start()
 {
     vcv = FindObjectOfType <VoxieCaptureVolume>();
 }
    }                                                   //keep this

    // Update is called once per frame
    void Update()                                            //keep this
    {
        if (vcv == null)                                     //keep this
        {
            vcv = FindObjectOfType <VoxieCaptureVolume>();   //keep this
            if (vcv == null)                                 //keep this
            {                                                //keep this
                Debug.LogError("Capture Volume not found!"); //you don't have to keep this, but it doesn't make much sense to change it?
            }                                                //keep this
        }                                                    //keep this

        aspect_ratio = vcv.GetAspectRatio();                 //keep this


        //START AUBREY'S KEYBINDINGS (All OF THIS IS SAFE TO CHANGE)
        //these all manage movement
        if (Voxon.Input.GetKey("MoveRight"))
        {
            player.transform.Translate(-Vector3.right * speed * Time.deltaTime);
        }
        if (Voxon.Input.GetKey("MoveLeft"))
        {
            player.transform.Translate(-Vector3.left * speed * Time.deltaTime);
        }
        if (Voxon.Input.GetKey("MoveForward"))
        {
            player.transform.Translate(-Vector3.forward * speed * Time.deltaTime);
        }
        if (Voxon.Input.GetKey("MoveBack"))
        {
            player.transform.Translate(-Vector3.back * speed * Time.deltaTime);
        }
        if (Voxon.Input.GetKey("MoveUp"))
        {
            player.transform.Translate(-Vector3.up * speed * Time.deltaTime);
        }
        if (Voxon.Input.GetKey("MoveDown"))
        {
            player.transform.Translate(-Vector3.down * speed * Time.deltaTime);
        }
        if (Voxon.Input.GetKey("TiltUp"))
        {
            Debug.Log("Rotating up now");
            captureVolume.transform.Rotate(Vector3.up * speed * Time.deltaTime);
        }
        if (Voxon.Input.GetKey("TiltDown"))
        {
            captureVolume.transform.Rotate(Vector3.down * speed * Time.deltaTime);
        }
        if (Voxon.Input.GetKey("TiltRight"))
        {
            captureVolume.transform.Rotate(Vector3.right * speed * Time.deltaTime);
        }
        if (Voxon.Input.GetKey("TiltLeft"))
        {
            captureVolume.transform.Rotate(Vector3.left * speed * Time.deltaTime);
        }
        if (Voxon.Input.GetKey("MoveFaster"))
        {
            speed *= 1.1f;
        }
        if (Voxon.Input.GetKey("MoveSlower"))
        {
            speed %= 1.1f;
        }
        //these also manage movement, but they do so with the mouse instead of keyboad input
        //turns the player object red.
        if (Voxon.Input.GetKey("ChangeColor"))
        {
            rend.material.SetColor("_Color", Color.red);
        }
    }
 Vector3 aspect_ratio;                               //keep this
 // Use this for initialization
 void Start()                                        //keep this
 {
     vcv  = FindObjectOfType <VoxieCaptureVolume>(); //keep this
     rend = player.GetComponent <Renderer>();
 }                                                   //keep this