コード例 #1
0
    private void ThrustCheck()
    {
        if (stopInput || dead)
        {
            return;
        }

        if (Input.anyKey)
        {
            if (!buttonPressed)
            {
                buttonPressed = true;
                Tile t = Level.MapTile(gameObject);
                if (Safe(t))
                {
                    pillar           = t.Pillar.transform.position;
                    pullPoint        = t.PullPoint.transform.position;
                    deltaAngle       = 0;
                    deltaAngleAction = 0;
                    lastDirToPillar  = pillar - transform.position;

                    GetHeading = CalculateHeading(pullPoint);


                    rb.AddForce(GetHeading(pullPoint).normalized *Acceleration *4, ForceMode.Acceleration);
                }
            }
            Vector3 dir = GetHeading(pullPoint);

            holdTimer += Time.deltaTime;
            if (holdTimer >= thrustTime && !actionPerformed)
            {
                rb.AddForce(dir.normalized * Acceleration, ForceMode.Acceleration);
                GrappleObject.PointAt(pullPoint);
                AutoGrapple.Retract();
            }
        }
        else
        {
            if (buttonPressed)
            {
                if (holdTimer < thrustTime)
                {
                    print("press");
                }
                holdTimer        = 0;
                deltaAngle       = 0;
                deltaAngleAction = 0;
                buttonPressed    = false;
                actionPerformed  = false;
                GrappleObject.Retract();
            }
        }
    }
コード例 #2
0
ファイル: Gun.cs プロジェクト: TheDecimeter/RebuildTheVoid
    private IEnumerator Shoot()
    {
        while (enemies.Count > 0)
        {
            Bomber b = enemies.Pop();
            do
            {
                if (b == null)
                {
                    break;
                }
                yield return(new WaitForSeconds(CoolDown));

                if (b == null || Vector3.Distance(transform.position, b.transform.position) > range)
                {
                    break;
                }
                float pooptimer = 0;
                while (pooptimer < fireRate)
                {
                    if (b == null)
                    {
                        break;
                    }
                    weapon.PointAt(b.transform.position);
                    pooptimer += Time.deltaTime;
                    yield return(null);
                }
                weapon.Retract();
            } while (!b.TryKill(Damage()));
        }
    }
コード例 #3
0
    private IEnumerator Shoot(float seconds)
    {
        float wait = seconds / 3;

        Vector3 target = ShootPoint();

        weapon.PointAt(target + Offset());
        yield return(new WaitForSeconds(wait));

        weapon.PointAt(target + Offset());
        yield return(new WaitForSeconds(wait));

        weapon.PointAt(target + Offset());
        yield return(new WaitForSeconds(wait));

        weapon.Retract();

        if (Target.TryKill(damage))
        {
            attacking = false;
            StopAllCoroutines();
            StartCoroutine(Leave());
        }
    }
コード例 #4
0
 private void AckwireTarget()
 {
     target = targets[Random.Range(0, targets.Length)];
     laser.Retract();
 }