예제 #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "PlayerBall" && _isInPosition && _currentState == AltAssistBehavior.AssistState.MultiplyFire && !_isInTransition)
        {
            BallBehavior bb             = other.gameObject.GetComponent <BallBehavior>();
            bool         createByAssist = bb.GetCreateByAssist();
            float        velocity       = bb.GetVelocity();

            if (!createByAssist)
            {
                bb.gameObject.SetActive(false);

                BallBehavior bb1 = SpawnManager.Instance.GetPooledBall();
                bb1.transform.position = Vector3.up + transform.position + (-transform.right * 1.25f);
                bb1.transform.rotation = Quaternion.Euler(transform.eulerAngles + new Vector3(0f, -90f, 0f));
                bb1.Init(velocity, "PlayerBall", true);

                BallBehavior bb2 = SpawnManager.Instance.GetPooledBall();
                bb2.transform.position = Vector3.up + transform.position + (-transform.forward * 1.25f);
                bb2.transform.rotation = Quaternion.Euler(transform.eulerAngles + new Vector3(0f, 180f, 0f));
                bb2.Init(velocity, "PlayerBall", true);

                BallBehavior bb3 = SpawnManager.Instance.GetPooledBall();
                bb3.transform.position = Vector3.up + transform.position + (transform.right * 1.25f);
                bb3.transform.rotation = Quaternion.Euler(transform.eulerAngles + new Vector3(0f, 90f, 0f));
                bb3.Init(velocity, "PlayerBall", true);

                BallBehavior bb4 = SpawnManager.Instance.GetPooledBall();
                bb4.transform.position = Vector3.up + transform.position + (transform.forward * 1.25f);
                bb4.transform.rotation = Quaternion.Euler(transform.eulerAngles + new Vector3(0f, 0f, 0f));
                bb4.Init(velocity, "PlayerBall", true);
            }
        }
    }
예제 #2
0
    public void InstantShootAttack(float x, float z)
    {
        if ((Time.time - _lastShootTime) >= (shootBufferTime * 2f) && (x != 0f || z != 0f) && !_isDead)
        {
            BallBehavior bb = SpawnManager.Instance.GetPooledBall();
            bb.transform.position = Vector3.up + transform.position + (new Vector3(x, 0f, z) * 1.5f);
            bb.transform.rotation = Quaternion.Euler(0f, Mathf.Atan2(x, z) * Mathf.Rad2Deg, 0f);
            bb.Init(shootMinVelocity, "PlayerBall");

            _lastShootTime = Time.time;
        }
    }
예제 #3
0
    public void InstantShootAttack()
    {
        if ((Time.time - _lastShootTime) >= (shootBufferTime * 2f) && !_isDead)
        {
            BallBehavior bb = SpawnManager.Instance.GetPooledBall();
            bb.transform.position = Vector3.up + transform.position + (transform.forward * 1.5f);
            bb.transform.rotation = transform.rotation;
            bb.Init(shootMinVelocity, "PlayerBall");

            _lastShootTime = Time.time;
        }
    }
예제 #4
0
    public void ShootAttack()
    {
        if ((Time.time - _lastShootTime) >= shootBufferTime)
        {
            BallBehavior bb = SpawnManager.Instance.GetPooledBall();
            bb.transform.position = Vector3.up + transform.position + (transform.forward * 1.5f);
            bb.transform.rotation = transform.rotation;
            bb.Init(shootVelocity, "EnemyBall");

            _lastShootTime = Time.time;
        }
    }
예제 #5
0
    public void FinalizeShootAttack()
    {
        if (_isShooting && !_isDead)
        {
            BallBehavior bb = SpawnManager.Instance.GetPooledBall();
            bb.transform.position = Vector3.up + transform.position + (transform.forward * 1.5f);
            bb.transform.rotation = transform.rotation;
            bb.Init(_shootChargeVelocity, "PlayerBall");

            _shootFeedback.lineProgress = _shootFeedback.lineOrientation = _shootChargeTimer = _shootChargeVelocity = 0f;
            _lastShootTime = Time.time;
            _isShooting    = false;
        }
    }
    public void ShootAttack()
    {
        if ((Time.time - _lastShootTime) >= shootBufferTime)
        {
            BallBehavior bb = SpawnManager.Instance.GetPooledBall();

            Vector3 forward = (playerTransform.position - transform.position).normalized;

            bb.transform.position = Vector3.up + transform.position + (forward * 1.5f);
            bb.transform.rotation = Quaternion.Euler(0f, Mathf.Atan2(forward.x, forward.z) * Mathf.Rad2Deg, 0f);
            bb.Init(shootVelocity, "EnemyBall");

            _lastShootTime = Time.time;
        }
    }
