Ejemplo n.º 1
0
 void Start()
 {
     //if (staticRef == null)
     //{
     //staticRef = this;
     rBody          = this.transform.GetComponent <Rigidbody>();
     behaviourState = EnemyBehaviourState.Default;
     //}
 }
Ejemplo n.º 2
0
 protected void MoveToPoint(EnemyPoint point, float time)
 {
     _endMovePosition = point.Point.position;
     point.OccupyPoint(this);
     StopOccupyingActualPoint();
     _actualPoint       = point;
     _startMovePosition = transform.position;
     _currentLevelHandler.ChangeStateOfEnemy(Enemy, EnemyBehaviourState.Idle);
     State       = EnemyBehaviourState.MovingToPoint;
     _timeToMove = time;
     _idleTimer  = 0;
     _moveTimer  = 0;
 }
Ejemplo n.º 3
0
    public override void OnEnemyStateChanged(Enemy enemy, EnemyBehaviourState state) //UWAGA UWZGLEDNIAC SMIERC PRZY LICZENIU COUNT
    {
        CrabBehaviour crab = EnemyToCrabBehaviour(enemy);

        if (crab.MovedToSecondPoint && state == EnemyBehaviourState.Idle)
        {
            _count++;
            if (_count == _crabBehaviours.Count)
            {
                _count          = 0;
                _waitingForMove = true;
            }
        }
    }
Ejemplo n.º 4
0
    private void AIPursue()
    {
        float distanceFromDestination = (path[path.Count - 1].GetPosition() - this.transform.position).magnitude;

        if (distanceFromDestination > i_pursuingDistance)
        {
            Vector3 movementDirection = (FindLastVisibleNavPoint(i_size).GetPosition() - transform.position).normalized;
            velocity = movementDirection * i_movementSpeed;
            velocity.Set(velocity.x, 0f, velocity.z);
            rBody.velocity = velocity;
        }
        if (distanceFromDestination <= i_pursuingDistance)
        {
            behaviourState = EnemyBehaviourState.Default;
            Debug.Log("nolongerinpursuit");
        }
    }
Ejemplo n.º 5
0
 private void AIDefault()
 {
     velocity = new Vector3(0f, 0f, 0f);
     velocity.Set(velocity.x, 0f, velocity.z);
     rBody.velocity = velocity;
     //if (WithinSightOfPlayer())
     if (isAIEnabled)
     {
         path             = BetterNavNet.FindPath(nearestNavPoint, PlayerMovementAndRotation.nearestNavPoint, i_size);
         pathElementIndex = 0;
         if (path != null)
         {
             LineRenderingThing.staticRef.DrawPath(path);
             behaviourState = EnemyBehaviourState.Pursue;
         }
     }
 }
Ejemplo n.º 6
0
 public abstract void OnEnemyStateChanged(Enemy enemy, EnemyBehaviourState state);
Ejemplo n.º 7
0
 public void ChangeStateOfEnemy(Enemy enemy, EnemyBehaviourState targetState)
 {
     enemy.BehaviourScript.State = targetState;
     OnEnemyStateChanged(enemy, targetState);
 }
Ejemplo n.º 8
0
 public override void OnEnemyStateChanged(Enemy enemy, EnemyBehaviourState state)
 {
 }
Ejemplo n.º 9
0
 private void StopMoving()
 {
     State = EnemyBehaviourState.Idle;
 }