Ejemplo n.º 1
0
 private void Fire()
 {
     if (projectilePrefab)
     {
         StraightFlyEnemy firedProjectile = Instantiate(projectilePrefab, transform.position, Quaternion.identity) as StraightFlyEnemy;
         firedProjectile.velocity = Facing.FacingToUnitVector3(facing) * projectileVelocity;
     }
 }
Ejemplo n.º 2
0
 private void StartMove()
 {
     Mode = AIMode.Move;
     //choose direction
     facing     = Facing.RandomFacingThatIsntThisOne(facing);
     trajectory = Facing.FacingToUnitVector3(facing);
     //choose length of travel
     chosenTravelTime = Random.Range(minTravelTime, maxTravelTime);
 }
Ejemplo n.º 3
0
    private void Move()
    {
        if (modeTime > chosenTravelTime)
        {
            StartFiring();
        }
        Vector3 positionBefore = transform.position;

        base.MoveWithSliding(trajectory * Time.fixedDeltaTime * moveSpeed);
        Vector3 positionAfter = transform.position;

        if (positionBefore == positionAfter)
        {
            facing     = Facing.OppositeFacing(facing);
            trajectory = Facing.FacingToUnitVector3(facing);
        }
    }