コード例 #1
0
ファイル: Player.cs プロジェクト: klyye/Silenciodorius
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.CompareTag("Stair"))
     {
         OnStairReached?.Invoke();
     }
 }
コード例 #2
0
ファイル: Player.cs プロジェクト: klyye/Silenciodorius
        protected override void Update()
        {
            base.Update();
            #if UNITY_EDITOR
            if (debugMode && Input.GetKeyDown(KeyCode.Space))
            {
                OnStairReached?.Invoke();
            }
            #endif

            if (Input.GetMouseButtonDown(0) && _attackTimer <= 0 && GameManager.isPlaying)
            {
                var mousePos = Input.mousePosition;
                mousePos.z = GameManager.cam.nearClipPlane;
                var mouseWorldPos = GameManager.cam.ScreenToWorldPoint(mousePos);
                MainhandAttack(mouseWorldPos);
                _attackTimer = attackTime;
            }
        }