예제 #1
0
    // Use this for initialization
    void Start()
    {
        _spriteRenderer = this.GetComponent <SpriteRenderer>();
        _boxCollider2D  = this.GetComponent <BoxCollider2D>();
        _rigidbody2D    = this.GetComponent <Rigidbody2D>();
        _animator       = this.GetComponent <Animator>();

        Status = eMarioStatus.SMALL;

        // lực nhảy = căn (2 * g * scale (tại thằng này gravity gấp 2) * độ cao) + khối lượng (lực kéo xuống)
        JumpForce = Mathf.Sqrt(2 * Physics.gravity.magnitude * _rigidbody2D.gravityScale * JumpHeight) + _rigidbody2D.mass + _rigidbody2D.drag;

        JumpMaxForce = Mathf.Sqrt(2 * Physics.gravity.magnitude * _rigidbody2D.gravityScale * HoldJumpHeight) + _rigidbody2D.mass + _rigidbody2D.drag;

        PushUpForce = Mathf.Sqrt(2 * Physics.gravity.magnitude * _rigidbody2D.gravityScale * 1.5f) + _rigidbody2D.mass + _rigidbody2D.drag;

        Color softBlue = new Color(51, 51 * 2, 51 * 3, 51 * 4);
        //_spriteRenderer.color = softBlue;
    }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        if (Status != (eMarioStatus)_animator.GetInteger("status"))
        {
            Status = (eMarioStatus)_animator.GetInteger("status");
        }

        if (_protectTime > 0)
        {
            _protectTime -= Time.deltaTime;

            protectedEffect();

            //Debug.Log("Protect in " + _protectTime);
        }
        if (Shield > 0)
        {
            flashShield();
            Invoke("timeoutflashshield", 7.0f);
        }
    }