Esempio n. 1
0
 void Start()
 {
     _context            = Contexts.sharedInstance;
     _logHealthSystem    = new LogHealth(_context);
     _createPlayerSystem = new CreatePlayerSystem(_context);
     _createPlayerSystem.Initialize();
 }
Esempio n. 2
0
    void Shoot()
    {
        timer = 0f;

        gunAudio.Play();
        gunParticles.Stop();
        gunParticles.Play();

        gunLine.enabled = true;
        gunLine.SetPosition(0, transform.position);
        shootRay = Camera.main.ScreenPointToRay(Input.mousePosition);
        //shootRay.origin = transform.position;
        //shootRay.direction = transform.forward;

        if (Physics.Raycast(shootRay, out shootHit, range, shootableMask))
        {
            AlienOneHealth alienHealth = shootHit.collider.GetComponent <AlienOneHealth> ();
            if (alienHealth != null)
            {
                alienHealth.TakeDamage(damagePerShot, shootHit.point);
            }

            ShortAlienHealth shortHealth = shootHit.collider.GetComponent <ShortAlienHealth>();
            if (shortHealth != null)
            {
                shortHealth.TakeDamage(damagePerShot, shootHit.point);
            }

            LogHealth logHealth = shootHit.collider.GetComponent <LogHealth>();
            if (logHealth != null)
            {
                logHealth.TakeDamage(damagePerShot, shootHit.point);
            }

            SpawnHealth spawnHealth = shootHit.collider.GetComponent <SpawnHealth>();
            if (spawnHealth != null)
            {
                spawnHealth.TakeDamage(damagePerShot, shootHit.point);
            }
            gunLine.SetPosition(1, shootHit.point);
        }
        else
        {
            gunLine.SetPosition(1, shootRay.origin + shootRay.direction * range);
        }
    }