예제 #7
0
 private void Update()
 {
     switch (_currentState)
     {
     case AssistState.AutoFire:
         if (Time.time - _lastAutoFireTime > autoFireTime)
         {
             BallBehavior bb = SpawnManager.Instance.GetPooledBall();
             bb.transform.position = Vector3.up + transform.position + (-transform.forward * 1.25f);
             bb.transform.rotation = Quaternion.Euler(transform.eulerAngles + new Vector3(0f, 180f, 0f));
             bb.Init(autoFireVelocity, "PlayerBall", true);
             _lastAutoFireTime = Time.time;
         }
         break;
     }
 }
예제 #8
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "PlayerBall" && (_currentState == AssistState.MultiplyFire || _currentState == AssistState.MultiplyVelocity))
        {
            BallBehavior bb             = other.gameObject.GetComponent <BallBehavior>();
            bool         createByAssist = bb.GetCreateByAssist();
            float        velocity       = bb.GetVelocity();

            switch (_currentState)
            {
            case AssistState.MultiplyFire:
                if (!createByAssist)
                {
                    other.gameObject.SetActive(false);

                    BallBehavior bb1 = SpawnManager.Instance.GetPooledBall();
                    bb1.transform.position = Vector3.up + transform.position + (-transform.right * 1.25f);
                    bb1.transform.rotation = Quaternion.Euler(transform.eulerAngles + new Vector3(0f, -90f, 0f));
                    bb1.Init(velocity, "PlayerBall", true);

                    BallBehavior bb2 = SpawnManager.Instance.GetPooledBall();
                    bb2.transform.position = Vector3.up + transform.position + (-transform.forward * 1.25f);
                    bb2.transform.rotation = Quaternion.Euler(transform.eulerAngles + new Vector3(0f, 180f, 0f));
                    bb2.Init(velocity, "PlayerBall", true);

                    BallBehavior bb3 = SpawnManager.Instance.GetPooledBall();
                    bb3.transform.position = Vector3.up + transform.position + (transform.right * 1.25f);
                    bb3.transform.rotation = Quaternion.Euler(transform.eulerAngles + new Vector3(0f, 90f, 0f));
                    bb3.Init(velocity, "PlayerBall", true);
                }
                break;

            case AssistState.MultiplyVelocity:
                bb.SetVelocity(2f);
                break;
            }
        }
        else if (other.gameObject.tag == "EnemyBall" && (_currentState == AssistState.Shield))
        {
            switch (_currentState)
            {
            case AssistState.Shield:
                other.gameObject.SetActive(false);
                break;
            }
        }
    }
예제 #9
0
    public void Update()
    {
        if (_isInTransition)
        {
            if (Time.time - _transitionStartTime > transitionDuration)
            {
                _isInPosition = !_isInPosition;

                if (_isInPosition)
                {
                    transform.position = _endTransitionTr.position;
                    transform.rotation = _endTransitionTr.rotation;

                    shield.SetActive(_currentState == AltAssistBehavior.AssistState.Shield);
                    autoFire.SetActive(_currentState == AltAssistBehavior.AssistState.AutoFire);
                    multiplyFire.SetActive(_currentState == AltAssistBehavior.AssistState.MultiplyFire);
                }
                else
                {
                    transform.parent        = playerToAttach.headPosition;
                    transform.localPosition = Vector3.zero;
                    transform.localRotation = Quaternion.identity;
                }

                _isInTransition = false;
            }
            else
            {
                float progress = (Time.time - _transitionStartTime) / transitionDuration;
                transform.position = Vector3.Lerp(_startTransitionTr.position, _endTransitionTr.position, progress);
                transform.rotation = Quaternion.Lerp(_startTransitionTr.rotation, _endTransitionTr.rotation, progress);
            }
        }

        if (_isInPosition && _currentState == AltAssistBehavior.AssistState.AutoFire && !_isInTransition)
        {
            if (Time.time - _lastAutoFireTime > autoFireTime)
            {
                BallBehavior bb = SpawnManager.Instance.GetPooledBall();
                bb.transform.position = Vector3.up + transform.position + (-transform.forward * 1.25f);
                bb.transform.rotation = Quaternion.Euler(transform.eulerAngles + new Vector3(0f, 180f, 0f));
                bb.Init(autoFireVelocity, "PlayerBall", true);
                _lastAutoFireTime = Time.time;
            }
        }
    }