Ejemplo n.º 1
0
 void Start()
 {
     _laserScript = laser.GetComponent <Lux_TrackingLaser>();
     objCollider  = gameObject.GetComponent <Collider>();
     hitTest      = false;
     GiveSpeed();
 }
Ejemplo n.º 2
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("Vehicle") && collision.gameObject != _immunePlayer)
        {
            objCollider.isTrigger = true;

            /* GameObject _spawnedLaser = Instantiate(laser, transform.position, transform.rotation);
             * _laserScript = _spawnedLaser.GetComponent<Lux_TrackingLaser>();
             * _spawnedLaser.transform.SetParent(collision.gameObject.transform);
             * _laserScript.GiveInfo(_laserDamageRate, _laserDamage, _laserDuration, _immunePlayer);
             * _laserScript.SetTarget(collision.gameObject);*/
            Lux_TrackingLaser _spawnedLaser = Instantiate(_laserScript, transform.position, transform.rotation);
            _spawnedLaser.transform.SetParent(null);
            _spawnedLaser.GiveInfo(_laserDamageRate, _laserDamage, _laserDuration, _immunePlayer);
            _spawnedLaser.SetTarget(collision.gameObject);
            Destroy(gameObject);
        }

        if (collision.gameObject.CompareTag("Interactable"))
        {
            objCollider.isTrigger = true;

            /* GameObject _spawnedLaser = Instantiate(laser, transform.position, transform.rotation);
             * _laserScript = _spawnedLaser.GetComponent<Lux_TrackingLaser>();
             * _spawnedLaser.transform.SetParent(collision.gameObject.transform);
             * _laserScript.GiveInfo(_laserDamageRate, _laserDamage, _laserDuration, _immunePlayer);
             * _laserScript.SetTarget(collision.gameObject);*/
            Lux_TrackingLaser _spawnedLaser = Instantiate(_laserScript, transform.position, transform.rotation);
            _spawnedLaser.transform.SetParent(null);
            _spawnedLaser.GiveInfo(_laserDamageRate, _laserDamage, _laserDuration, _immunePlayer);
            _spawnedLaser.SetTarget(collision.gameObject);
            Destroy(gameObject);
        }

        if (collision.gameObject.layer == LayerMask.NameToLayer("Wall"))
        {
            _rigidBody.velocity = new Vector3(0, 0, 0);
            _hitObject          = collision.gameObject;
        }
    }