Esempio n. 1
0
    public void init(FixedEntity spawner, Vector2 pos, RecruitmentPattern pattern)
    {
        this._simpleTarget    = spawner;
        this._currentPosition = pos;
        this.updatePosition(this._currentPosition);

        sizeRadius          = 2.0f;
        timeBeforeChangePos = Random.Range(3.0f, 6.0f);

        recruitmentPattern = pattern;
    }
Esempio n. 2
0
    public void createUnit(FixedEntity target)
    {
        nbAttack++;
        _nbUnitAttack = (int)Random.Range(1, nbAttack + 2);

        for (int f = 0; f < _nbUnitAttack; f++)
        {
            unitClone = Instantiate(unitPrefab) as Unit;
            unitClone.init(target, nearToSpawner(), new WavePattern(unitClone));

            newUnit = unitClone;
        }
    }
Esempio n. 3
0
    public void init(FixedEntity spawner, Vector2 pos, WavePattern pattern)
    {
        this._simpleTarget    = spawner;
        this._currentPosition = pos;
        this.updatePosition(this._currentPosition);
        this._faction = 2;

        this._maxSpeed         = 2.0f;
        this._maxSteeringForce = 2.0f;

        _animatorEntity = GetComponent <Animator>();

        sizeRadius          = 2.0f;
        timeBeforeChangePos = Random.Range(3.0f, 6.0f);

        wavePattern = pattern;
    }
Esempio n. 4
0
    // Fight function
    private void fight()
    {
        if (state._unit._simpleTarget != null)
        {
            FixedEntity enemy = state._unit._simpleTarget;

            float distance = (state._unit._currentPosition - state._unit._simpleTarget.position).magnitude;
            if (distance < state._unit._fieldOfView)
            {
                enemy.setHealPoint(enemy.getHealPoint() - 2.0f);
                enemy.playDamageSound();

                if (Random.Range(0.0f, 1.0f) < 0.5f)
                {
                    state._unit._healPoint -= 4.0f;
                }
            }
        }
    }
Esempio n. 5
0
 public void setSimpleTarget(FixedEntity newSimpleTarget)
 {
     this._simpleTarget = newSimpleTarget;
 }