Example #1
0
    public void HorizontalLimit_Is_Eight()
    {
        ISpaceship spaceship = Substitute.For <ISpaceship>();

        spaceship.horizontalLimit = 8f;

        Assert.AreEqual(spaceship.horizontalLimit, 8);
    }
Example #2
0
    public void ShotDelay_Is_ZeroPointFive()
    {
        ISpaceship spaceship = Substitute.For <ISpaceship>();

        spaceship.shotDelay = 0.5f;

        Assert.AreEqual(spaceship.shotDelay, 0.5f);
    }
Example #3
0
    public void MovementSpeed_Is_FourPointFive()
    {
        ISpaceship spaceship = Substitute.For <ISpaceship>();

        spaceship.movementSpeed = 4.5f;

        Assert.AreEqual(spaceship.movementSpeed, 4.5f);
    }
Example #4
0
        ISpaceship CreateSpaceship(GameObject prefab, Vector3 spawnPoint)
        {
            ISpaceship spaceship = Instantiate(prefab, spawnPoint, Quaternion.identity).GetComponent(typeof(ISpaceship)) as ISpaceship;

            spaceship.Speed = spaceshipsSpeed;

            return(spaceship);
        }
Example #5
0
    public void PinkSpaceship_IsPlayer()
    {
        ISpaceship spaceship = Substitute.For <ISpaceship>();

        spaceship.color    = Spaceship.Color.Pink;
        spaceship.isPlayer = true;

        Assert.AreEqual(spaceship.color == Spaceship.Color.Pink, spaceship.isPlayer == true);
    }
Example #6
0
    public void OrangeSpaceship_IsNotPlayer()
    {
        ISpaceship spaceship = Substitute.For <ISpaceship>();

        spaceship.color    = Spaceship.Color.Orange;
        spaceship.isPlayer = false;

        Assert.AreEqual(spaceship.color == Spaceship.Color.Orange, spaceship.isPlayer == false);
    }
Example #7
0
        public static void RemoveShip(ISpaceship ship)
        {
            ShipList.Remove(ship);

            if (ship.BattleIdentity != UnitBattleIdentity.Enemy)
            {
                return;
            }
            if (ship.HealthSystem.CurHealth > 0)
            {
                return;
            }

            KilledShipList.Add(ship);
            OnKill?.Invoke(ship);
        }
Example #8
0
 public static void AddShip(ISpaceship ship) => ShipList.Add(ship);
Example #9
0
 public void Init(ISpaceship spaceship)
 {
     SpaceshipSystems = spaceship;
 }
Example #10
0
 public void Init(ISpaceship spaceship)
 {
     _spaceship = spaceship;
 }
 public void AttackSpaceship(ISpaceship targetSpaceship)
 {
     mTargetSpaceship = targetSpaceship;
       AttackTarget(targetSpaceship);
       if (targetSpaceship is ISpaceshipAttacker) mTargetIsSpaceshipAttacker = true;
 }
Example #12
0
 public void AttackSpaceship(ISpaceship targetSpaceship)
 {
     Halt();
       mAttackMode = true;
       mSpaceshipAttackBehaviour.AttackSpaceship(targetSpaceship);
 }
Example #13
0
 /// <summary>
 /// Use this function iff you want an idle SpaceShipAttacker to attack an ISpaceship
 /// If the Attacker is already moving or attacking, it will disregard this command
 /// </summary>
 /// <param name="attacker"></param>
 /// <param name="target"></param>
 public void AutoAttackSpaceship(ISpaceshipAttacker attacker, ISpaceship target)
 {
     if (attacker.Allegiance != target.Allegiance)
       {
     attacker.AutoAttackSpaceship(target);
       }
 }
Example #14
0
 /// <summary>
 /// Use this function to attack with the attacking ISpaceshipAttacker an ISpaceship (defendingUnit).
 /// The defending unit will defend itself and attack the attacking unit, if it is an ISpaceshipAttacker (it is allowed to retaliate)
 /// If the units are of the same allegiance the "attacker" moves to the Position of the "defending" unit.
 /// </summary>
 /// <param name="attackingUnit"></param>
 /// <param name="defendingUnit"></param>
 public void AttackSpaceship(ISpaceshipAttacker attackingUnit, ISpaceship defendingUnit)
 {
     if (attackingUnit.Allegiance == defendingUnit.Allegiance)
       {
     if (attackingUnit is IMovable)
     {
       ((IMovable) attackingUnit).MoveTo(defendingUnit.Position);
     }
       }
       else
       {
     attackingUnit.AttackSpaceship(defendingUnit);
       }
 }
Example #15
0
 public override void Init(ISpaceship spaceship)
 {
     base.Init(spaceship);
     _userControl = GetComponent <IUserControl>();
 }
Example #16
0
 public virtual void Init(ISpaceship spaceship)
 {
     _spaceship       = spaceship;
     _initialPosition = transform.position;
 }
 private void Enemies_OnKill(ISpaceship ship) => SetScore();
 public override void Init(ISpaceship spaceship)
 {
     base.Init(spaceship);
     PlayerSpaceship.Boosted += OnBoosted;
 }
Example #19
0
 public void Init(ISpaceship spaceship)
 {
     _spaceShip   = spaceship;
     _gameControl = FindObjectOfType <GameControl>();
 }
Example #20
0
 public void AutoAttackSpaceship(ISpaceship targetSpaceship)
 {
     if (!mAttackMode && !mMovementMode && !mMinionAttackMode || AggressiveMovementMode)
       {
     mMinionAttackMode = true;
     AttackSpaceship((targetSpaceship));
       }
 }
Example #21
0
 public virtual void Init(ISpaceship spaceship)
 {
     _spaceship = spaceship;
 }
Example #22
0
 public HomeController(ISpaceship spacer)
 {
     spaceRepo = spacer;
 }
Example #23
0
 /// <summary>
 /// Causes the Deathstar to attack target if it is not already attacking someone else or if 
 /// it is not moving.
 /// Usually triggered by an enemy spaceship that is in range.
 /// </summary>
 /// <param name="target"></param>
 public void AutoAttackSpaceship(ISpaceship target)
 {
     if (!mSpaceshipAttackMode && !mMovementMode && !mPlanetAttackMode || AggressiveMovementMode)
       {
     AttackSpaceship((target));
       }
 }