// ---------- void OnGUI() { if (!Managers.Game.paused) { // GUI while the game is running GUI.Box(statsRect, "Time: " + minutes + ":" + seconds + "\n\nRemaining: " + this.remainingEnemies + "\nShots fired: " + CWeapon.GetShotsFired() + "\nAccuracy: " + CWeapon.GetAccuracy() + "%" // The accuracy is refreshed on each confirmed hit. ); GUI.Box(scoreRect, "Score: " + Managers.Game.GetScore()); GUI.Box(livesRect, "Lives: " + CShip.GetLives()); } else if (Managers.Game.paused) { // GUI while the game is paused. if (GUI.Button(new Rect((scrWid / 2) - (boxWid / 2), (scrHei / 2) - (boxHei / 2), boxWid, boxHei / 3), "Continue")) { Managers.Game.PauseSwitch(); } if (GUI.Button(new Rect((scrWid / 2) - (boxWid / 2), (scrHei / 2) - (boxHei / 6) + 5, boxWid, boxHei / 3), "Close game")) { Application.Quit(); } } }
public void BuildShip() { CShip ship = new CShip(PlayerManager.playerInstance.m_playerFleet.m_shipList.Count, E_SHIP_TYPE.Figther); PlayerManager.playerInstance.m_playerFleet.AddShip(ship); Debug.Log("BuildShip : " + ship.m_shipName.ToString()); }
static void Main(string[] args) { string[] menuiItems = new string[] { "quit", "create new vehicle", "show all vehicles in list", "show max speed vehicle", "show the newest vehicle", "show the oldest vehicle", "clear console" }; int indexCommand; CCar Car1 = new CCar(new GPS(1, 1), 10, 2018); CPlane Plane1 = new CPlane(new GPS(2, 2), 100, 2015, "100 m", 200); CPlane Plane2 = new CPlane(new GPS(2, 2), 200, 2015, "200 m", 300); CShip Ship1 = new CShip(new GPS(3, 3), 250, 2014, 50, "PortName"); CShip Ship2 = new CShip(new GPS(4, 4), 150, 2013, 20, "PortName2"); do { indexCommand = UserConsoleInteractor.GetCommandFromOptionMenu(menuiItems); UserConsoleInteractor.ChooseOptionMenu(indexCommand); } while (indexCommand != 0); Console.ReadLine(); }
public CWeapon(CShip parentShip, E_WEAPON_TYPE type) { m_weaponName = "Weapon_" + parentShip.m_shipStats.weaponAttachement + "_" + type.ToString(); m_parentShip = parentShip; m_weaponType = type; m_weaponStats = new CWeaponStats(type); }
// ------------------------------ void Awake() { weap = MonoBehaviour.FindObjectOfType(typeof(CWeapon)) as CWeapon; ship = MonoBehaviour.FindObjectOfType(typeof(CShip)) as CShip; // spr = MonoBehaviour.FindObjectOfType(typeof(CSpriteManager)) as CSpriteManager; this.paused = false; }
public CEquipment(CShip ship, E_EQUIPMENT_TYPE type) { m_equipmentName = "Equipment_" + ship.m_shipStats.equipmentAttachement + "_" + type.ToString(); m_equipmentType = type; m_parentShip = ship; //todo }
static void Main(string[] args) { CVehicle[] massTransport = new CVehicle[12]; massTransport[0] = new CCar("Car #1", 1000, 100, 2015, 0, 0, "Red"); massTransport[1] = new CPlane("Plane#1", 500000, 1000, 2010, 0, 0, 5000, 230); massTransport[2] = new CShip("Ship #1", 400000, 60, 2016, 0, 0, 500, "Kiyv"); massTransport[3] = new CCar("Car #2", 1200, 120, 2017, 0, 0, "Green"); massTransport[4] = new CPlane("Plane#2", 520000, 900, 2014, 0, 0, 7000, 120); massTransport[5] = new CShip("Ship #1", 420000, 40, 2018, 0, 0, 700, "Kiyv 1"); massTransport[6] = new CCar("Car #4", 1300, 120, 2016, 0, 0, "Yellow"); massTransport[7] = new CPlane("Plane#3", 530000, 1100, 2012, 0, 0, 8000, 280); massTransport[8] = new CShip("Ship #1", 430000, 30, 2014, 0, 0, 400, "Dnipro"); massTransport[9] = new CCar("Car #3", 1400, 130, 2015, 0, 0, "Blue"); massTransport[10] = new CPlane("Plane#4", 550000, 1200, 2011, 0, 0, 4000, 100); massTransport[11] = new CShip("Ship #1", 460000, 70, 2017, 0, 0, 520, "Chernigov"); Console.WriteLine("1. Найти транспортное стредство от 2011 до 2015 года выпуска"); Console.WriteLine("2. Найти транспортное стредство со скоростью от 70 до 900 км/час "); Console.WriteLine("3. Найти транспортное стредство с посадочными местами от 150 до 500"); Console.WriteLine("4. Найти транспортное стредство красного цвета"); Console.WriteLine("Введите пункт меню"); int MenuItem; int.TryParse(Console.ReadLine(), out MenuItem); Console.WriteLine("Результат поиска"); switch (MenuItem) { case 1: MySearch.VehicleYear(massTransport, 2015, 2011); break; case 2: MySearch.VehicleSpeed(massTransport, 900, 70); break; case 3: MySearch.VehiclePassengerCapacity(massTransport, 500, 150); break; case 4: MySearch.VehicleColor(massTransport, "Red"); break; default: break; } Console.WriteLine("Полный список"); foreach (var item in massTransport) { Console.WriteLine(item.ToString()); } Console.ReadLine(); }
private static void GetPortOfVehicle(List <CVehicle> vehicles) { foreach (var item in vehicles) { CShip ship = item as CShip; if (ship != null) { Console.WriteLine(ship.GetPort()); Console.WriteLine("\n"); } } }
// ---------- // Reset the ship and enemies (keep score and -1 life) public void Respawn(int l) { if (l > 0) // Only respawn if there are lives left. { ship.ResetPosition(); Managers.EnemyMgr.ResetEnemies(true); CShip.SetLives(CShip.GetLives() - 1); weap.SetFireDelay(weap.GetFireDelay() + 0.3f); } else { Application.LoadLevel(2); } }
public void ComputeWeaponDamage(CShip target, CWeapon weapon) { //Shields first if (target.m_shipStats.shield > 0) { target.m_shipStats.shield -= weapon.m_weaponStats.m_shielDamage; if (target.m_shipStats.shield < 0) { target.m_shipStats.shield = 0; } } //if shields are off, shell can be damaged if (target.m_shipStats.shield <= 0 && target.m_shipStats.shell > 0) { target.m_shipStats.shell -= weapon.m_weaponStats.m_shellDamage; } target.CheckDestruction(); }
public void RemoveShip(CShip shipToRemove) { //Remove it from list }
// Ship creation in colony manager, definition of functions // in UIManager public void AddShip(CShip ship) { m_shipList.Add(ship); shipToGameObject.Add(ship, ship.m_shipGameObject); }
public ClientDeviceExterior IRCreateClientDeviceExterior(ClientDevice.InitData initData, CShip ship) { if (clientDevicesExterior.ContainsKey(initData.ODevice.GetType())) { return((ClientDeviceExterior)Activator.CreateInstance(clientDevicesExterior[initData.ODevice.GetType()], initData, ship)); } return(null); }
// Copy constructor - used in callbacks public CShipHlaObject(HlaObject _obj) : base(_obj) { // TODO: Instantiate local data here Ship = new CShip(); }
// Set the user's sprite. Takes no "types". public void SetUserSprite(ref CShip go) { go.renderer.material = userShip; }
public void render(Effect effect, CScene T, CShip S) { var device = D3DDevice.Instance.Device; int pos_en_ruta = S.pos_en_ruta; float dr = T.ancho_ruta; TGCVector3 Normal = T.Normal[pos_en_ruta]; TGCVector3 Binormal = T.Binormal[pos_en_ruta]; TGCVector3 Tangent = T.Tangent[pos_en_ruta]; int cant_tri = 0; int dataIdx = 0; int cant_bandas = 200; float M = 1000000.0f; for (int j = 0; j < cant_bandas; j++) { float ei = fft.coef(2 * j) / M; float y = 40 + ei * 1230; float x0 = 2 * dr * (float)j / (float)cant_bandas - dr - 5; float x1 = 2 * dr * (float)(j + 1) / (float)cant_bandas - dr + 5; TGCVector3 p0, p1, p2, p3; float dt = -20; p0 = S.posC - Binormal * x0 - Normal * 5 + Tangent * dt; p1 = S.posC - Binormal * x1 - Normal * 5 + Tangent * dt; p2 = p0 + Tangent * y; p3 = p1 + Tangent * y; vb_data[dataIdx++] = new CustomVertex.PositionNormalTextured(p0, Normal, 0, 0); vb_data[dataIdx++] = new CustomVertex.PositionNormalTextured(p1, Normal, 1, 0); vb_data[dataIdx++] = new CustomVertex.PositionNormalTextured(p2, Normal, 0, 1); vb_data[dataIdx++] = new CustomVertex.PositionNormalTextured(p1, Normal, 1, 0); vb_data[dataIdx++] = new CustomVertex.PositionNormalTextured(p2, Normal, 0, 1); vb_data[dataIdx++] = new CustomVertex.PositionNormalTextured(p3, Normal, 1, 1); cant_tri += 2; x0 = 2 * dr * (float)j / (float)cant_bandas - dr; x1 = 2 * dr * (float)(j + 1) / (float)cant_bandas - dr; p0 = S.posC - Binormal * x0 - Normal * 5 + Tangent * dt; p1 = S.posC - Binormal * x1 - Normal * 5 + Tangent * dt; p2 = p0 + Tangent * y; p3 = p1 + Tangent * y; vb_data[dataIdx++] = new CustomVertex.PositionNormalTextured(p0, Normal, 0, 0); vb_data[dataIdx++] = new CustomVertex.PositionNormalTextured(p1, Normal, 1, 0); vb_data[dataIdx++] = new CustomVertex.PositionNormalTextured(p2, Normal, 0, 1); vb_data[dataIdx++] = new CustomVertex.PositionNormalTextured(p1, Normal, 1, 0); vb_data[dataIdx++] = new CustomVertex.PositionNormalTextured(p2, Normal, 0, 1); vb_data[dataIdx++] = new CustomVertex.PositionNormalTextured(p3, Normal, 1, 1); cant_tri += 2; } vb.SetData(vb_data, 0, LockFlags.None); device.SetStreamSource(0, vb, 0); device.VertexFormat = CustomVertex.PositionNormalTextured.Format; effect.Technique = "GlowBar"; effect.SetValue("cube_color", TGCVector3.Vector3ToFloat4Array(new TGCVector3(1, 0.3f, 0.3f))); device.RenderState.AlphaBlendEnable = true; device.RenderState.ZBufferEnable = false; int numPasses = effect.Begin(0); for (var n = 0; n < numPasses; n++) { effect.BeginPass(n); device.DrawPrimitives(PrimitiveType.TriangleList, 0, cant_tri); effect.EndPass(); } effect.End(); device.RenderState.ZBufferEnable = true; }
public void ApplyEquipment(CShip ship) { //todo }
// ---------- public void ResetGame() { ship.ResetPosition(); CShip.SetLives(defaultLives); score = 0; }
public CShipHlaObject(HlaObjectClass _type) : base(_type) { // TODO: Instantiate local data here Ship = new CShip(); }