Пример #1
0
        private void AddCannon(Direction d, CannonPower type, int xOffset, int yOffset, int zOffset, bool oper = true)
        {
            MannedCannon cannon;
            BaseCreature mob = null;

            if (oper)
            {
                mob = new PirateCrew
                {
                    CantWalk = true
                };

                Crew.Add(mob);
            }

            switch (type)
            {
            default:
            case CannonPower.Light:
                cannon = new MannedCulverin(mob, d); break;

            case CannonPower.Heavy:
                cannon = new MannedCarronade(mob, d); break;

            case CannonPower.Massive:
                cannon = new MannedBlundercannon(mob, d); break;
            }

            if (mob == null)
            {
                cannon.CanFireUnmanned = true;
            }

            cannon.MoveToWorld(new Point3D(X + xOffset, Y + yOffset, Z + zOffset), Map);
            Cannons.Add(cannon);

            if (mob != null)
            {
                Point3D offset;

                switch (d)
                {
                default:
                case Direction.South:
                    offset = new Point3D(0, -1, 0); break;

                case Direction.North:
                    offset = new Point3D(0, 1, 0); break;

                case Direction.West:
                    offset = new Point3D(1, 0, 0); break;

                case Direction.East:
                    offset = new Point3D(-1, 0, 0); break;
                }

                mob.MoveToWorld(new Point3D(cannon.X + offset.X, cannon.Y + offset.Y, cannon.Z + offset.Z), Map);
            }
        }
Пример #2
0
 private void InitializeCannons()
 {
     if (Cannons.Count <= 0 && Props.cannons.Any())
     {
         foreach (CannonHandler cannon in Props.cannons)
         {
             var cannonPermanent = new CannonHandler(this.Pawn, cannon);
             cannonPermanent.SetTarget(LocalTargetInfo.Invalid);
             cannonPermanent.ResetCannonAngle();
             Cannons.Add(cannonPermanent);
         }
     }
 }
Пример #3
0
        private void InitializeCannons()
        {
            if (Cannons.Count <= 0 && Props.cannons.AnyNullified())
            {
                foreach (CannonHandler cannon in Props.cannons)
                {
                    var cannonPermanent = new CannonHandler(this.Pawn, cannon);
                    cannonPermanent.SetTarget(LocalTargetInfo.Invalid);
                    cannonPermanent.ResetCannonAngle();
                    Cannons.Add(cannonPermanent);
                }

                if (Cannons.Select(x => x.key).GroupBy(y => y).AnyNullified(key => key.Count() > 1))
                {
                    Log.Warning("Duplicate CannonHandler key has been found. These are intended to be unique.");
                }
            }
        }