Handles fast straight-line flying projectiles based on raycast logic
Inheritance: NetworkBehaviour, IBullet, IPoolable
Esempio n. 1
0
    private void ShootRaycast(Vector3 gunEndPointPosition, Vector3 shootPosition)
    {
        Vector3 shootDir = (shootPosition - gunEndPointPosition).normalized;

        BulletRaycast.Shoot(gunEndPointPosition, shootDir);

        WeaponTracer.Create(gunEndPointPosition, UtilsClass.GetMouseWorldPosition());
    }
Esempio n. 2
0
    private void Aim()
    {
        Vector3 vec = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;

        vec.z = 0;

        m_direction = vec;

        if (Input.GetMouseButtonDown(1))
        {
            BulletRaycast.PlayerShoot(transform.position, vec);
        }
    }
Esempio n. 3
0
    private void Player_OnShoot(object sender, Shoot.OnShootEventArgs e)
    {
        impulseSource.GenerateImpulse();

        //mesh or vfx
        if (traceOption == 0)
        {
            Vector2 shootDirection = (e.shootPosition - e.gunEndPointPosition).normalized;
            BulletRaycast.ShootRay(e.gunEndPointPosition, shootDirection);

            WeaponTracer(e.gunEndPointPosition, BulletRaycast.rayEndPoint);

            // Debug.DrawLine(e.gunEndPointPosition, BulletRaycast.rayEndPoint, Color.white, 1);
        }
        else
        {
            playerShoot.bulletFX.Emit(1);
        }
    }
Esempio n. 4
0
    //evaluates the node
    //gets the direction between the origin and the target
    //and shoots a raycast in that direction
    public override NodeState Evaluate()
    {
        m_origin.stats.nodesEvaluatedincrease();

        Vector3 direction = m_target.position - m_origin.transform.position;

        direction = Vector3.Normalize(direction);

        timer -= Time.deltaTime;

        if (timer <= 0)
        {
            BulletRaycast.EnemyShoot(m_origin.transform.position, direction);

            m_origin.stats.actionsPerformedIncrease();

            timer = 1.5f;
        }

        m_origin.velocity = direction;

        return(NodeState.Running);
    }
Esempio n. 5
0
 private void OnEnable()
 {
     hc = GetComponent <HeroController>();
     he = GetComponent <HeroComponents>();
     br = GetComponent <BulletRaycast>();
 }