Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        Cursor.visible     = false;
        pointList          = new List <Vector3>();
        controller         = GetComponent <PlayerController>();
        m_AttackController = GetComponent <MeleeAttackController>();
        if (GameObject.FindGameObjectWithTag("Game Manager"))
        {
            manager = GameObject.FindGameObjectWithTag("Game Manager").GetComponent <GameManager>();
        }
        rb   = GetComponent <Rigidbody2D>();
        anim = GetComponent <Animator>();
        cam  = Camera.main;
        cam.orthographicSize = minCamZoomSize;
        Volume volume = globalVolume.GetComponent <Volume>();

        DepthOfField tmpdof;

        if (volume.profile.TryGet <DepthOfField>(out tmpdof))
        {
            dofComp = tmpdof;
        }
        currentMode        = 0;
        arcMode.color      = new Color(1, 1, 1, 1);
        straightMode.color = new Color(1, 1, 1, 35 / 255);
    }
Esempio n. 2
0
 private void Fall()
 {
     if (!_isGround)
     {
         _rigidbody.velocity = Vector2.down * _player.jumpForce * 2;
         checkFall           = true;
         if (_player._isBlock == true && Time.time - _curSlamTime >= _player.slamCoolDown)
         {
             // Debug.Log(_player.meleeAttackDamage);
             //анимация
             MeleeAttackController.Slam(transform.position, 1.5F, 9, _player.meleeAttackDamage * 2);
             _curSlamTime = Time.time;
         }
     }
 }
Esempio n. 3
0
        private void Start()
        {
            // get the transform of the main camera
            if (Camera.main != null)
            {
                m_Cam = Camera.main.transform;
            }
            else
            {
                Debug.LogWarning(
                    "Warning: no main camera found. Third person character needs a Camera tagged \"MainCamera\", for camera-relative controls.");
                // we use self-relative controls in this case, which probably isn't what the user wants, but hey, we warned them!
            }

            // get the third person character ( this should never be null due to require component )
            m_Character             = GetComponent <ThirdPersonCharacter>();
            m_MeleeAttackController = GetComponent <MeleeAttackController> ();
        }
Esempio n. 4
0
    // Start is called before the first frame update
    void Start()
    {
        rb   = GetComponent <Rigidbody2D>();
        anim = GetComponent <Animator>();
        m_AttackController = GetComponent <MeleeAttackController>();
        r_AttackController = GetComponent <RangedAttackWithTeleportation>();
        if (GameObject.FindGameObjectWithTag("Game Manager"))
        {
            manager = GameObject.FindGameObjectWithTag("Game Manager").GetComponent <GameManager>();
        }
        playerMat       = GetComponent <SpriteRenderer>().material;
        facingDirection = 1;

        canMove              = true;
        canFlip              = true;
        isWalking            = true;
        isRunning            = false;
        isGrounded           = true;
        isCloseToWall        = false;
        baseWallSlidingSpeed = wallSlidingSpeed;

        currentMaxSlidingSpeed = maxSlidingSpeed;
    }