예제 #1
0
    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();
 }
예제 #3
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
예제 #4
0
    /* 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;
    }
예제 #5
0
 // 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);
 }
예제 #6
0
파일: Game.cs 프로젝트: mpcomplete/grappler
 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);
 }
예제 #7
0
    /* 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));
    }
예제 #8
0
 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);
     }
 }
예제 #9
0
    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);
    }
예제 #10
0
 public FollowState(SmartCamera content)
     : base(content, FSMStateType.Follow)
 {
 }
예제 #11
0
 public FSMState(SmartCamera content, FSMStateType type)
     : base(content)
 {
     _stateType = type;
 }
예제 #12
0
 public SideScrollingState(SmartCamera content)
     : base(content, FSMStateType.SideScrolling)
 {
 }
예제 #13
0
 void Awake()
 {
     smartCam = Camera.main.gameObject.GetComponent <SmartCamera>();
 }
예제 #14
0
 public StayState(SmartCamera content)
     : base(content, FSMStateType.Stay)
 {
 }
예제 #15
0
파일: SmartCamera.cs 프로젝트: choephix/G11
 void Start()
 {
     me = this;
     ResetTargetHolder();
     SelectionManager.UnitTargetedEvent += OnUnitTargeted;
 }