public override void _Ready() { aimTarget = GetNode <AimTarget>("AimTarget"); if (aimTarget == null) { GD.PushError("AimTarget reference not found!"); } aimRay = GetNode <RayCast>("InterpolatedCamera/AimRay"); if (aimRay == null) { GD.PushError("AimRay reference not found!"); } camera = GetNode <InterpolatedCamera>("InterpolatedCamera"); if (camera == null) { GD.PushError("InterpolatedCamera reference not found!"); } springArm = GetNode <SpringArm>("SpringArm"); if (springArm == null) { GD.PushError("SpringArm reference not found!"); } _positionStart = this.Translation; // node transformations only in Global Space SetAsToplevel(true); WaitForParentNode(); }
public override void _Ready() { _animationTree = GetNode <AnimationTree>("AnimationTree"); _playerModel = GetNode <Spatial>("PlayerModel"); _shootFrom = _playerModel.GetNode <Position3D>(@"Robot_Skeleton/Skeleton/GunBone/ShootFrom"); _colorRect = GetNode <ColorRect>("ColorRect"); _crosshair = GetNode <TextureRect>("Crosshair"); _fireCooldown = GetNode <Timer>("FireCooldown"); _cameraBase = GetNode <Spatial>("CameraBase"); _cameraAnimation = _cameraBase.GetNode <AnimationPlayer>(@"Animation"); _cameraRot = _cameraBase.GetNode <Spatial>(@"CameraRot"); _cameraSpringArm = _cameraRot.GetNode <SpringArm>(@"SpringArm"); _cameraCamera = _cameraSpringArm.GetNode <CameraNoiseShakeEffect>(@"Camera"); _soundEffects = GetNode <Node>("SoundEffects"); _soundEffectJump = _soundEffects.GetNode <AudioStreamPlayer>(@"Jump"); _soundEffectLand = _soundEffects.GetNode <AudioStreamPlayer>(@"Land"); _soundEffectShoot = _soundEffects.GetNode <AudioStreamPlayer>(@"Shoot"); _initialPosition = Transform.origin; _gravity = Convert.ToSingle(ProjectSettings.GetSetting("physics/3d/default_gravity")) * (Vector3)ProjectSettings.GetSetting("physics/3d/default_gravity_vector"); // Pre-initialize orientation transform. _orientation = _playerModel.GlobalTransform; _orientation.origin = new Vector3(); }
// Use this for initialization protected override void Start() { base.Start(); target = transform.Find("Target"); targetArm = target.gameObject.GetComponent <SpringArm>(); gun = transform.Find("Gun"); canon = gun.Find("Canon"); enemyTarget = new List <Transform>(); canShoot = true; targetArm.setUseRotationLimits(false, false, false); //switch that determines the initial orientation of the turret switch (_orientation) { case orientation.North: targetArm.addRotation(0, 180, 0); targetArm.setMinLimits(-30, 150, 0); targetArm.setMaxLimits(30, 210, 0); targetArm.setUseRotationLimits(true, true, true); break; case orientation.West: targetArm.addRotation(0, 90, 0); targetArm.setMinLimits(-30, 60, 0); targetArm.setMaxLimits(30, 120, 0); targetArm.setUseRotationLimits(true, true, true); break; case orientation.South: targetArm.setMinLimits(-30, -30, 0); targetArm.setMaxLimits(30, 30, 0); targetArm.setUseRotationLimits(true, true, true); break; case orientation.East: targetArm.addRotation(0, 270, 0); targetArm.setMinLimits(-30, 240, 0); targetArm.setMaxLimits(30, 300, 0); targetArm.setUseRotationLimits(true, true, true); break; } posses = canvas.transform.GetChild(0).Find("Posses").GetComponent <Button>(); if (gameMode is GameModeManager) { posses.onClick.AddListener((gameMode as GameModeManager).enableShootMode); } aimReticle = Instantiate(aimReticleObj, GameObject.Find("LocalUI").transform); aimReticle = aimReticle.transform.GetChild(0).gameObject; aimReticle.SetActive(false); }
// Use this for initialization void Start() { camera = Camera.main.gameObject.GetComponent <SpringArm>(); canRotate = true; gameMode = GetComponent <GameModeManager>(); initialConfig = camera.getConfig(); min = boundTRmin.position; max = boundTRmax.position; }
private void DamageCameraShake() { SpringArm.GetInstance().DoShakeCamera(0.5f, 0.1f); float intensity = (HeroCharacter.GetInstance().CurrentHealth % 3 == 0) ? 1f : 0.3f; //If the heart piece is the last in the container(3 pieces), //then the screen flashes with more intensity DoFlashOverlay(1f, intensity); }
public override void OnSpawn() { base.OnSpawn(); Invoke("CleanProjectile", fLifeSpan); //Clean from scene after delay if (owner == Owner.PLAYER_UNIT) { SpringArm.GetInstance().DoShakeCamera(0.1f, 0.1f); } moveDir = transform.forward; //default value if we fail to set it in the weapon }
public CameraPostUpdateSystem(Contexts context) : base(context) { _playerContext = context.player; _freeMoveContext = context.freeMove; _baseCollisionLayers = UnityLayers.CameraCollidableLayerMask; _archoroffsetArm = new SpringArm(); _postOffsetArm = new SpringArm(); _offsetArm = new SpringArm(); _archoroffsetArm.Set(0.2f, 0.2f, 5, _baseCollisionLayers); _postOffsetArm.Set(0.12f, 0.5f, 5, _baseCollisionLayers); _offsetArm.Set(0.1f, 0.02f, 5, _baseCollisionLayers); }
// Use this for initialization void Start() { camera = this.GetComponent <SpringArm>(); cameras = new List <cameraConfig>(); cameras.Add(targetList[0].getConfig()); cameras.Add(targetList[1].getConfig()); cameras.Add(new cameraConfig(targetList[1].getConfig().target, 30, new Vector3(0, 7, 0), new Vector3(0, 15, -1.5f), true, Vector3.zero, 0.5f, 10, false)); cameras.Add(new cameraConfig(targetList[1].getConfig().target, 1, new Vector3(0, 1.5f, 0), new Vector3(0, 1.5f, -1), true, Vector3.zero, 20, 10, false)); cameras.Add(new cameraConfig(targetList[1].getConfig().target, 20, Vector3.zero, new Vector3(0, 15, -1), false, new Vector3(0, 0, 0), 20, 10, false)); cameras.Add(new cameraConfig(targetList[1].getConfig().target, 20, Vector3.zero, new Vector3(0, 0, -1), false, new Vector3(30, 0, 0), 2, 10, false)); cameras.Add(new cameraConfig(targetList[1].getConfig().target, 20, Vector3.zero, new Vector3(0, 0, -1), false, new Vector3(30, 0, 0), 2, 10, true)); currentTarget = cameras[0]; camera.changeTarget(currentTarget); }
private void Start() { camController = GetComponent <CameraController>(); camera = camController.getCamera(); }
private void Awake() { instance = this; }