Exemplo n.º 1
0
 public SimUnitInstance(Simulation sim, SimUnitConfig unit, Vector3 startpos, ISimUnitEventHandler handler) : base(sim, unit, startpos)
 {
     Health          = unit.Health;
     UnitConfig      = unit;
     eventhandler    = handler;
     this.OnDestroy += handler.OnDestroyEventHandler;
 }
Exemplo n.º 2
0
 private void HandleonSimExplode(SimUnitConfig simUnit)
 {
     incrementCurrency(simUnit.Cost);
     _currencyEarned += simUnit.Cost;
     incrementScore(simUnit.Points);
     _unitsDestroyed++;
 }
Exemplo n.º 3
0
 public void CancelPlacementPreview()
 {
     GameObject.Destroy(placementPreviewObject);
     _selectedUnitType = null;
     placingUnit       = false;
     ShowPlacedUnitAreas(false);
 }
Exemplo n.º 4
0
    public void SelectUnit(SimUnitConfig unit)
    {
        _selectedUnitType = unit;
        placingUnit       = true;

        ShowPlacedUnitAreas(true);
    }
Exemplo n.º 5
0
    public void SetAreaVisuals(SimUnitConfig unit)
    {
        float placementAreaScale = unit.RadiusOfPlacement;
        float attackAreaScale    = unit.RadiusOfAffect;

        placementArea.transform.localScale = new Vector3(placementAreaScale, .1f, placementAreaScale);
        attackArea.transform.localScale    = new Vector3(attackAreaScale, .1f, attackAreaScale);
    }
Exemplo n.º 6
0
    public SimUnitInstance AddUnit(SimUnitConfig unittype, Vector3 startingposition, ISimUnitEventHandler EventHandler)
    {
        SimUnitInstance inst = new SimUnitInstance(this, unittype, startingposition, EventHandler);

        if (unittype.Team == SimUnitConfig.ETeam.Friendly)
        {
            FriendlySimUnits.Add(inst);
        }
        else
        {
            EnemySimUnits.Add(inst);
        }
        return(inst);
    }
Exemplo n.º 7
0
    public void SetSimUnit(SimUnitConfig inst)
    {
        if (_simunitinst == null && inst != null)
        {
            simunit      = inst;
            _simunitinst = SimulationComponent.CurrentSim.AddUnit(simunit, transform.position, this);
            _unitMapping.Add(_simunitinst, this.transform);

            SetAreaVisuals(simunit);
        }
        else if (_simunitinst != null && inst == null)
        {
            SimulationComponent.CurrentSim.RemoveUnit(_simunitinst);
        }
    }
Exemplo n.º 8
0
    private void DeterminWaveUnits()
    {
        int poolValue = _currentWave * DIFFICULTY_MULTIPLIER + DIFFICULTY_MULTIPLIER;

        List <SimUnitConfig> unitPool = PossibleUnits();

        while (poolValue > 0)
        {
            SimUnitConfig newUnit = unitPool[Random.Range(0, unitPool.Count)];

            if (newUnit.PowerValue <= poolValue)
            {
                _waveUnits.Add(newUnit);
                poolValue -= (int)newUnit.PowerValue;
            }
        }
    }
Exemplo n.º 9
0
    public void AddUnit(GameObject go, SimUnitConfig unit)
    {
        UnitComponent ucomp = go.AddComponent <UnitComponent>();

        ucomp.SetSimUnit(unit);
    }