Inheritance: MonoBehaviour
Beispiel #1
0
	void OnGUI () {
		if(!camera){
		Debug.Log ("Camera not assigned!");	
			return;
		}else if(mouseOrbit == null){
		mouseOrbit = camera.GetComponent<MouseOrbit>();	
		}
		if(curName == "none"){
		EnableView ();
		}
	GUI.BeginGroup(new Rect(Screen.width*0.5f-80f,Screen.height-60f,160f,60f));
	GUILayout.BeginVertical ();
	GUILayout.Label("Current view:\n"+curName);
	GUILayout.BeginHorizontal ();
	if(GUILayout.Button ("<",GUILayout.Width(40))){
	curCam--;
	curCam = Mathf.Clamp (curCam,0,objects.Length);
	EnableView ();
		}else if(GUILayout.Button (">",GUILayout.Width(40))){
	curCam++;
	curCam = Mathf.Clamp (curCam,0,objects.Length);
	EnableView ();
	}
	GUILayout.EndHorizontal ();
	GUILayout.EndVertical();
	GUI.EndGroup();
	}
        bool locateMouseOrbit()
        {
            if (theMouseOrbit == null || theMouseOrbit.gameObject == null)
            {
                if (Camera.main != null && Camera.main.GetComponent <MouseOrbit>() != null)
                {
                    theMouseOrbit     = Camera.main.GetComponent <MouseOrbit>();
                    mouseOrbitMainCam = Camera.main;
                    if (defaultFoV == 114514)
                    {
                        defaultFoV = mouseOrbitMainCam.fieldOfView;
                    }
                    theMouseOrbit.focusLerpSmooth = 1145141919;
                    //theMouseOrbit.yMaxLimit = 893893;
                    //theMouseOrbit.yMinLimit = -893893;
                    //theMouseOrbit.xSpeed = 99999;
                    //theMouseOrbit.ySpeed = 99999;

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(true);
        }
Beispiel #3
0
        // Unity Event Handlers

        protected void Awake()
        {
            // Attempt to reference active mouse orbit script
            m_mouseOrbitScript = GetComponent <MouseOrbit>();

            // Load previous settings from INI file
            LoadSettings();

            // Create line dictionary and data queue
            m_scales    = new ConcurrentDictionary <string, Scale>();
            m_dataLines = new ConcurrentDictionary <Guid, DataLine>();
            m_dataQueue = new ConcurrentQueue <IList <Measurement> >();

            // Initialize status rows and timer to hide status after a period of no updates
            m_statusText = new string[m_statusRows];

            for (int i = 0; i < m_statusRows; i++)
            {
                m_statusText[i] = "";
            }

            m_hideStatusTimer = new Timer
            {
                AutoReset = false,
                Interval  = StatusDisplayInterval
            };

            m_hideStatusTimer.Elapsed += HideStatusTimer_Elapsed;

            VectorLine.SetCanvasCamera(Camera.main);
            VectorLine.canvas.hideFlags = HideFlags.HideInHierarchy;
        }
Beispiel #4
0
	void OnDrag() {

		if (cameraOrbitScript == null) {
			cameraOrbitScript = Camera.main.GetComponent<MouseOrbit> ();
		}
		cameraOrbitScript.OnDrag();
	}
Beispiel #5
0
    // Update is called once per frame
    void Update()
    {
        transform.Translate(new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Level"), Input.GetAxis("Vertical")) * sensitivity);

        if (mouselook)
        {
            if (clickToMouselook && !Input.GetMouseButton(0))
            {
                return;
            }

            // x += Mathf.Sign(Input.mousePosition.x - prevX ) * 0.02f;
            // y -= Mathf.Sign(Input.mousePosition.y - prevY ) * 0.02f;
            x += (Input.mousePosition.x - prevX) * xSpeed * 0.02f;
            y -= (Input.mousePosition.y - prevY) * ySpeed * 0.02f;

            y = MouseOrbit.ClampAngle(y, yMinLimit, yMaxLimit);

            // Vector3 eulerAngles = transform.rotation.eulerAngles;

            // transform.rotation = Quaternion.Euler(eulerAngles.x + y, eulerAngles.y + x, 0);
            transform.rotation = Quaternion.Euler(y, x, 0);
        }
        prevX = Input.mousePosition.x;
        prevY = Input.mousePosition.y;
    }
Beispiel #6
0
    void Start()
    {
        mouseOrbitInstance = GameObject.FindObjectOfType <MouseOrbit>();
        //m_Animator = GetComponent<Animator>();

        //if (Effects.Length > 0)
        //{
        //    mEffectNode = new EffectNode[Effects.Length];
        //    for (int i = 0; i < Effects.Length; i++)
        //    {
        //        mEffectNode[i] = Effects[i].GetComponent<EffectNode>();
        //        if (!mEffectNode[i])
        //        {
        //            Debug.LogError(Effects[i].name + ",没有挂EffectNode脚本!");
        //            return;
        //        }
        //        mEffectNode[i].Init();
        //    }

        //}
        //else
        //{
        //    Debug.LogWarning("Effects为空,请添加特效,再进入play模式!");
        //}

        if (MoveObject)
        {
            OrginalPosition = MoveObject.position;
            LastMoveObject  = MoveObject;
        }

        ImageSetting.SetImageQuality(ImageQuality.Best);
    }
 // Use this for initialization
 void Start()
 {
     moons = GameObject.FindGameObjectsWithTag("Moon");
     planets = GameObject.FindGameObjectsWithTag("Planet");
     targetPlanet = moons[0];
     camera = Camera.main;
     camMOscript = camera.GetComponent<MouseOrbit>();
 }
	void Start()
	{
		mouseOr = cam.GetComponent<MouseOrbit>();
		mouseOr.enabled = true;
		lose.SetActive (false);
		win.SetActive (false);
		returnMenu.SetActive (false);
		restart.SetActive (false);
	}
Beispiel #9
0
    IEnumerator WaitForCamera()
    {
        yield return(new WaitForSecondsRealtime(.5f));

        //Wait because index wont be in range at very start
        mainCamera        = this.gameObject.transform.GetChild(6).gameObject;
        mouseOrbit        = mainCamera.GetComponent <MouseOrbit>();
        mouseOrbit.target = this.gameObject.transform;
    }
Beispiel #10
0
 void Awake()
 {
     PlayTime       = 0;
     OriginPosition = transform.position;
     seeker         = GetComponent <Seeker>();
     target         = GameObject.FindGameObjectWithTag("Greta").transform;
     //Gretacontroller = GameObject.Find("Greta").GetComponent<GretaController>();
     Gretacontroller = GameObject.FindGameObjectWithTag("Greta").GetComponent <GretaController>();
     mouse           = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <MouseOrbit>();
 }
Beispiel #11
0
    void InitCameraComponents()
    {
        mouseOrbit = Camera.main.GetComponent <MouseOrbit>();

        if (mouseOrbit == null)
        {
            mouseOrbit = Camera.main.gameObject.AddComponent <MouseOrbit>();
        }

        mouseOrbit.SetActive(true);
    }
Beispiel #12
0
    void Start()
    {
        Instance = this;
        Vector3 angles = transform.eulerAngles;
        x = angles.y;
        y = angles.x;

        // Make the rigid body not change rotation
        //if (rigidbody)
        //	rigidbody.freezeRotation = true;
    }
Beispiel #13
0
    void Start()
    {
        Instance = this;
        Vector3 angles = transform.eulerAngles;

        x = angles.y;
        y = angles.x;

        // Make the rigid body not change rotation
        //if (rigidbody)
        //	rigidbody.freezeRotation = true;
    }
Beispiel #14
0
 // Use this for initialization
 void Start()
 {
     rb = GetComponent <Rigidbody>();
     uitxtSpeed.text    = "--";
     uitxtAltitude.text = "--";
     freeLook           = false;
     sf2 = GameObject.Find("MainCamera").GetComponent <SmoothFollowImproved> ();
     mo  = GameObject.Find("MainCamera").GetComponent <MouseOrbit> ();
     spotlightSoundFX = heliSpotlight.GetComponent <AudioSource> ();
     // Spotlight:
     light1 = heliSpotlight.GetComponent <Light> ();
     light2 = heliSpotlight2.GetComponent <Light> ();
 }
Beispiel #15
0
 public override void LateUpdate()
 {
     if (this.target)
     {
         this.x += Input.GetAxis("Mouse X") * this.xSpeed * 0.02f;
         this.y -= Input.GetAxis("Mouse Y") * this.ySpeed * 0.02f;
         this.y  = MouseOrbit.ClampAngle(this.y, (float)this.yMinLimit, (float)this.yMaxLimit);
         Quaternion rotation = Quaternion.Euler(this.y, this.x, (float)0);
         Vector3    position = rotation * new Vector3((float)0, (float)0, -this.distance) + this.target.position;
         this.transform.rotation = rotation;
         this.transform.position = position;
     }
 }
Beispiel #16
0
 public void LateUpdate()
 {
     if (this.target)
     {
         this.x += Input.GetAxis("Mouse X") * this.xSpeed * 0.02f;
         this.y -= Input.GetAxis("Mouse Y") * this.ySpeed * 0.02f;
         this.y  = MouseOrbit.ClampAngle(this.y, (float)this.yMinLimit, (float)this.yMaxLimit);
         Quaternion quaternion = Quaternion.Euler(this.y, this.x, (float)0);
         Vector3    position   = quaternion * new Vector3(0f, 0f, this.distance * (float)-1) + this.target.get_position();
         this.get_transform().set_rotation(quaternion);
         this.get_transform().set_position(position);
     }
 }
Beispiel #17
0
 public virtual void LateUpdate()
 {
     if (this.target)
     {
         this.x = this.x + ((Input.GetAxis("Mouse X") * this.xSpeed) * 0.02f);
         this.y = this.y - ((Input.GetAxis("Mouse Y") * this.ySpeed) * 0.02f);
         this.y = MouseOrbit.ClampAngle(this.y, this.yMinLimit, this.yMaxLimit);
         Quaternion rotation = Quaternion.Euler(this.y, this.x, 0);
         Vector3    position = (rotation * new Vector3(0f, 0f, -this.distance)) + this.target.position;
         this.transform.rotation = rotation;
         this.transform.position = position;
     }
 }
 // Use this for initialization
 void Start()
 {
     HPScript  = GetComponent <PlayerHealthScript>();
     pauseMenu = GameObject.Find("PauseMenuFill");
     pauseMenu.SetActive(false);
     campos                = mainCam.GetComponent <CamPos>();
     mouseorbit            = GetComponentInChildren <MouseOrbit> ();
     transform.eulerAngles = new Vector3(0, 0, 90f);
     isCam2                = false;
     cam2.SetActive(isCam2);
     gameObject.audio.pitch = 0.7f;
     isPaused          = false;
     Screen.showCursor = false;
 }
        public void CopyFrom(MouseOrbit o)
        {
            target                  = o.target;
            distance                = o.distance;
            xSpeed                  = o.xSpeed;
            ySpeed                  = o.ySpeed;
            yMinLimit               = o.yMinLimit;
            yMaxLimit               = o.yMaxLimit;
            x                       = o.x;
            y                       = o.y;
            smooth                  = o.smooth;
            wasdPosOffset           = o.wasdPosOffset;
            wasdSpeed               = o.wasdSpeed;
            zoomSmooth              = o.zoomSmooth;
            introDuration           = o.introDuration;
            introXamount            = o.introXamount;
            introYamount            = o.introYamount;
            filmCamSmooth           = o.filmCamSmooth;
            panSpeed                = o.panSpeed;
            machineTarget           = o.machineTarget;
            focusObject             = o.focusObject;
            focusLerpSmooth         = o.focusLerpSmooth;
            dofTarget               = o.dofTarget;
            minZoom                 = o.minZoom;
            maxZoom                 = o.maxZoom;
            mouseSensitivityScaler  = o.mouseSensitivityScaler;
            scrollSensitivityScaler = o.scrollSensitivityScaler;
            fixedCam                = o.fixedCam;
            fixedCamObj             = o.fixedCamObj;
            fixedCamLookAt          = o.fixedCamLookAt;
            fixedCamLerpPosSpeed    = o.fixedCamLerpPosSpeed;
            fixedCamLerpRotSpeed    = o.fixedCamLerpRotSpeed;
            lerpedUpVector          = o.lerpedUpVector;
            yPosClamp               = o.yPosClamp;
            hud3Dcam                = o.hud3Dcam;

            forward  = Keybindings.Get("Forward");
            backward = Keybindings.Get("Backward");
            left     = Keybindings.Get("Left");
            right    = Keybindings.Get("Right");
            up       = Keybindings.Get("Up");
            down     = Keybindings.Get("Down");
            menu     = Keybindings.Get("Menu");

            wasdSpeed = Configuration.GetFloat("wasdSpeed", wasdSpeed);
            scrollSensitivityScaler = Configuration.GetFloat("scrollSpeed",
                                                             scrollSensitivityScaler);
            fov             = Configuration.GetFloat("fov", Camera.main.fieldOfView);
            focusLerpSmooth = Configuration.GetFloat("focusLerpSmooth", focusLerpSmooth);
        }
    public void CopyFrom(MouseOrbit o)
    {
      target = o.target;
      distance = o.distance;
      xSpeed = o.xSpeed;
      ySpeed = o.ySpeed;
      yMinLimit = o.yMinLimit;
      yMaxLimit = o.yMaxLimit;
      x = o.x;
      y = o.y;
      smooth = o.smooth;
      wasdPosOffset = o.wasdPosOffset;
      wasdSpeed = o.wasdSpeed;
      zoomSmooth = o.zoomSmooth;
      introDuration = o.introDuration;
      introXamount = o.introXamount;
      introYamount = o.introYamount;
      filmCamSmooth = o.filmCamSmooth;
      panSpeed = o.panSpeed;
      machineTarget = o.machineTarget;
      focusObject = o.focusObject;
      focusLerpSmooth = o.focusLerpSmooth;
      dofTarget = o.dofTarget;
      minZoom = o.minZoom;
      maxZoom = o.maxZoom;
      mouseSensitivityScaler = o.mouseSensitivityScaler;
      scrollSensitivityScaler = o.scrollSensitivityScaler;
      fixedCam = o.fixedCam;
      fixedCamObj = o.fixedCamObj;
      fixedCamLookAt = o.fixedCamLookAt;
      fixedCamLerpPosSpeed = o.fixedCamLerpPosSpeed;
      fixedCamLerpRotSpeed = o.fixedCamLerpRotSpeed;
      lerpedUpVector = o.lerpedUpVector;
      yPosClamp = o.yPosClamp;
      hud3Dcam = o.hud3Dcam;

      forward = Keybindings.Get("Forward");
      backward = Keybindings.Get("Backward");
      left = Keybindings.Get("Left");
      right = Keybindings.Get("Right");
      up = Keybindings.Get("Up");
      down = Keybindings.Get("Down");
      menu = Keybindings.Get("Menu");

      wasdSpeed = Configuration.GetFloat("wasdSpeed", wasdSpeed);
      scrollSensitivityScaler = Configuration.GetFloat("scrollSpeed",
        scrollSensitivityScaler);

      fov = Configuration.GetFloat("fov", Camera.main.fieldOfView);
    }
	void OnLevelWasLoaded(int currentLevel)
	{
		if (currentLevel == 1) 
		{
			cameraRotation = GameObject.Find ("CameraRotation");
			if (cameraRotation != null) 
			{
				unitFSM.FsmVariables.GetFsmGameObject ("CameraRotation").Value = cameraRotation;
				orbit = cameraRotation.GetComponentInChildren<MouseOrbit> ();
			}
			else
				Debug.LogError ("Missing CameraRotation");
		}
	}
Beispiel #22
0
 // Use this for initialization
 void Start()
 {
     isPaused         = false;
     proficiencyLevel = 0.0f;
     numSpheres       = GameObject.Find("Spheres").transform.childCount;
     Time.timeScale   = 1.0F;
     mo       = GameObject.Find("MainCamera").GetComponent <MouseOrbit> ();
     offset   = particleSys.transform.position - mainCamera.transform.position;
     audiosrc = inGameMenu.GetComponent <AudioSource> ();
     audiosrc.ignoreListenerPause = true;
     youwinAudioSrc = GameObject.Find("CanvasMissionAccomplished").GetComponents <AudioSource> ()[0];
     youwinAudioSrc.ignoreListenerPause = true;
     militarychatter2 = GameObject.Find("CanvasMissionAccomplished").GetComponents <AudioSource> ()[1];
     militarychatter2.ignoreListenerPause = true;
 }
	// Use this for initialization
	void Start () 
	{
		GO = gameObject;
		cameraHelper = new GameObject("CameraHelper");

		Subs = GetComponent<SubsystemList> ();
		CreateClones ();

		mainCam = Camera.main;
		orbitNav = mainCam.GetComponent<MouseOrbit>();
		mainPos = GO.transform.position;

		meshes = GetComponentsInChildren<MeshRenderer>();
		PrepareForAlphaBlending ();
		m_alpha = alphaMax;
	}
Beispiel #24
0
    // Update is called once per frame
    void Update()
    {
        transform.Translate(new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Level"), Input.GetAxis("Vertical")) * sensitivity);

        if (mouselook)
        {
            x += (Input.mousePosition.x - prevX) * xSpeed * 0.02f;
            y -= (Input.mousePosition.y - prevY) * ySpeed * 0.02f;

            y = MouseOrbit.ClampAngle(y, yMinLimit, yMaxLimit);

            transform.rotation = Quaternion.Euler(y, x, 0);

            prevX = Input.mousePosition.x;
            prevY = Input.mousePosition.y;
        }
    }
        public override void OnSimulateStart_EnhancementEnabled()
        {
            firstPerson = fixedCamera.CamMode == FixedCameraBlock.Mode.FirstPerson;

            //Initialise the SmoothLook component
            fixedCameraController = FindObjectOfType <FixedCameraController>();
            mouseOrbit            = FindObjectOfType <MouseOrbit>();
            foreach (var camera in fixedCameraController.cameras)
            {
                if (camera.BuildIndex == selfIndex)
                {
                    if (firstPersonMode)
                    {
                        smooth = Mathf.Clamp01(firstPersonSmooth);
                    }
                    else
                    {
                        smooth = Mathf.Clamp01(camera.SmoothSlider.Value);
                    }
                    SetSmoothing();
                }
            }
            newCamFOV    = orgCamFOV = fixedCamera.fovSlider.Value;
            camFOVSmooth = Mathf.Exp(smooth) / Mathf.Exp(1) / 2f;
            if (cameraLookAtToggled)
            {
                // Initialise
                searchStarted = targetInitialCJOrHJ = false;
                pauseTracking = autoSearch = targetAquired = true;
                float searchAngleMax = Mathf.Clamp(Mathf.Atan(Mathf.Tan(fixedCamera.fovSlider.Value * Mathf.Deg2Rad / 2) * Camera.main.aspect) * Mathf.Rad2Deg, 0, 90);
                searchAngle = Mathf.Clamp(searchAngle, 0, searchAngleMax);
                target      = null;
                if (!StatMaster.isMP)
                {
                    clustersInSafetyRange.Clear();
                    foreach (var cluster in Machine.Active().simClusters)
                    {
                        if ((cluster.Base.transform.position - fixedCamera.transform.position).magnitude < safetyRadiusAuto)
                        {
                            clustersInSafetyRange.Add(cluster);
                        }
                    }
                }
                StopAllCoroutines();
            }
        }
Beispiel #26
0
 public void ResetCam()
 {
     GuiDisplayBase.displayGUIs = false;
     foreach (PlayerSetupBase current in Objects.Instance.Players.Objects)
     {
         UnityEngine.Object.Destroy(current.gameObject);
     }
     justOrbitCam = R_Avatars.JustOrbitCamera.InstantiateACopy().gameObject;
     justOrbitCam.transform.position = new Vector3(0, 50, 0);
     justOrbitCam.transform.rotation = Quaternion.LookRotation(Vector3.right, Vector3.up);
     flycam            = justOrbitCam.AddComponent <MouseLook>();
     flycam.enabled    = true;
     orbitcam          = justOrbitCam.GetComponent <MouseOrbit>();
     orbitcam.enabled  = false;
     orbitcam.distance = 100;
     orbitcam.OperateRegardlessOfUiOptions = true;
     orbitcam.UseOrbitTargetRotation       = false;
 }
    // Use this for initialization
    void Start()
    {
		thirdPersonController = GetComponent<ThirdPersonController>();
        thirdPersonFlyingController = GetComponent<ThirdPersonFlyingController>();
		
		mouseOrbit = GameObject.Find("LookTarget").GetComponent<MouseOrbit>();
        mouseAimFlying = GameObject.Find("LookTarget").GetComponent<MouseFlying>();

		//playerLookTarget = GetComponent<PlayerLookTarget>();
		headLookController = GetComponent<HeadLookController>();
				
		
		_lookDirection = thirdPersonController.MoveDirection();
		_inAirVelocity = 0.0f;

        _health = 100;
		
		_catsCollected = 0;
    }
    // Use this for initialization
    void Start()
    {
        thirdPersonController       = GetComponent <ThirdPersonController>();
        thirdPersonFlyingController = GetComponent <ThirdPersonFlyingController>();

        mouseOrbit     = GameObject.Find("LookTarget").GetComponent <MouseOrbit>();
        mouseAimFlying = GameObject.Find("LookTarget").GetComponent <MouseFlying>();

        //playerLookTarget = GetComponent<PlayerLookTarget>();
        headLookController = GetComponent <HeadLookController>();


        _lookDirection = thirdPersonController.MoveDirection();
        _inAirVelocity = 0.0f;

        _health = 100;

        _catsCollected = 0;
    }
Beispiel #29
0
 void Start()
 {
     //camera.backgroundColor = new Color(3, 3, 3, 0.2f);
     getResolution();
     SSAOEFF     = gameObject.GetComponent <SSAOEffect>();
     REPost      = gameObject.GetComponent <REPostProcessorEffect>();
     Mouse       = gameObject.GetComponent <MouseOrbit>();
     GretaPlayer = GameObject.Find("Greta");
     Greta       = GretaPlayer.GetComponentInChildren <GretaController>();
     LoadSetting();
     ApplySetting();
     Init_GUITBG();
     Background.color       = new Color(0.5f, 0.5f, 0.5f, 0.4f);
     this.audio.clip        = BackgroundMusic;
     this.audio.volume      = PlayerPrefs.GetInt("Music") * 0.1f;
     this.audio.playOnAwake = true;
     this.audio.loop        = true;
     this.audio.Play();
 }
    // Update is called once per frame
    void Update()
    {
        SmoothFollow sf = Camera.main.GetComponent <SmoothFollow>();
        MouseOrbit   mo = Camera.main.GetComponent <MouseOrbit>();

        if (sf.enabled)
        {
            if (Vector3.Distance(sf.target.position, Camera.main.transform.position) - sf.distance < sf.distance / 100f)
            {
                sf.enabled  = false;
                mo.enabled  = true;
                mo.target   = sf.target;
                mo.distance = sf.distance;
            }
        }

#if UNITY_EDITOR || UNITY_STANDALONE
        if (Input.GetKeyDown(KeyCode.Space))
#elif UNITY_ANDROID
        if (Input.GetTouch(0).tapCount == 2)
#endif
        {
            mo.enabled = false;
            int index = Random.Range(0, planets.Count - 1);
            sf.target   = planets[index].transform;
            sf.distance = 2 * sf.target.localScale.x;
            sf.height   = 0;
            sf.enabled  = true;
        }
#if UNITY_ANDROID
        //if(Input.GetTouch(0).tapCount == 1)
        //{
        //    Touch t = Input.GetTouch(0);
        //    Input.
        //}
#endif
    }
Beispiel #31
0
    void Start()
    {
        Screen.showCursor = false;
        orbit = cam.GetComponent<MouseOrbit>();

        vectorXPoints = new List<Vector3>();
        vectorYPoints = new List<Vector3>();
        vectorZPoints = new List<Vector3>();
        quaternionXPoints = new List<Vector3>();
        quaternionYPoints = new List<Vector3>();
        quaternionZPoints = new List<Vector3>();

        vectorX = GameObject.Find("X Trail").AddComponent<LineRenderer>();
        vectorY = GameObject.Find("Y Trail").AddComponent<LineRenderer>();
        vectorZ = GameObject.Find("Z Trail").AddComponent<LineRenderer>();
        quaternionX = GameObject.Find("X Trail Dark").AddComponent<LineRenderer>();
        quaternionY = GameObject.Find("Y Trail Dark").AddComponent<LineRenderer>();
        quaternionZ = GameObject.Find("Z Trail Dark").AddComponent<LineRenderer>();

        vectorX.material = xTrailD;
        vectorY.material = yTrailD;
        vectorZ.material = zTrailD;
        quaternionX.material = xTrail;
        quaternionY.material = yTrail;
        quaternionZ.material = zTrail;

        vectorX.SetWidth(0.01f, 0.01f);
        vectorY.SetWidth(0.01f, 0.01f);
        vectorZ.SetWidth(0.01f, 0.01f);
        quaternionX.SetWidth(0.01f, 0.01f);
        quaternionY.SetWidth(0.01f, 0.01f);
        quaternionZ.SetWidth(0.01f, 0.01f);

        ResetTrails();
        InvokeRepeating("UpdateTrails", 0.04f, 0.04f);
    }
Beispiel #32
0
	void  Start (){
		//offset = new Vector3(0, 0f, 0f);
		myAudio = GetComponent<AudioSource>() as AudioSource;
		myParticleSystem = rootObject.GetComponentInChildren<ParticleSystem>() as ParticleSystem;
		myCamera = rootObject.GetComponentInChildren<MouseOrbit>() as MouseOrbit;
		myGunnerAim = rootObject.GetComponent<GunnerAim>() as GunnerAim;
        myStatSystem = rootObject.GetComponent<StatSystem>() as StatSystem;
        myCollider = rootObject.GetComponent<Collider>() as Collider;

        transform.parent = GameObject.Find("Floating Origin").transform;

        SceneState.OnStateChange += OnStateChange;
        CameraState.OnStateChange += OnStateChange;
		//myParticleSystem.emissionRate = 10;
//        foreach (Collider firstCollider in rootObject.GetComponentsInChildren<Collider>() as Collider[]) {
//            foreach (Collider secondCollider in rootObject.GetComponentsInChildren<Collider>() as Collider[]) {
//                if (firstCollider != secondCollider) {
////					Physics.IgnoreCollision(firstCollider, secondCollider);
////					Debug.Log (firstCollider.ToString() + " ignores collisions with " + secondCollider.ToString());
//                }
//            }
        //}
		
	}
        void OnPopupWindow(int windowId)
        {
            Window win = null;

            var values = openWindows.Values;

            foreach (var val in values)
            {
                if (val.id == windowId)
                {
                    win = val;
                }
            }
            if (win == null)
            {
                Debug.LogError("[ObjectExplorer] OnPopupWindow for window without entry in openWindows!");
                return;
            }

            var components = win.go.GetComponents <Component>();

            foreach (var comp in components)
            {
                if (GUILayout.Button(comp.GetType().Name))
                {
                    MouseOrbit mo = Camera.main.GetComponent <MouseOrbit>();
                    Debug.Log(mo);
                    mo.target = comp.transform;
                }
            }
            if (GUILayout.Button("Close"))
            {
                openWindows.Remove(win.go);
            }
            GUI.DragWindow();
        }
Beispiel #34
0
    void Start()
    {
        Screen.showCursor = false;
        orbit             = cam.GetComponent <MouseOrbit>();

        vectorXPoints     = new List <Vector3>();
        vectorYPoints     = new List <Vector3>();
        vectorZPoints     = new List <Vector3>();
        quaternionXPoints = new List <Vector3>();
        quaternionYPoints = new List <Vector3>();
        quaternionZPoints = new List <Vector3>();

        vectorX     = GameObject.Find("X Trail").AddComponent <LineRenderer>();
        vectorY     = GameObject.Find("Y Trail").AddComponent <LineRenderer>();
        vectorZ     = GameObject.Find("Z Trail").AddComponent <LineRenderer>();
        quaternionX = GameObject.Find("X Trail Dark").AddComponent <LineRenderer>();
        quaternionY = GameObject.Find("Y Trail Dark").AddComponent <LineRenderer>();
        quaternionZ = GameObject.Find("Z Trail Dark").AddComponent <LineRenderer>();

        vectorX.material     = xTrailD;
        vectorY.material     = yTrailD;
        vectorZ.material     = zTrailD;
        quaternionX.material = xTrail;
        quaternionY.material = yTrail;
        quaternionZ.material = zTrail;

        vectorX.SetWidth(0.01f, 0.01f);
        vectorY.SetWidth(0.01f, 0.01f);
        vectorZ.SetWidth(0.01f, 0.01f);
        quaternionX.SetWidth(0.01f, 0.01f);
        quaternionY.SetWidth(0.01f, 0.01f);
        quaternionZ.SetWidth(0.01f, 0.01f);

        ResetTrails();
        InvokeRepeating("UpdateTrails", 0.04f, 0.04f);
    }
Beispiel #35
0
    void OnTriggerEnter(Collider other)
    {
        float rng = Random.Range(1, 100);

        if (other.gameObject.tag == "Player")
        {
            playerInfo       info    = other.gameObject.GetComponent <playerInfo>() as playerInfo;
            playerController control = other.gameObject.GetComponent <playerController>() as playerController;
            if (other.GetComponent <NetworkView>().isMine)                                                                                      //player collides goes to new room
            //			control.setMoveDirection(Vector3.zero);
            //			control.setControllable (false);
            {
                if (room.getState() == "boss" || room.getState() == "start" || room.getState() == "treasure")
                {
                    room.PathFull();
                    room.Built = true;
                }
                if (!room.Built)                                                                                                                                                                                        //build room if room not built
                {
                    room.PathConnect();
                    room.Built = true;
                }
                if (!built)
                {
                    instantiateRoom(room.toString());
                    fillRoom(rng);
                    //networkView.RPC ("instantiateRoom", RPCMode.AllBuffered, room.toString ());
                }
                room.active = true;
                if (info.getCurrentRoom() != null)
                {
                    info.getCurrentRoom().decPlayer();
                }
                room.incPlayer();
                //networkView.RPC ("incPlayerCount", RPCMode.All, null);
                if (room != info.getCurrentRoom())
                {
                    if (info.getCurrentRoomObject() != null)
                    {
                        temp = info.getCurrentRoomObject();
                    }
                    info.setCurrentRoom(room);
                    info.setCurrentRoomObject(transform.parent.gameObject);
                    if (!Camera.main.enabled)
                    {
                        Camera.main.enabled = true;
                    }
                    MouseOrbit orbit = Camera.main.GetComponent <MouseOrbit>();
                    orbit.setTarget(gameObject.transform);
                    if (!room.getBeaten())
                    {
                    }
                    //showRoom ();
                    GameObject mapCam = GameObject.FindGameObjectWithTag("MapCamera") as GameObject;
                    mapCam.transform.position = new Vector3(room.getX() * 50, mapCam.transform.position.y, room.getY() * 50);
                    //Debug.Log ("Player in room" + room.getX () + "," + room.getY ());
                }
            }
            else
            {
                room.active = true;
                if (info.getCurrentRoom() != null && room != info.getCurrentRoom())
                {
                    info.getCurrentRoom().decPlayer();
                    //info.setCurrentRoom (room);
                    info.setCurrentRoom(room);
                    info.setCurrentRoomObject(transform.parent.gameObject);
                }
                //if(room != info.getCurrentRoom ()){
                //showRoom();
                //}
            }
            //networkView.RPC ("incPlayerCount", RPCMode.All, null);
            info = other.gameObject.GetComponent <playerInfo>() as playerInfo;
            showRoom();
            //room.incPlayer ();
            built = true;
            GetComponent <NetworkView>().RPC("updateNetworkRoom", RPCMode.OthersBuffered, room.toString(), this.transform.root.name, rng);


//			if(!built){
//				instantiateRoom (room.toString());
//				//networkView.RPC ("instantiateRoom", RPCMode.AllBuffered, room.toString ());
//				built = true;
//			}
//			Invoke ( control.setControllable (true);
        }
    }
Beispiel #36
0
 private void Start()
 {
     cam = GameObject.Find("HUD Cam").GetComponent <Camera>();
     mo  = MouseOrbit.Instance;
     CalcBounds();
 }
	void ChangeDist(MouseOrbit orb, float start_time, float shift_time, float from, float to)
	{
		if (from == to)
			return;

		float journeyLength = Mathf.Abs (to - from);
		float speed = journeyLength / shift_time;
		float distCovered = (Time.time - start_time) * speed;
		float fractJourney = distCovered / journeyLength;
		float dist = Mathf.Lerp (from, to, fractJourney);
		
		orb.Distance = dist;
		//orb.cameraDistance.transform.localPosition = new Vector3(orb.cameraDistance.transform.localPosition.x, 
		 //                                                   orb.cameraDistance.transform.localPosition.y, 
		 //                                                   -dist);
	}
Beispiel #38
0
 void Awake()
 {
     thisClass = this;
     cameraTransform = this.transform;
 }
 // Token: 0x0600078A RID: 1930 RVA: 0x000340F0 File Offset: 0x000322F0
 private void LateUpdate()
 {
     if (!PopupSystem.IsAnyPopupOpen && !PanelManager.IsAnyPanelOpen && GUIUtility.hotControl == 0)
     {
         if (base.camera.pixelRect.Contains(Input.mousePosition) && Input.GetAxis("Mouse ScrollWheel") != 0f)
         {
             this.OrbitConfig.z = Mathf.Clamp(this.zoomDistance - Input.GetAxis("Mouse ScrollWheel") * 15f, this.zoomMax[0], this.zoomMax[1]);
         }
         if (Input.GetMouseButtonDown(0) && base.camera.pixelRect.Contains(Input.mousePosition))
         {
             this.mouseAxisSpin   = Vector2.zero;
             this.listenToMouseUp = true;
             this.isMouseDragging = true;
         }
         if (Input.GetMouseButtonUp(0))
         {
             if (this.listenToMouseUp)
             {
                 float d = Mathf.Clamp((Input.mousePosition - this.mousePos).magnitude, 0f, 3f);
                 this.mouseAxisSpin = (Input.mousePosition - this.mousePos).normalized * d;
             }
             else
             {
                 this.mouseAxisSpin = Vector2.zero;
             }
             this.listenToMouseUp = false;
         }
         this.mousePos = Input.mousePosition;
         if (this.isMouseDragging && Input.GetMouseButton(0))
         {
             this.OrbitConfig.x   = this.OrbitConfig.x + Input.GetAxis("Mouse X") * 3f;
             this.yPanningOffset -= Input.GetAxis("Mouse Y") * 0.01f * ((!MouseOrbit.IsValueWithin(this.yPanningOffset, this.panMax[0], this.panMax[1])) ? 0.3f : 1f);
         }
         else if (this.mouseAxisSpin.magnitude > 0.0100000007f)
         {
             this.mouseAxisSpin   = Vector2.Lerp(this.mouseAxisSpin, Vector2.zero, Time.deltaTime * 2f);
             this.OrbitConfig.x   = this.OrbitConfig.x + this.mouseAxisSpin.x * 0.1f;
             this.yPanningOffset -= this.mouseAxisSpin.y * 0.01f * 0.1f * ((!MouseOrbit.IsValueWithin(this.yPanningOffset, this.panMax[0], this.panMax[1])) ? 0.3f : 1f);
         }
         else
         {
             this.mouseAxisSpin = Vector2.zero;
         }
         if (!this.isMouseDragging || !Input.GetMouseButton(0))
         {
             this.yPanningOffset = Mathf.Lerp(this.yPanningOffset, Mathf.Clamp(this.yPanningOffset, this.panMax[0], this.panMax[1]), Time.deltaTime * 10f);
         }
         this.yPanningOffset = Mathf.Clamp(this.yPanningOffset, this.panTotalMax[0], this.panTotalMax[1]);
         this.zoomDistance   = Mathf.Lerp(this.zoomDistance, Mathf.Clamp(this.OrbitConfig.z, this.zoomMax[0], this.zoomMax[1]), Time.deltaTime * 5f);
         this.Transform(base.transform);
     }
     else
     {
         this.listenToMouseUp = false;
         this.mouseAxisSpin   = Vector2.zero;
     }
     if (this.isMouseDragging && !Input.GetMouseButton(0))
     {
         this.isMouseDragging = false;
     }
 }
Beispiel #40
0
        public override void SimulateUpdateAlways()
        {
            if (!MainMo)
            {
                MainMo = Camera.main.GetComponent <MouseOrbit>();
            }
            MainMo.focusLerpSmooth = ReduceCameraShake.IsActive ? 999999999999999 : 8;

            if (MiniMap.IsActive)
            {
                MiniMapGO.transform.SetParent(Machine.SimulationMachine);
            }

            if (ActivateTargetIndicator.IsReleased)
            {
                disp2 = !disp2;
            }
            if (ActiveHUD.IsPressed)
            {
                HUD_Activated = !HUD_Activated;
            }
            //if (HidePanel.IsPressed)
            //{
            //    HidePanelBool = !HidePanelBool;
            //} Maybe for Tracking

            if (HUD_Activated)
            {
                if (ShowHUD == null)
                {
                    ShowHUD = new GameObject("ShowHUD");
                }
            }
            else
            {
                if (ShowHUD != null)
                {
                    Destroy(ShowHUD);
                }
            }

            if (disp2)
            {
                float grav = Physics.gravity.y;
                T_hitground  = (velocity.y + Mathf.Sqrt(velocity.y * velocity.y + 2 * 38.5f * displacement.y)) / 38.5f;
                bombposition = new Vector3(
                    displacement.x + T_hitground * velocity.x,
                    4,
                    displacement.z + T_hitground * velocity.z
                    );
                Light BombLight = BombDrop.GetComponent <Light>();
                if (BombLight)
                {
                    BombLight.enabled            = true;
                    BombLight.transform.position = bombposition;
                    BombLight.intensity          = 8;
                    BombLight.spotAngle          = Math.Abs(displacement.y * 3) + 60;
                    BombDrop.transform.LookAt(new Vector3(bombposition.x, bombposition.y - 10, bombposition.z));
                }

                if (AdvTI.IsActive)
                {
                    for (int i = (int)AdvTIS.Value; i >= 1; --i)
                    {
                        /*for (int i = (int)0; i != AdvTIS.Value; ++i)
                         *   {
                         *   T_hitground = ((velocity.y + Mathf.Sqrt(velocity.y * velocity.y + 2 * -Physics.gravity.y * displacement.y)) / -Physics.gravity.y);
                         *   float gotit = (T_hitground * ((AdvTIS.Value - i) / AdvTIS.Value));
                         *   bombposition = new Vector3(
                         *           displacement.x + gotit * velocity.x,
                         *           displacement.y + velocity.y * gotit + (gotit * Physics.gravity.y),
                         *           displacement.z + gotit * velocity.z
                         *           );*/
                        T_hitground  = (velocity.y + Mathf.Sqrt(velocity.y * velocity.y + 2 * 38.5f * displacement.y / (int)AdvTIS.Value * i)) / 38.5f;
                        bombposition = new Vector3(
                            displacement.x + T_hitground * velocity.x,
                            displacement.y / (int)AdvTIS.Value * ((int)AdvTIS.Value - i),
                            displacement.z + T_hitground * velocity.z
                            );
                        //AdvBombDrop.SetPosition((int)Mathf.Clamp(i,0,AdvTIS.Value - 1), bombposition);
                        AdvBombDrop.SetPosition((int)Mathf.Clamp(AdvTIS.Value - i - 1, 0, AdvTIS.Value - 1), bombposition);
                        AdvBombDrop.SetPosition((int)AdvTIS.Value - 1, transform.position);
                        AdvBombDrop.enabled = true;
                        //Debug.Log(bombposition + " abd " + i + " tm " + T_hitground * (i / AdvTIS.Value) + " und " + (T_hitground * (i / AdvTIS.Value) * Physics.gravity.y));
                    }
                    //Debug.Log("Total Time:" + T_hitground);
                }
            }
            else
            {
                if (BombDrop)
                {
                    BombDrop.GetComponent <Light>().enabled = false;
                }
                if (AdvBombDrop)
                {
                    AdvBombDrop.enabled = false;
                }
            }
        }
Beispiel #41
0
    protected void Awake()
    {
        string defaultIniPath = Application.dataPath + "/" + IniFileName;
        string userIniPath = Application.persistentDataPath + "/" + IniFileName;

        // Copy INI file with default settings to user INI file if one doesn't exist
        if (File.Exists(defaultIniPath) && !File.Exists(userIniPath))
            File.Copy(defaultIniPath, userIniPath);

        // Load settings from INI file
        IniFile iniFile = new IniFile(userIniPath);

        m_title = iniFile["Settings", "Title", m_title];
        m_connectionString = iniFile["Settings", "ConnectionString", m_connectionString];
        m_filterExpression = iniFile["Settings", "FilterExpression", m_filterExpression];
        m_lineWidth = int.Parse(iniFile["Settings", "LineWidth", m_lineWidth.ToString()]);
        m_lineDepthOffset = float.Parse(iniFile["Settings", "LineDepthOffset", m_lineDepthOffset.ToString()]);
        m_pointsInLine = int.Parse(iniFile["Settings", "PointsInLine", m_pointsInLine.ToString()]);
        m_legendFormat = iniFile["Settings", "LegendFormat", m_legendFormat];
        m_statusRows = int.Parse(iniFile["Settings", "StatusRows", m_statusRows.ToString()]);
        m_statusDisplayInterval = double.Parse(iniFile["Settings", "StatusDisplayInterval", m_statusDisplayInterval.ToString()]);
        m_startTime = iniFile["Settings", "StartTime", m_startTime];
        m_stopTime = iniFile["Settings", "StopTime", m_stopTime];

        // Attempt to save INI file updates (e.g., to restore any missing settings)
        try
        {
            iniFile.Save();
        }
        catch (Exception ex)
        {
            Debug.Log("ERROR: " + ex.Message);
        }

        // Attempt to reference active mouse orbit script
        m_mouseOrbitScript = GetComponent<MouseOrbit>();

        // Create line dictionary and data queue
        m_scales = new ConcurrentDictionary<string, Scale>();
        m_dataLines = new ConcurrentDictionary<Guid, DataLine>();
        m_dataQueue = new ConcurrentQueue<ICollection<IMeasurement>>();
        m_legendLines = new List<LegendLine>();

        // Initialize status rows and timer to hide status after a period of no updates
        m_statusText = new string[m_statusRows];

        for (int i = 0; i < m_statusRows; i++)
        {
            m_statusText[i] = "";
        }

        m_hideStatusTimer = new System.Timers.Timer();
        m_hideStatusTimer.AutoReset = false;
        m_hideStatusTimer.Interval = m_statusDisplayInterval;
        m_hideStatusTimer.Elapsed += m_hideStatusTimer_Elapsed;

        // For mobile applications we use a larger GUI font size.
        // Other deployments might benefit from this as well - larger
        // size modes may work also but are not tested
        switch (Application.platform)
        {
            case RuntimePlatform.Android:
            case RuntimePlatform.IPhonePlayer:
                if (Screen.height <= 720)
                    m_guiSize = 2;	// 720P
                else
                    m_guiSize = 3;	// 1080P or higher
                break;
        }

        // Create a solid background for the control window
        m_controlWindowTexture = new Texture2D(1, 1);
        m_controlWindowTexture.SetPixel(0, 0, new Color32(10, 25, 70, 255));
        m_controlWindowTexture.Apply();

        VectorLine.SetCanvasCamera(Camera.main);
        VectorLine.canvas3D.hideFlags = HideFlags.HideInHierarchy;
    }
Beispiel #42
0
 void Awake()
 {
     PlayTime = 0;
     OriginPosition = transform.position;
     seeker = GetComponent<Seeker>();
     target = GameObject.FindGameObjectWithTag("Greta").transform;
     //Gretacontroller = GameObject.Find("Greta").GetComponent<GretaController>();
     Gretacontroller = GameObject.FindGameObjectWithTag("Greta").GetComponent<GretaController>();
     mouse = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<MouseOrbit>();
 }
Beispiel #43
0
    protected void Awake()
    {
        string defaultIniPath = Application.dataPath + "/" + IniFileName;
        string userIniPath    = Application.persistentDataPath + "/" + IniFileName;

        // Copy INI file with default settings to user INI file if one doesn't exist
        if (File.Exists(defaultIniPath) && !File.Exists(userIniPath))
        {
            File.Copy(defaultIniPath, userIniPath);
        }

        // Load settings from INI file
        IniFile iniFile = new IniFile(userIniPath);

        m_title                 = iniFile["Settings", "Title", m_title];
        m_connectionString      = iniFile["Settings", "ConnectionString", m_connectionString];
        m_filterExpression      = iniFile["Settings", "FilterExpression", m_filterExpression];
        m_lineWidth             = int.Parse(iniFile["Settings", "LineWidth", m_lineWidth.ToString()]);
        m_lineDepthOffset       = float.Parse(iniFile["Settings", "LineDepthOffset", m_lineDepthOffset.ToString()]);
        m_pointsInLine          = int.Parse(iniFile["Settings", "PointsInLine", m_pointsInLine.ToString()]);
        m_legendFormat          = iniFile["Settings", "LegendFormat", m_legendFormat];
        m_statusRows            = int.Parse(iniFile["Settings", "StatusRows", m_statusRows.ToString()]);
        m_statusDisplayInterval = double.Parse(iniFile["Settings", "StatusDisplayInterval", m_statusDisplayInterval.ToString()]);
        m_startTime             = iniFile["Settings", "StartTime", m_startTime];
        m_stopTime              = iniFile["Settings", "StopTime", m_stopTime];

        // Attempt to save INI file updates (e.g., to restore any missing settings)
        try
        {
            iniFile.Save();
        }
        catch (Exception ex)
        {
            Debug.Log("ERROR: " + ex.Message);
        }

        // Attempt to reference active mouse orbit script
        m_mouseOrbitScript = GetComponent <MouseOrbit>();

        // Create line dictionary and data queue
        m_scales      = new ConcurrentDictionary <string, Scale>();
        m_dataLines   = new ConcurrentDictionary <Guid, DataLine>();
        m_dataQueue   = new ConcurrentQueue <ICollection <IMeasurement> >();
        m_legendLines = new List <LegendLine>();

        // Initialize status rows and timer to hide status after a period of no updates
        m_statusText = new string[m_statusRows];

        for (int i = 0; i < m_statusRows; i++)
        {
            m_statusText[i] = "";
        }

        m_hideStatusTimer           = new System.Timers.Timer();
        m_hideStatusTimer.AutoReset = false;
        m_hideStatusTimer.Interval  = m_statusDisplayInterval;
        m_hideStatusTimer.Elapsed  += m_hideStatusTimer_Elapsed;

        // For mobile applications we use a larger GUI font size.
        // Other deployments might benefit from this as well - larger
        // size modes may work also but are not tested
        switch (Application.platform)
        {
        case RuntimePlatform.Android:
        case RuntimePlatform.IPhonePlayer:
            if (Screen.height <= 720)
            {
                m_guiSize = 2;          // 720P
            }
            else
            {
                m_guiSize = 3;          // 1080P or higher
            }
            break;
        }

        // Create a solid background for the control window
        m_controlWindowTexture = new Texture2D(1, 1);
        m_controlWindowTexture.SetPixel(0, 0, new Color32(10, 25, 70, 255));
        m_controlWindowTexture.Apply();

        VectorLine.SetCanvasCamera(Camera.main);
        VectorLine.canvas3D.hideFlags = HideFlags.HideInHierarchy;
    }
Beispiel #44
0
	// Use this for initialization
	void Start () {
		mo = Camera.main.GetComponent<MouseOrbit>();
	}
 private void Start()
 {
     cam = GameObject.Find("HUD Cam").GetComponent<Camera>();
       mo = Camera.main.GetComponent<MouseOrbit>();
       CalcBounds();
 }
Beispiel #46
0
	void Start()
	{
		condition = GameObject.Find ("WinAndLoseCondition").GetComponent<WinAndLoseCondition> ();
		mouseOr = cam.GetComponent<MouseOrbit>();
		mouseOr.enabled = true;
	}
Beispiel #47
0
    protected virtual void Awake()
    {
        _anim = GetComponent <Animator>();

        _hash        = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIDs>();
        _syncManager = GameObject.FindGameObjectWithTag(Tags.networkController).GetComponent <SyncManager>();
        _modelInfo   = GetComponent <ModelInfo>();

        // Create a marker object for player's ranged target.
        _rangedTarget = InstantiateAsChild(ResourceDirectory.Instance.Creatures["redMarker"], transform) as GameObject;

        // Create IK controller for right arm.
        GameObject rArmIkController = GameObject.Instantiate(Resources.Load("Prefabs/Animation/LimbIkController")) as GameObject;

        rArmIkController.transform.parent = gameObject.transform;
        _rArmIkLimb                    = rArmIkController.GetComponent <IkLimb>();
        _rArmIkLimb.upperArm           = _modelInfo.rArm.transform;
        _rArmIkLimb.forearm            = _modelInfo.rForearm.transform;
        _rArmIkLimb.hand               = _modelInfo.rHand.transform;
        _rArmIkLimb.elbowTarget        = _modelInfo.rArmPistolIkElbowTarget;
        _rArmIkLimb.target             = _modelInfo.rArmPistolIkHandTarget.transform;
        _rArmIkLimb.IsEnabled          = false;
        _rArmIkLimb.debug              = true;
        _rArmIkLimb.transition         = 0.65f;
        _rArmIkLimb.handRotationPolicy = IkLimb.HandRotations.UseTargetRotation;

        // Create IK controller for left arm.
        GameObject lArmIkController = GameObject.Instantiate(Resources.Load("Prefabs/Animation/LimbIkController")) as GameObject;

        lArmIkController.transform.parent = gameObject.transform;
        _lArmIkLimb             = lArmIkController.GetComponent <IkLimb>();
        _lArmIkLimb.upperArm    = _modelInfo.lArm.transform;
        _lArmIkLimb.forearm     = _modelInfo.lForearm.transform;
        _lArmIkLimb.hand        = _modelInfo.lHand.transform;
        _lArmIkLimb.elbowTarget = _modelInfo.lArmPistolIkElbowTarget;
        _lArmIkLimb.target      = _modelInfo.lArmPistolIkHandTarget;
        _lArmIkLimb.IsEnabled   = false;
        _lArmIkLimb.debug       = true;
        _lArmIkLimb.transition  = 0.9f;

        // Add DamageLocation scripts to skeleton.
        DamageLocation headDamageLocation = _modelInfo.head.AddComponent <DamageLocation>();

        headDamageLocation.damageLocationType = DamageLocationType.Head;
        headDamageLocation.player             = this.gameObject;
        DamageLocation torsoDamageLocation = _modelInfo.torso.AddComponent <DamageLocation>();

        torsoDamageLocation.damageLocationType = DamageLocationType.Torso;
        torsoDamageLocation.player             = this.gameObject;
        DamageLocation legsDamageLocation = _modelInfo.legs.AddComponent <DamageLocation>();

        legsDamageLocation.damageLocationType = DamageLocationType.Legs;
        legsDamageLocation.player             = this.gameObject;


        // Create initial NoWeapon object.
        EquipWeaponByName("NoWeapon");

        // Create camera orbiter object.
        MouseOrbit = (GameObject.Instantiate(ResourceDirectory.Instance.Camera["Orbiter"]) as GameObject).GetComponent <MouseOrbit>();
        MouseOrbit.transform.parent = transform;
        MouseOrbit.target           = transform;
    }
Beispiel #48
0
 // Use this for initialization
 void Start()
 {
     mo = Camera.main.GetComponent <MouseOrbit>();
 }
	void ChangeDist(MouseOrbit orb, float start_time, float shift_time, float from, float to)
	{
		float journeyLength = Mathf.Abs (to - from);
		float speed = journeyLength / shift_time;
		float distCovered = (Time.time - start_time) * speed;
		float fractJourney = distCovered / journeyLength;
		float dist = Mathf.Lerp (from, to, fractJourney);
		
		orb.distance = dist;
	}
 private void Start()
 {
     cam = GameObject.Find("HUD Cam").GetComponent<Camera>();
       mo = MouseOrbit.Instance;
       CalcBounds();
 }
Beispiel #51
0
    void Start()
    {
        binReader = new CloudStream.Reader(new FileStream(ExplodedPrefs.ImportedBin(name), FileMode.Open, FileAccess.Read));

        /* pre-calculate selection size */
        UpdateSelectionSize();

        /* pre-allocate some things */

        /* start the pool (actual pooled objects will be created as necessary) */
        detailBranch = new GameObject("Detail");
        ProceduralUtils.InsertAtOrigin(detailBranch.transform, transform);

        guiMessage = "";
        orbit = Object.FindObjectOfType(typeof(MouseOrbit)) as MouseOrbit;

        /* order slices by size */
        System.Array.Sort(slices, (s1,s2) => (s2.size - s1.size));

        /*
        initiallyEnabledSet = new HashSet<Slice>( new List<Slice>(slices).FindAll(s => s.selected) );
        initiallyEnabledSet2 = new HashSet<Slice> (new List<Slice> (slices).FindAll (s => s.selectedForCamview));
        initialMatrix = transform.worldToLocalMatrix;
        */
    }
	//Dictionary<Material,Material> materialPairs = new Dictionary<Material, Material>();

	// Use this for initialization
	void Start () 
	{
		GameObject canvas = GameObject.FindWithTag ("Player");
		bGUI = canvas.GetComponent<BrowserGUI> (); 
		subs = GetComponent<SubsystemList> (); //list of subsystems
		MarkSubsystemsWithTag();

		GO = gameObject;
		GO.transform.position = new Vector3 (0,0,0);

		CreateCameraHelper(); //create object for camera targeting

		GameObject mainCamObj = GameObject.FindWithTag ("MainCamera"); 
		mainCam = mainCamObj.GetComponent<Camera>();
		orbitNav = mainCam.GetComponent<MouseOrbit>();
		orbitNav.SetTarget (cameraHelper.transform); //напрявляем на помощника

		BuildMeshes (); //search meshes and join it into groups
		//PrepareForAlphaBlending (); //prepare materials
		m_alpha = alphaMax; //initial alpha

		//initial camera rotation and distance
		orbitNav.SetRotation(startCamRotation);
		orbitNav.Distance = startCamDistance;
	}