Exemplo n.º 1
0
    private void OnCollisionEnter(Collision coll)
    {
        BoatTypes    boatColl   = coll.gameObject.GetComponent <BoatTypes>(); // gets the type of boat from the boatType enum
        BoatMovement boatScript = coll.gameObject.GetComponent <BoatMovement>();

        if (boatColl != null && boatScript != null) // only called if the boatColl is actually present
        {
            switch (boatColl.boatType)              // cycles through each element in the boat type enum
            {
            case Boats.ENEMY_1:
                boatScript.Die();     // enemies are instantly destroyed
                break;

            case Boats.MERCHANT_1:
                boatScript.Die();     // merchants are instantly destroyed
                break;

            case Boats.PLAYER:
                boatScript.TakeDamage(20);     // the player takes 20 damage
                break;

            default:
                break;
            }
        }
        Destroy(gameObject); // destroys the cannonball regardless
    }
Exemplo n.º 2
0
        public void editBoatInformation(MemberModel member)
        {
            if (member == null)
            {
                return;
            }
            if (member.Boat.Count == 0)
            {
                Console.WriteLine("No boats found");
            }

            int index = _boatView.getIndexOfBoats(member.Boat);

            if (index == RETURN_TO_MENU)
            {
                return;
            }
            BoatModel boat       = member.GetBoat(index);
            BoatTypes boatType   = _boatView.getBoatType();
            double    boatLength = _boatView.getBoatLength();

            boat.Type       = boatType;
            boat.BoatLength = boatLength;
            _storage.updateMember(member);
        }
Exemplo n.º 3
0
        private static string GetRandomBoat()
        {
            Array     values     = Enum.GetValues(typeof(BoatTypes));
            Random    random     = new Random();
            BoatTypes randomBoat = (BoatTypes)values.GetValue(random.Next(values.Length));

            return(randomBoat.ToString());
        }
Exemplo n.º 4
0
 private void LoadBoatData(int boatId)
 {
     using (var context = new BootDB())
     {
         var tableData = (from b in context.Boats
                          join bt in context.BoatTypes
                          on b.boatTypeId equals bt.boatTypeId
                          where b.boatId == boatId
                          select new
         {
             boatId = b.boatId,
             boatTypeId = bt.boatTypeId,
             boatName = b.boatName,
             boatTypeName = bt.boatTypeName,
             boatTypeDescription = bt.boatTypeDescription,
             boatSteer = bt.boatSteer,
             boatRowLevel = bt.boatRowLevel,
             boatAmountSpaces = bt.boatAmountSpaces,
             boatYoutubeUrl = b.boatYoutubeUrl
         });
         //getting the rowLevel of the user
         RowLevelMember = int.Parse((from b in context.Members
                                     where b.memberId == MemberId
                                     select b.memberRowLevelId).First().ToString());
         foreach (var b in tableData)
         {
             // Loop through record and add to new BoatType
             BoatType = new BoatTypes()
             {
                 boatTypeName        = b.boatTypeName,
                 boatTypeDescription = b.boatTypeDescription,
                 BoatSteerString     = (b.boatSteer == 0) ? "zonder stuur" : "met stuur",
                 boatAmountSpaces    = b.boatAmountSpaces,
                 boatRowLevel        = b.boatRowLevel
             };
             BoatName        = b.boatName;
             BoatDescription = b.boatTypeDescription;
             RowLevelBoat    = b.boatRowLevel;
             // Loop through record and add to new Boat
             BoatData = new Boat()
             {
                 boatId         = b.boatId,
                 boatTypeId     = b.boatTypeId,
                 boatName       = b.boatName,
                 boatYoutubeUrl = b.boatYoutubeUrl
             };
         }
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Get duration of boat
 /// </summary>
 /// <param name="boatType">Type of the boat</param>
 /// <returns></returns>
 private static int GetBoatDuration(BoatTypes boatType)
 {
     if (boatType == BoatTypes.CargoShip)
     {
         return(ConstantValues.CargoShipDuration);
     }
     else if (boatType == BoatTypes.SailBoat)
     {
         return(ConstantValues.SailBoatDuration);
     }
     else
     {
         return(ConstantValues.SpeedBoatDuration);
     }
 }
Exemplo n.º 6
0
 public void updateBoatList(Boat selectedBoat, BoatTypes type)
 {
     selectedBoat.Type = type;
 }
Exemplo n.º 7
0
        public void addToBoatList(Member member, BoatTypes type, string length)
        {
            int boatId = member.Boats.Count + 1;

            member.Boats.Add(new Boat(type, length, boatId));
        }
Exemplo n.º 8
0
 public BoatModel(BoatTypes types, double length)
 {
     _type       = types;
     _boatLength = length;
 }