public bool HeavyDamage(int damage, Vector3 origin) { if (status.Invincible()) { return(false); } if (StateCompare(MarioStates.Knockback) || StateCompare(MarioStates.KnockbackForwards) || StateCompare(MarioStates.TeleportIn) || StateCompare(MarioStates.TeleportOut)) { return(false); } Vector3 direction = Math3d.ProjectVectorOnPlane(controller.up, origin - transform.position).normalized; if (direction == Vector3.zero) { direction = lookDirection; } bool forward = Vector3.Angle(direction, lookDirection) < 90; if (Airborn()) { if (forward) { moveSpeed = -3.0f; currentState = MarioStates.AirKnockback; } else { moveSpeed = 3.0f; currentState = MarioStates.AirKnockbackForwards; } } else { if (forward) { currentState = MarioStates.Knockback; moveSpeed = -3.0f; } else { currentState = MarioStates.KnockbackForwards; moveSpeed = 3.0f; } } lookDirection = forward ? direction : -direction; SmartCamera.Shake(1.6f, 25.0f, 0.5f); sound.PlayTakeDamage(); Instantiate(TakeDamageEffect, transform.position + controller.up * controller.height * 0.6f, Quaternion.identity); status.TakeDamage(damage); return(true); }
private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { SmartCamera.Closing(); SafetySystem.Closing(); RemoteTerminal.Closing(); RobotSimulator.Closing(); }
private void Awake() { if (Instance == null) { Instance = this; } }
/* Smoothly moves the camera to a new point * * Referenced Unity's documentation on Vector3.Slerp * https://docs.unity3d.com/ScriptReference/Vector3.Slerp.html */ public IEnumerator MoveCamera(CameraMoveParams camParams) { camIsMoving = true; float start = Time.time; if (smartCam == null) { smartCam = Camera.main.gameObject.GetComponent <SmartCamera>(); } Vector3 startPos = smartCam.transform.position; Quaternion startRot = smartCam.transform.rotation; float fracComplete = 0; while (fracComplete < 1) { // slerp between the positions fracComplete = ((Time.time - start) * camParams.speed) / Vector3.Distance(startPos, camParams.destination); smartCam.SetPR( Vector3.Slerp(startPos, camParams.destination, fracComplete), Quaternion.Slerp(startRot, camParams.rotation, fracComplete)); yield return(null); } camIsMoving = false; yield break; }
// Start is called before the first frame update void Start() { _smartCam = Camera.main.GetComponent <SmartCamera>(); camFollowOffset = (transform.forward * offsetZ) + (transform.right * offsetX) + (transform.up * offsetY); }
void Start() { player = FindObjectOfType <Player>(); smartCamera = FindObjectOfType <SmartCamera>(); mainCamera = smartCamera.GetComponent <Camera>(); ground = FindObjectOfType <Ground>(); Physics.IgnoreLayerCollision(player.gameObject.layer, player.gameObject.layer, true); Physics.IgnoreLayerCollision(player.gameObject.layer, 11, true); }
/* Camera follow */ void CameraFollow() { if (_smartCam == null) { _smartCam = Camera.main.GetComponent <SmartCamera>(); } Vector3 desiredPosition = gameObject.transform.position + camFollowOffset; _smartCam.LookAt(gameObject.transform.position); _smartCam.SetPosition(Vector3.Slerp(_smartCam.transform.position, desiredPosition, cameraFollowDelay)); }
private new void Awake() { base.Awake(); smartCamera = GetComponentInChildren <SmartCamera>(); if ((captureRGB || captureDepth || captureSemanticMask) && smartCamera == null) { captureRGB = false; captureDepth = false; captureSemanticMask = false; Log("Smart camera not found", LogLevel.Error, true); } laserScan = GetComponentInChildren <LaserScanner>(); if (captureScan && laserScan == false) { captureScan = false; Log("Laser not found", LogLevel.Error, true); } lidar = GetComponentInChildren <Lidar>(); if (captureLidar && lidar == null) { captureLidar = false; Log("Lidar not found", LogLevel.Error, true); } }
public bool GroundDamageLight(int damage, Vector3 origin, float pushbackSpeed, bool canHurtInAir = true) { if (status.Invincible()) { return(false); } if (StateCompare(MarioStates.Stagger) || StateCompare(MarioStates.TeleportIn) || StateCompare(MarioStates.TeleportOut)) { return(false); } if (!canHurtInAir && Airborn()) { return(false); } if (StateCompare(MarioStates.Slide)) { if (Mathf.Abs(moveSpeed) > 3.0f) { return(false); } } status.TakeDamage(damage); Vector3 direction = Math3d.ProjectVectorOnPlane(controller.up, origin - transform.position).normalized; if (direction == Vector3.zero) { direction = lookDirection; } staggerForward = Vector3.Angle(direction, lookDirection) < 90; if (Airborn()) { if (staggerForward) { moveSpeed = -3.0f; currentState = MarioStates.AirKnockback; } else { moveSpeed = 3.0f; currentState = MarioStates.AirKnockbackForwards; } } else { if (status.CurrentHealth == 0) { if (staggerForward) { currentState = MarioStates.Knockback; moveSpeed = -3.0f; } else { currentState = MarioStates.KnockbackForwards; moveSpeed = 3.0f; } } else { currentState = MarioStates.Stagger; moveSpeed = staggerForward ? -pushbackSpeed : pushbackSpeed; } } Instantiate(TakeDamageEffect, transform.position + controller.up * controller.height * 0.6f, Quaternion.identity); sound.PlayTakeDamage(); lookDirection = staggerForward ? direction : -direction; SmartCamera.Shake(0.85f, 15.0f, 0.5f); return(true); }
public FollowState(SmartCamera content) : base(content, FSMStateType.Follow) { }
public FSMState(SmartCamera content, FSMStateType type) : base(content) { _stateType = type; }
public SideScrollingState(SmartCamera content) : base(content, FSMStateType.SideScrolling) { }
void Awake() { smartCam = Camera.main.gameObject.GetComponent <SmartCamera>(); }
public StayState(SmartCamera content) : base(content, FSMStateType.Stay) { }
void Start() { me = this; ResetTargetHolder(); SelectionManager.UnitTargetedEvent += OnUnitTargeted; }