Exemple #1
0
    public void IncrementCounter(ShipTypeEnum shipType)
    {
        int index = (int)shipType;

        if (index >= 0 && index < _shipCounterCount)
        {
            ++_shipCounters[index].counter;
        }
    }
Exemple #2
0
 public RotatingShip(float x, float y, ShipTypeEnum type, float angle)
 {
     Position = new Vector2(x, y);
     Type     = type;
     Angle    = angle;
     SetDirection(AngleToVector(angle));
     TargetPosition.Y = (int)type * (8 + 16);
     ListOfShips.Add(this);
 }
Exemple #3
0
 public void ShipCollected(ShipTypeEnum shipType)
 {
     if (GameState == EGameState.InGame)
     {
         _money += 10;
         _winController.IncrementCounter(shipType);
         if (_winController.Completed())
         {
             GameState         = EGameState.PostGame;
             _pendingGameState = EGameState.Win;
         }
     }
 }
 /// <summary>Initializes a new instance of the <see cref="ShipTypeModel"/> class.</summary>
 /// <param name="shipType">The ship type.</param>
 /// <param name="maxSpeed">The max speed.</param>
 /// <param name="maxCrew">The max crew.</param>
 public ShipTypeModel(ShipTypeEnum shipType, int maxSpeed, int maxCrew)
 {
     this.ShipType = shipType;
     this.MaxSpeed = maxSpeed;
     this.MaxCrew = maxCrew;
 }
Exemple #5
0
 public EnemyShip(float x, float y, ShipTypeEnum type, float angle) : base(x, y, type, angle)
 {
     PositionOnGrid = new Point(-1, -1);
 }
Exemple #6
0
        private void CalculateShipCategory()
        {
            ShipTypeEnum originalType = m_shipCategory;

            if (m_shipThrusters == null && (m_shipWheels == null || m_shipWheels.WheelCount <= 0))
            {
                m_shipCategory = ShipTypeEnum.Debris;
            }
            else
            {
                bool hasController = false;
                foreach (var block in m_shipGrid.GetFatBlocks())
                {
                    if (block is MyShipController)
                    {
                        if (m_shipGrid.MainCockpit == null && m_shipGrid.GridSizeEnum == MyCubeSize.Small)
                        {
                            m_shipSoundSource = block as MyEntity;
                        }
                        hasController = true;
                        break;
                    }
                }
                if (hasController)
                {
                    int shipMass = m_shipGrid.GetCurrentMass();
                    if (shipMass >= SHIP_CATEGORY_MASS_HUGE)
                    {
                        m_shipCategory = ShipTypeEnum.Huge;
                    }
                    else if (shipMass >= SHIP_CATEGORY_MASS_LARGE)
                    {
                        m_shipCategory = ShipTypeEnum.Large;
                    }
                    else if (shipMass >= SHIP_CATEGORY_MASS_MEDIUM)
                    {
                        m_shipCategory = ShipTypeEnum.Medium;
                    }
                    else if (shipMass >= SHIP_CATEGORY_MASS_SMALL)
                    {
                        m_shipCategory = ShipTypeEnum.Small;
                    }
                    else if (shipMass >= SHIP_CATEGORY_MASS_TINY)
                    {
                        m_shipCategory = ShipTypeEnum.Tiny;
                    }
                    else
                    {
                        m_shipCategory = ShipTypeEnum.Debris;
                    }
                }
                else
                {
                    m_shipCategory = ShipTypeEnum.Debris;
                }
            }

            if (originalType != m_shipCategory)
            {
                m_categoryChange = true;
                if (m_shipCategory == ShipTypeEnum.Debris)
                {
                    for (int i = 0; i < m_emitters.Length; i++)
                    {
                        if (m_emitters[i].IsPlaying && m_emitters[i].Loop)
                        {
                            if (i == (int)ShipEmitters.WheelsMain || i == (int)ShipEmitters.WheelsSecondary)
                            {
                                m_emitters[i].StopSound(m_shipWheels == null);
                            }
                            else
                            {
                                m_emitters[i].StopSound(m_shipThrusters == null);
                            }
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < m_emitters.Length; i++)
                    {
                        if (m_emitters[i].IsPlaying && m_emitters[i].Loop)
                        {
                            m_emitters[i].StopSound(true);
                        }
                    }
                }
            }
            if (m_shipCategory == ShipTypeEnum.Debris)
            {
                SetGridSounds(false);
            }
            else
            {
                SetGridSounds(true);
            }
        }
Exemple #7
0
 public Ship(ShipTypeEnum shipTypeEnum)
 {
     ShipType = shipTypeEnum;
 }
Exemple #8
0
 public SingleShipCounter(ShipTypeEnum shipType)
 {
     this.shipType = shipType;
     this.counter  = 0;
     this.goal     = 0;
 }