private void Awake() { // Check if there is a prescribed camera to use if (UsedCamera == null) { // Create one for usage in the following code GameObject camObject = new GameObject(transform.name + transform.GetInstanceID() + " Camera"); camObject.AddComponent <Camera>(); camObject.AddComponent <FlareLayer>(); camObject.AddComponent <Skybox>(); _skybox = camObject.GetComponent <Skybox>(); UsedCamera = camObject.GetComponent <Camera>(); UsedCamera.transform.eulerAngles = new Vector3(0, transform.eulerAngles.y, 0); } _skybox = UsedCamera.GetComponent <Skybox>(); // Check if the used camera has a skybox attached if (_skybox == null) { // No skybox attached => add a skybox and assign it to the _skybox variable UsedCamera.gameObject.AddComponent <Skybox>(); _skybox = UsedCamera.gameObject.GetComponent <Skybox>(); } // Set the used camera's skybox to the user prescribed one _skybox.material = UsedSkybox; ResetView(); // Assign the remaining script variables _rpgViewFrustum = GetComponent <RPGViewFrustum>(); _rpgMotor = GetComponent <RPGMotor>(); }
void OnTriggerStay(Collider other) { foreach (GameObject o in suoyoudiren) { if (other.gameObject == o.gameObject) { beijidiren.Add(o.gameObject); } } if (chou2) { foreach (GameObject o in suoyoudiren1) { if (other.gameObject == o.gameObject) { MessageDispatcher.Instance.DispatchMessage(0, this.transform, other.transform, (int)MessagesType.Msg_BeingHurt, EntityManager.Instance.GetEntityFromTransform(this.transform), 10f, Buff.Burnt); enemymotor = other.GetComponent <RPGMotor>(); texiao = (GameObject)Instantiate(beijitexiao, new Vector3(other.transform.position.x, other.transform.position.y + 1f, other.transform.position.z), other.transform.rotation); Destroy(texiao, 1f); suoyoudiren1.Remove(o.gameObject); break; } } } }
void Awake() { IsDie = false; Property = this.GetComponent <shuxing>(); motor = GetComponent <RPGMotor>(); myAnimator = GetComponent <Animator>(); cameraTramsform = Camera.main.transform; myCapCollider = GetComponent <CapsuleCollider>(); }
void Awake() { Property = this.GetComponent <shuxing>(); attnum = 0; CameraEffect = Camera.main.GetComponent <RadialBlur>(); touji = Camera.main.GetComponent <toujicamera>(); player = this.transform.parent.gameObject; mymotor = this.transform.parent.GetComponent <RPGMotor>(); myAnimator = GetComponent <Animator>(); cameraTransform = Camera.main.transform; myCapCollider = GetComponent <CapsuleCollider>(); }
private void Awake() { _rpgMotor = GetComponent <RPGMotor>(); try { Input.GetButton("Horizontal Strafe"); Input.GetButton("Autorun Toggle"); Input.GetButton("Walk Toggle"); } catch (UnityException e) { Debug.LogWarning(e.Message); } }
void Start() { if (target == null && animation != null) { target = animation; } if (transform.parent != null) { Transform t = transform.parent; while (t != null && (motor == null || input == null)) { if (motor == null) { motor = t.GetComponent<RPGMotor>(); } if (input == null) { input = t.GetComponent<RPGInput>(); } t = t.parent; } if (motor != null) { motor.OnJump = new Action(OnJump); motor.OnLand = new Action(OnLand); motor.OnFall = new Action(OnFall); motor.OnIdle = new Action(OnIdle); motor.OnMove = new Action(OnMove); motor.OnSlide = new Action(OnSlide); } } if (target != null) { target.wrapMode = WrapMode.Loop; target.Stop(); SetupPrioAnimation(landing); SetupPrioAnimation(jumping); } if (motor != null) { SetRotation(motor.transform.forward); } }
void Start() { if (target == null && animation != null) { target = animation; } if (transform.parent != null) { Transform t = transform.parent; while (t != null && (motor == null || input == null)) { if (motor == null) { motor = t.GetComponent <RPGMotor>(); } if (input == null) { input = t.GetComponent <RPGInput>(); } t = t.parent; } if (motor != null) { motor.OnJump = new Action(OnJump); motor.OnLand = new Action(OnLand); motor.OnFall = new Action(OnFall); motor.OnIdle = new Action(OnIdle); motor.OnMove = new Action(OnMove); motor.OnSlide = new Action(OnSlide); } } if (target != null) { target.wrapMode = WrapMode.Loop; target.Stop(); SetupPrioAnimation(landing); SetupPrioAnimation(jumping); } if (motor != null) { SetRotation(motor.transform.forward); } }
void Start() { motor = GetComponent <RPGMotor>(); }
private void Awake() { GameObject character = GameObject.Find("Character"); if (character == null) { return; } RpgCamera = character.GetComponent <RPGCamera>(); RpgViewFrustum = character.GetComponent <RPGViewFrustum>(); RpgController = character.GetComponent <RPGController>(); RpgMotor = character.GetComponent <RPGMotor>(); _usedSkybox.text = "" + TestSkyboxes[0]; _cameraPivotLocalPositionX.text = "" + RpgCamera.CameraPivotLocalPosition.x; _cameraPivotLocalPositionY.text = "" + RpgCamera.CameraPivotLocalPosition.y; _cameraPivotLocalPositionZ.text = "" + RpgCamera.CameraPivotLocalPosition.z; _activateCameraControl.isOn = RpgCamera.ActivateCameraControl; _alwaysRotateCamera.isOn = RpgCamera.AlwaysRotateCamera; _rotateWithCharacter.text = RpgCamera.RotateWithCharacter.ToString(); // enum _cursorLockMode.text = RpgCamera.CursorLockMode.ToString(); // enum _hideCursorWhenPressed.isOn = RpgCamera.HideCursorWhenPressed; _lockMouseX.isOn = RpgCamera.LockMouseX; _lockMouseY.isOn = RpgCamera.LockMouseY; _invertMouseX.isOn = RpgCamera.InvertMouseX; _invertMouseY.isOn = RpgCamera.InvertMouseY; _mouseXSensitivity.text = "" + RpgCamera.MouseXSensitivity; _mouseYSensitivity.text = "" + RpgCamera.MouseYSensitivity; _constrainMouseX.isOn = RpgCamera.ConstrainMouseX; _mouseXMin.text = "" + RpgCamera.MouseXMin; _mouseXMax.text = "" + RpgCamera.MouseXMax; _mouseYMin.text = "" + RpgCamera.MouseYMin; _mouseYMax.text = "" + RpgCamera.MouseYMax; _mouseScrollSensitivity.text = "" + RpgCamera.MouseScrollSensitivity; _mouseSmoothTime.text = "" + RpgCamera.MouseSmoothTime; _minDistance.text = "" + RpgCamera.MinDistance; _maxDistance.text = "" + RpgCamera.MaxDistance; _distanceSmoothTime.text = "" + RpgCamera.DistanceSmoothTime; _alignCharacterWithCam.text = RpgCamera.AlignCharacter.ToString(); _alignCameraWhenMoving.isOn = RpgCamera.AlignCameraWhenMoving; _supportWalkingBackwards.isOn = RpgCamera.SupportWalkingBackwards; _alignCameraSmoothTime.text = "" + RpgCamera.AlignCameraSmoothTime; _occultationHandling.text = RpgViewFrustum.OcclusionHandling.ToString(); // enum _occultingLayers.text = "Default"; _fadeOutAlpha.text = "" + RpgViewFrustum.FadeOutAlpha; _fadeInAlpha.text = "" + RpgViewFrustum.FadeInAlpha; _fadeOutDuration.text = "" + RpgViewFrustum.FadeOutDuration; _fadeInDuration.text = "" + RpgViewFrustum.FadeInDuration; _enableCharacterFading.isOn = RpgViewFrustum.EnableCharacterFading; _characterFadeOutAlpha.text = "" + RpgViewFrustum.CharacterFadeOutAlpha; _characterFadeStartDistance.text = "" + RpgViewFrustum.CharacterFadeStartDistance; _characterFadeEndDistance.text = "" + RpgViewFrustum.CharacterFadeEndDistance; _walkSpeed.text = "" + RpgMotor.WalkSpeed; _runSpeed.text = "" + RpgMotor.RunSpeed; _strafeSpeed.text = "" + RpgMotor.StrafeSpeed; _airborneSpeed.text = "" + RpgMotor.AirborneSpeed; _rotatingSpeed.text = "" + RpgMotor.RotatingSpeed; _sprintSpeedMultiplier.text = "" + RpgMotor.SprintSpeedMultiplier; _backwardsSpeedMultiplier.text = "" + RpgMotor.BackwardsSpeedMultiplier; _jumpHeight.text = "" + RpgMotor.JumpHeight; _allowedAirborneMoves.text = "" + RpgMotor.AllowedAirborneMoves; _moveWithMovingGround.isOn = RpgMotor.MoveWithMovingGround; _rotateWithRotatingGround.isOn = RpgMotor.RotateWithRotatingGround; _groundObjectAffectsJump.isOn = RpgMotor.GroundObjectAffectsJump; _slidingThreshold.text = "" + RpgMotor.SlidingThreshold; _fallingThreshold.text = "" + RpgMotor.FallingThreshold; _gravity.text = "" + RpgMotor.Gravity; ToggleVariablesWindow(); _awoken = true; }
void Start() { motor = GetComponent<RPGMotor>(); }