예제 #1
0
    private void Update()
    {
        Vector3 direction = target.transform.position - transform.position;

        transform.Translate(direction.normalized * speed * Time.deltaTime);
        if (Vector3.Distance(transform.position, target.transform.position) <= 0.05f)
        {
            EventCoordinator.FireEvent(new DamageEvent(shooter, target, shooter.AttackDamage, Health.DamageType.Ballistic));
            BallisticTurret.ReturnBulletToPool(this);
        }
    }
예제 #2
0
 public void InstantiateBlueprint(GameObject blueprint)
 {
     if (!BlueprintIsSelected)
     {
         if (blueprint == ballisticTurretPrefab)
         {
             BallisticTurret ballisticTurret = ObjectPooler.Instance.ballisticTurretPool.Retrieve();
             ballisticTurret.Relocate();
         }
         else if (blueprint == energyTurretPrefab)
         {
             EnergyTurret energyTurret = ObjectPooler.Instance.energyTurretPool.Retrieve();
             energyTurret.Relocate();
         }
         else if (blueprint == missileTurretPrefab)
         {
             MissileTurret missileTurret = ObjectPooler.Instance.missileTurretPool.Retrieve();
             missileTurret.Relocate();
         }
         else if (blueprint == solarPanelsPrefab)
         {
             SolarPanels solarPanels = ObjectPooler.Instance.solarPanelsPool.Retrieve();
             solarPanels.Relocate();
         }
         else if (blueprint == windTurbinePrefab)
         {
             WindTurbine windTurbine = ObjectPooler.Instance.windTurbinePool.Retrieve();
             windTurbine.Relocate();
         }
         else if (blueprint == minerPrefab)
         {
             Miner miner = ObjectPooler.Instance.minerPool.Retrieve();
             miner.Relocate();
         }
     }
 }