Exemple #1
0
 private void findNewTarget()
 {
     if (_spawns >= this.SpawnsPerRotation - 1)
     {
         _targetPos = _homePos;
     }
     else
     {
         _targetPos = new Vector3(Mathf.Round(Random.Range(this.LowerLeft.position.x, this.UpperRight.position.x)), Mathf.Round(Random.Range(this.LowerLeft.position.y, this.UpperRight.position.y)), this.transform.position.z);
     }
     _lerpMovement.BeginMovement(_targetPos, _timeBetweenSpawns);
 }
Exemple #2
0
 private void moveLerpFinished(GameObject gameObject)
 {
     if (_movingOut)
     {
         _movingOut  = false;
         _movingBack = true;
         _lerpMovement.BeginMovement(_normalPosition);
     }
     else if (_movingBack)
     {
         _movingBack = false;
     }
 }
    private void seekAttackPoint()
    {
        IntegerVector target = new IntegerVector(Random.Range(_lowerLeft.X, _upperRight.X), Random.Range(_lowerLeft.Y, _upperRight.Y));

        int i = 0;

        while (i < this.AttemptsAtPreferred && Vector2.Distance(this.transform.position, target) < this.PreferredMinDistance)
        {
            target = new IntegerVector(Random.Range(_lowerLeft.X, _upperRight.X), Random.Range(_lowerLeft.Y, _upperRight.Y));
            ++i;
        }

        _lerpMovement.BeginMovement(target);
    }
Exemple #4
0
    private void enterTransition()
    {
        _switchState = false;
        int subBossIndex = 0;

        for (int i = 0; i < this.RotationPoints.Length && subBossIndex < this.SubBosses.Count; ++i)
        {
            LerpMovement subBoss = this.SubBosses[subBossIndex].GetComponent <LerpMovement>();
            subBoss.BeginMovement(this.RotationPoints[i].position, this.TimeForSinglePath);
            ++subBossIndex;
        }

        _timedCallbacks.AddCallback(this, switchState, this.TimeForSinglePath + 0.1f);
    }
    private void attack()
    {
        if (_target == null)
        {
            attackReturn(null);
            _lerpMovement.ClearCallbacks();
            return;
        }

        _lerpMovement.MovementSpeed = _attackSpeed;
        _lerpMovement.ClearCallbacks();
        _lerpMovement.AddCallback(attackReturn);

        Vector2 targetPosition = _target.position;
        float   distance       = Vector2.Distance(targetPosition, _homePosition);

        if (distance < this.MinAttackDistance)
        {
            float angle = Mathf.Atan2((targetPosition.y - _homePosition.y), (targetPosition.x - _homePosition.x));
            targetPosition.x = _homePosition.x + this.MinAttackDistance * Mathf.Cos(angle);
            targetPosition.y = _homePosition.y + this.MinAttackDistance * Mathf.Sin(angle);
        }
        _lerpMovement.BeginMovement(targetPosition);
    }
    private void enterAligning()
    {
        _switchState        = false;
        _alignmentsToFinish = this.SubBosses.Count;
        _spawnCooldown      = -1.0f;

        for (int i = 0; i < this.SubBosses.Count; ++i)
        {
            this.SubBosses[i].GetComponent <Actor2D>().RemoveVelocityModifier(Damagable.VELOCITY_MODIFIER_KEY);
            this.SubBosses[i].GetComponent <Damagable>().Stationary = true;
            LerpMovement lerpMovement = this.SubBosses[i].GetComponent <LerpMovement>();
            lerpMovement.AddCallback(movementFinished);
            lerpMovement.BeginMovement(this.transform.localToWorldMatrix.MultiplyPoint(this.SubBosses[i].GetComponent <StartingPosition>().Local()), this.TimeToRealign);
        }
    }
Exemple #7
0
 private void findNewTarget()
 {
     _targetPos = new Vector3(Mathf.Round(Random.Range(this.LowerLeft.position.x, this.UpperRight.position.x)), Mathf.Round(Random.Range(this.LowerLeft.position.y, this.UpperRight.position.y)), this.transform.position.z);
     _lerpMovement.BeginMovement(_targetPos, this.TimeBetweenSpawns);
 }