- marsmission3_sprites_a.zip
- Atmosphere_Sun_00.SP3
- Atmosphere_Sun_01.SP3
- Atmosphere_Sun_02.SP3
- Atmosphere_Sun_03.SP3
- Atmosphere_Sun_04.SP3
- Atmosphere_Sun_05.SP3
- Atmosphere_Sun_06.SP3
- Atmosphere_Sun_07.SP3
- Atmosphere_Sun_08.SP3
- Atmosphere_Sun_09.SP3
- Atmosphere_Sun_10.SP3
- Atmosphere_Sun_11.SP3
- marsmission3_sprites_b.zip
- ASTRONAUT ARM.SP3
- ASTRONAUT FEMALE.SP3
- ATMOSPHERE_VENUS_00.SP3
- ATMOSPHERE_VENUS_01.SP3
- ATMOSPHERE_VENUS_02.SP3
- ATMOSPHERE_VENUS_03.SP3
- ATMOSPHERE_VENUS_04.SP3
- ATMOSPHERE_VENUS_05.SP3
- ATMOSPHERE_VENUS_06.SP3
- FIGHTER.SP3
- LANDING GEAR.SP3
- SHUTTLE.SP3
- marsmission3_sourcecode.zip
- Mars Mission
- marsmission3_bitmaps.zip
- Shrapnel_Fighter_0.bmp
- Shrapnel_Fighter_1.bmp
- Shrapnel_Fighter_2.bmp
- Shrapnel_Fighter_3.bmp
- Shrapnel_Fighter_4.bmp
- Shrapnel_Shuttle_0.bmp
- Shrapnel_Shuttle_1.bmp
- Shrapnel_Shuttle_2.bmp
- Shrapnel_Shuttle_3.bmp
- Shrapnel_Shuttle_4.bmp
- Shrapnel_Shuttle_5.bmp
- Shrapnel_Shuttle_6.bmp
- Shrapnel_standard_0.bmp
- Shrapnel_standard_1.bmp
- Shrapnel_standard_2.bmp
- SO_Amalthea.bmp
- SO_ariel.bmp
- SO_Atlas.bmp
- SO_Callisto.bmp
- SO_Charon.bmp
- SO_default_0.bmp
- SO_default_1.bmp
- SO_Deimos.bmp
- SO_Earth.bmp
- SO_Enceladus.bmp
- SO_Epimetheus.bmp
- SO_Europa.bmp
- SO_ganymede.bmp
- SO_Hyperion.bmp
- SO_Iapetus.bmp
- SO_Io.bmp
- SO_Janus.bmp
- SO_Jupiter.bmp
- SO_Larissa.bmp
- SO_Luna.bmp
- SO_mars.bmp
- SO_mercury.bmp
- SO_mimas.bmp
- SO_Miranda.bmp
- SO_Neptune.bmp
- SO_Oberon.bmp
- SO_Pandora.bmp
- SO_Phobos.bmp
- SO_Phoebe.bmp
- SO_Pluto.bmp
- SO_Prometheus.bmp
- SO_Proteus.bmp
- SO_Rhea.bmp
- SO_Saturn.bmp
- SO_SolarShadow.bmp
- SO_Sun.bmp
- SO_Telesto.bmp
- SO_tethys.bmp
- SO_Titan.bmp
- SO_Titania.bmp
- SO_Triton.bmp
- SO_Umbriel.bmp
- SO_Uranus.bmp
- SO_Venus.bmp
- Structure_Base.bmp
- Structure_Terran_Base.bmp
- StructureInterior_test.bmp
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;
using System.IO;
using System.Xml;
namespace Mars_Mission
{
public class dgvAstronauts : DataGridView
{
public classAstronaut[] cAstronauts;
public enuSortBy eSortByLast = enuSortBy.Name;
public dgvAstronauts()
{
CellClick += new DataGridViewCellEventHandler(dgvAstronauts_CellClick);
System.Windows.Forms.DataGridViewTextBoxColumn colDetail = new System.Windows.Forms.DataGridViewTextBoxColumn();
System.Windows.Forms.DataGridViewTextBoxColumn colAction = new System.Windows.Forms.DataGridViewTextBoxColumn();
System.Windows.Forms.DataGridViewTextBoxColumn colResources = new System.Windows.Forms.DataGridViewTextBoxColumn();
System.Windows.Forms.DataGridViewTextBoxColumn colProficiency_Geologist_Rating = new System.Windows.Forms.DataGridViewTextBoxColumn();
System.Windows.Forms.DataGridViewTextBoxColumn colProficiency_Geologist_Experience = new System.Windows.Forms.DataGridViewTextBoxColumn();
System.Windows.Forms.DataGridViewTextBoxColumn colProficiency_Chemist_Rating = new System.Windows.Forms.DataGridViewTextBoxColumn();
System.Windows.Forms.DataGridViewTextBoxColumn colProficiency_Chemist_Experience = new System.Windows.Forms.DataGridViewTextBoxColumn();
System.Windows.Forms.DataGridViewTextBoxColumn colProficiency_Engineering_Rating = new System.Windows.Forms.DataGridViewTextBoxColumn();
System.Windows.Forms.DataGridViewTextBoxColumn colProficiency_Engineering_Experience = new System.Windows.Forms.DataGridViewTextBoxColumn();
System.Windows.Forms.DataGridViewTextBoxColumn colProficiency_Pilot_Rating = new System.Windows.Forms.DataGridViewTextBoxColumn();
System.Windows.Forms.DataGridViewTextBoxColumn colProficiency_Pilot_Experience = new System.Windows.Forms.DataGridViewTextBoxColumn();
System.Windows.Forms.DataGridViewTextBoxColumn colName = new System.Windows.Forms.DataGridViewTextBoxColumn();
//
// colDetail
//
colDetail.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
colDetail.FillWeight = 5F;
colDetail.HeaderText = "?";
colDetail.MinimumWidth = 20;
colDetail.Name = "colDetail";
colDetail.ReadOnly = true;
colDetail.ToolTipText = "Show Details";
colDetail.Width = 20;
//
// colAction
//
colAction.FillWeight = 129.7547F;
colAction.HeaderText = "Action";
colAction.Name = "colAction";
colAction.ReadOnly = true;
//
// colResources
//
colResources.FillWeight = 129.7547F;
colResources.HeaderText = "Resources";
colResources.Name = "colResources";
colResources.ReadOnly = true;
//
// colProficiency_Geologist_Rating
//
colProficiency_Geologist_Rating.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
colProficiency_Geologist_Rating.FillWeight = 5F;
colProficiency_Geologist_Rating.HeaderText = "G";
colProficiency_Geologist_Rating.MinimumWidth = 20;
colProficiency_Geologist_Rating.Name = "colProficiency_Geologist_Rating";
colProficiency_Geologist_Rating.ReadOnly = true;
colProficiency_Geologist_Rating.ToolTipText = "Geology Proficiency";
colProficiency_Geologist_Rating.Width = 20;
//
// colProficiency_Geologist_Experience
//
colProficiency_Geologist_Experience.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
colProficiency_Geologist_Experience.FillWeight = 5F;
colProficiency_Geologist_Experience.HeaderText = "G";
colProficiency_Geologist_Experience.MinimumWidth = 20;
colProficiency_Geologist_Experience.Name = "colProficiency_Geologist_Experience";
colProficiency_Geologist_Experience.ReadOnly = true;
colProficiency_Geologist_Experience.ToolTipText = "Geology experience";
colProficiency_Geologist_Experience.Width = 20;
//
// colProficiency_Chemist_Rating
//
colProficiency_Chemist_Rating.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
colProficiency_Chemist_Rating.FillWeight = 5F;
colProficiency_Chemist_Rating.HeaderText = "C";
colProficiency_Chemist_Rating.MinimumWidth = 20;
colProficiency_Chemist_Rating.Name = "colProficiency_Chemist_Rating";
colProficiency_Chemist_Rating.ReadOnly = true;
colProficiency_Chemist_Rating.ToolTipText = "Chemistry Proficiency";
colProficiency_Chemist_Rating.Width = 20;
//
// colProficiency_Chemist_Experience
//
colProficiency_Chemist_Experience.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
colProficiency_Chemist_Experience.FillWeight = 5F;
colProficiency_Chemist_Experience.HeaderText = "C";
colProficiency_Chemist_Experience.MinimumWidth = 20;
colProficiency_Chemist_Experience.Name = "colProficiency_Chemist_Experience";
colProficiency_Chemist_Experience.ReadOnly = true;
colProficiency_Chemist_Experience.ToolTipText = "Chemistry experience";
colProficiency_Chemist_Experience.Width = 20;
//
// colProficiency_Engineering_Rating
//
colProficiency_Engineering_Rating.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
colProficiency_Engineering_Rating.FillWeight = 5F;
colProficiency_Engineering_Rating.HeaderText = "E";
colProficiency_Engineering_Rating.MinimumWidth = 20;
colProficiency_Engineering_Rating.Name = "colProficiency_Engineering_Rating";
colProficiency_Engineering_Rating.ReadOnly = true;
colProficiency_Engineering_Rating.ToolTipText = "Engineering Proficiency";
colProficiency_Engineering_Rating.Width = 20;
//
// colProficiency_Engineering_Experience
//
colProficiency_Engineering_Experience.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
colProficiency_Engineering_Experience.FillWeight = 5F;
colProficiency_Engineering_Experience.HeaderText = "E";
colProficiency_Engineering_Experience.MinimumWidth = 20;
colProficiency_Engineering_Experience.Name = "colProficiency_Engineering_Experience";
colProficiency_Engineering_Experience.ReadOnly = true;
colProficiency_Engineering_Experience.ToolTipText = "Engineering experience";
colProficiency_Engineering_Experience.Width = 20;
//
// colProficiency_Pilot_Rating
//
colProficiency_Pilot_Rating.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
colProficiency_Pilot_Rating.FillWeight = 5F;
colProficiency_Pilot_Rating.HeaderText = "P";
colProficiency_Pilot_Rating.MinimumWidth = 20;
colProficiency_Pilot_Rating.Name = "colProficiency_Pilot_Rating";
colProficiency_Pilot_Rating.ReadOnly = true;
colProficiency_Pilot_Rating.ToolTipText = "Piloting Proficiency";
colProficiency_Pilot_Rating.Width = 20;
//
// colProficiency_Pilot_Experience
//
colProficiency_Pilot_Experience.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
colProficiency_Pilot_Experience.FillWeight = 5F;
colProficiency_Pilot_Experience.HeaderText = "P";
colProficiency_Pilot_Experience.MinimumWidth = 20;
colProficiency_Pilot_Experience.Name = "colProficiency_Pilot_Experience";
colProficiency_Pilot_Experience.ReadOnly = true;
colProficiency_Pilot_Experience.ToolTipText = "Piloting experience";
colProficiency_Pilot_Experience.Width = 20;
//
// colName
//
colName.FillWeight = 38.9264F;
colName.HeaderText = "Name";
colName.MinimumWidth = 100;
colName.Name = "colName";
colName.ReadOnly = true;
//
// dgvCrew
//
AllowUserToAddRows = false;
AllowUserToDeleteRows = false;
AllowUserToResizeColumns = false;
AllowUserToResizeRows = false;
AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
Dock = System.Windows.Forms.DockStyle.Fill;
EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
Location = new System.Drawing.Point(3, 3);
MultiSelect = false;
Name = "dgvCrew";
ReadOnly = true;
RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
RowHeadersVisible = false;
RowHeadersWidth = 5;
ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
Size = new System.Drawing.Size(495, 277);
TabIndex = 0;
}
public void Populate(ref classAstronaut[] Astronauts)
{
Rows.Clear();
cAstronauts = Astronauts;
for (int intAstronautCounter = 0; intAstronautCounter < cAstronauts.Length; intAstronautCounter++)
{
classAstronaut cThisAstronaut = cAstronauts[intAstronautCounter];
string[] strAstronautDetails = {
cThisAstronaut.Name,
cThisAstronaut.RatingPilot.ToString("d2"),
cThisAstronaut.RatingEngineer.ToString("d2"),
cThisAstronaut.RatingChemist.ToString("d2"),
cThisAstronaut.RatingGeologist.ToString("d2"),
"resources",
"activities",
"?"
};
Rows.Add(strAstronautDetails);
}
SortBy();
}
void SortBy() { SortBy(eSortByLast); }
void SortBy(enuSortBy eSortBy)
{
Sort(Columns[(int)eSortBy], System.ComponentModel.ListSortDirection.Ascending);
eSortByLast = eSortBy;
}
void dgvAstronauts_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex < 0)
{ // clicking column header
if (e.ColumnIndex >= 0)
{
}
}
else if (e.ColumnIndex < 0)
{ // clicking row header
}
else
{
for (int intAstronautCounter = 0; intAstronautCounter < cAstronauts.Length; intAstronautCounter++)
{
string strNameSelectedAstronaut = Rows[e.RowIndex].Cells[0].Value.ToString();
if (cAstronauts[intAstronautCounter].Name == strNameSelectedAstronaut)
{
classAstronaut cAstronautSelected = classAstronaut.getAstronautByName(strNameSelectedAstronaut);
enuDGVCrew_Columns eDGVCrewColumn = (enuDGVCrew_Columns)e.ColumnIndex;
switch (eDGVCrewColumn)
{
case enuDGVCrew_Columns.activities:
break;
case enuDGVCrew_Columns.details:
MessageBox.Show("show astronaut details : " + cAstronautSelected.Name);
break;
case enuDGVCrew_Columns.name :
classGameState.cControlAstronaut_Next = cAstronautSelected;
break;
}
}
}
}
}
}
public class classAstronautProficiency
{
public int intRating;
public int intExperience;
public void addExperience(int intExperienceGain)
{
intExperience += intExperienceGain;
while (intExperience > 100)
{
intExperience -= 100;
intRating += 1;
if (intRating > 100)
intRating = 100;
}
}
public XmlNode getSaveGameNode(ref XmlDocument xDoc, string strTypeProficiency)
{
XmlNode xRetVal = xDoc.CreateElement(classSaveGame.conXmlField_Astronaut_Proficiency);
XmlNode xRating = xDoc.CreateElement(classSaveGame.conXmlField_Astronaut_Proficiency_Rating);
xRating.InnerText = intRating.ToString();
xRetVal.AppendChild(xRating);
XmlNode xExperience = xDoc.CreateElement(classSaveGame.conXmlField_Astronaut_Proficiency_Experience);
xExperience.InnerText = intExperience.ToString();
xRetVal.AppendChild(xExperience);
XmlAttribute xAtt_Type = xDoc.CreateAttribute(classSaveGame.conXmlAttribute_AstronautProficiencyType);
xAtt_Type.Value = strTypeProficiency;
xRetVal.Attributes.Append(xAtt_Type);
return xRetVal;
}
static public classAstronautProficiency fromXmlNode(ref XmlNode xNode)
{
classAstronautProficiency cRetVal = new classAstronautProficiency();
XmlNode xRating = xNode.FirstChild;
XmlNode xExperience = xRating.NextSibling;
cRetVal.intRating = Convert.ToInt16(xRating.InnerText);
cRetVal.intExperience = Convert.ToInt16(xExperience.InnerText);
return cRetVal;
}
}
public class classAstronaut
{
static public classAstronaut[] cAstronauts = new classAstronaut[0];
static int intUniqueID = 0;
public int intMyIndex;
public classAstronautProficiency[] cProficiencies = new classAstronautProficiency[4];
public Sprite.classSpriteComposite cSprCom;
public static Sprite.classSpriteMaker sprMaker = new Sprite.classSpriteMaker();
public classBase Base;
public classShip Ship;
public classCollisionDetectionObject cCDO = new classCollisionDetectionObject();
public classObjectContainer cObjContainer;
public classAction cAction = classAction.cActions[0];
public TreeNode tNode = new TreeNode();
public TreeNode tNode_Resources = new TreeNode();
classAstronaut cMyReference;
public classAstronaut() /// DEBUGHERE -> make this private when not debugging formStructureInteriorEditor
{
cMyReference = this;
object objMyObjectReference = (object)cMyReference;
cObjContainer = new classObjectContainer(ref objMyObjectReference, enuTypeObject.Astronaut);
// define collision size relative to fighter ship > sized relative to shuttle > sized relative to landscapewidth
cCDO.radius = .43* classShip.getRadius(enuShipModels.fighter);
cCDO.cCDP.cRadPoly = new classMath.classRadialCoor[3];
cCDO.cCDP.cRadPoly[0] = new classMath.classRadialCoor(0, 17);
cCDO.cCDP.cRadPoly[1] = new classMath.classRadialCoor(-.8 * Math.PI, 12);
cCDO.cCDP.cRadPoly[2] = new classMath.classRadialCoor(.8 * Math.PI, 12);
cCDO.cCDP.OrderPolygon();
cCDO.cCDP.eMirror = Sprite.enuMirror.none;
intMyIndex = intUniqueID++;
Name = "Astronaut #" + intMyIndex.ToString();
cCDO.eLoc =enuLocation.Base;
Array.Resize<classAstronaut>(ref cAstronauts, cAstronauts.Length + 1);
cAstronauts[cAstronauts.Length - 1] = this;
tNode.Text = Name; tNode.ForeColor = formMarsMission.clrNodeDull;
tNode.Nodes.Add(tNode_Resources); tNode_Resources.Text = "Resources"; tNode_Resources.ForeColor = formMarsMission.clrNodeDull;
for (enuAstronautProficiencies eAstronautProficiencyCounter = (enuAstronautProficiencies)0; eAstronautProficiencyCounter < (enuAstronautProficiencies)4; eAstronautProficiencyCounter++)
cProficiencies[(int)eAstronautProficiencyCounter] = new classAstronautProficiency();
cCDO.eTypeObject = enuTypeObject.Astronaut;
cCDO.cIAmAstronaut = this;
Sprite.classSprite cSprAstronaut = sprMaker.loadSprite(classRotatedImage.strWorkingDirectory + "astronaut female.sp3");
cSprCom = new Sprite.classSpriteComposite(ref cSprAstronaut);
Sprite.classSprite cSprArm = sprMaker.loadSprite(classRotatedImage.strWorkingDirectory + "astronaut arm.sp3");
int intIndexShoulder = cSprAstronaut.getIndexOfLimbByName("Shoulder near");
cSprCom.cMaster.addSlave(ref cSprArm, intIndexShoulder, 1.0);
}
public XmlNode getSaveGameNode(ref XmlDocument xDoc)
{
XmlNode xRetVal = xDoc.CreateElement(classSaveGame.conXmlField_Astronaut);
XmlNode xName = xDoc.CreateElement(classSaveGame.conXmlField_Astronaut_Name);
xName.InnerText = Name;
xRetVal.AppendChild(xName);
XmlNode xProficiencyArray = xDoc.CreateElement(classSaveGame.conXmlField_Astronaut_ProficiencyArray);
for (enuAstronautProficiencies eProficiencyCounter = (enuAstronautProficiencies)0; eProficiencyCounter < enuAstronautProficiencies._numAstronautProficiencies; eProficiencyCounter++)
{
XmlNode xProficiency = cProficiencies[(int)eProficiencyCounter].getSaveGameNode(ref xDoc, eProficiencyCounter.ToString());
xProficiencyArray.AppendChild(xProficiency);
}
xRetVal.AppendChild(xProficiencyArray);
XmlNode xCCDO = cCDO.getSaveGameNode(ref xDoc);
xRetVal.AppendChild(xCCDO);
XmlNode xObjCon = cObjContainer.getSaveGameNode(ref xDoc);
xRetVal.AppendChild(xObjCon);
return xRetVal;
}
public static classAstronaut fromXmlNode(ref XmlNode xNode)
{
classAstronaut cRetVal = new classAstronaut();
XmlNode xName = xNode.FirstChild;
cRetVal.Name = xName.InnerText;
XmlNode xProficiencyArray = xName.NextSibling;
for (int intProficiencyCounter = 0; intProficiencyCounter < xProficiencyArray.ChildNodes.Count; intProficiencyCounter++)
{
XmlNode xProficiency = xProficiencyArray.ChildNodes[intProficiencyCounter];
cRetVal.cProficiencies[intProficiencyCounter] = classAstronautProficiency.fromXmlNode(ref xProficiency);
}
XmlNode xCDO = xProficiencyArray.NextSibling;
cRetVal.cCDO = classCollisionDetectionObject.fromXmlNode(ref xCDO);
cRetVal.cCDO.cIAmAstronaut = cRetVal;
cRetVal.cCDO.eTypeObject = enuTypeObject.Astronaut;
XmlNode xObjContainer = xCDO.NextSibling;
object objAstronautReference = (object)cRetVal;
cRetVal.cObjContainer = classObjectContainer.fromXmlNode(ref xObjContainer, ref objAstronautReference, enuTypeObject.Astronaut);
return cRetVal;
}
public static classAstronaut CreateAstronaut()
{
classAstronaut cNewAstronaut = new classAstronaut();
return cNewAstronaut;
}
public void Kill()
{
for (int intAstronautCounter = 0; intAstronautCounter < cAstronauts.Length; intAstronautCounter++)
if (cAstronauts[intAstronautCounter] == this)
{
cAstronauts[intAstronautCounter] = cAstronauts[cAstronauts.Length - 1];
Array.Resize<classAstronaut>(ref cAstronauts, cAstronauts.Length - 1);
if (Ship != null)
RemoveFromShip();
if (Base != null)
RemoveFromBase();
return;
}
}
public static void clear()
{
cAstronauts = new classAstronaut[0];
}
string _Name;
public string Name
{
get { return _Name; }
set
{
_Name = value;
tNode.Text = _Name;
}
}
public int RatingPilot
{
get { return cProficiencies[(int)enuAstronautProficiencies.pilot].intRating; }
set { cProficiencies[(int)enuAstronautProficiencies.pilot].intRating = value; }
}
public int RatingEngineer
{
get { return cProficiencies[(int)enuAstronautProficiencies.engineer].intRating; }
set { cProficiencies[(int)enuAstronautProficiencies.engineer].intRating = value; }
}
public int RatingGeologist
{
get { return cProficiencies[(int)enuAstronautProficiencies.geologist].intRating; }
set { cProficiencies[(int)enuAstronautProficiencies.geologist].intRating = value; }
}
public int RatingChemist
{
get { return cProficiencies[(int)enuAstronautProficiencies.chemist].intRating; }
set { cProficiencies[(int)enuAstronautProficiencies.chemist].intRating = value; }
}
/// <summary>
/// get returns this astronaut's piloting experience. set adds experience to current total
/// </summary>
public int ExperiencePilot
{
get { return cProficiencies[(int)enuAstronautProficiencies.pilot].intExperience; }
set { cProficiencies[(int)enuAstronautProficiencies.pilot].addExperience(value); }
}
/// <summary>
/// get returns this astronaut's engineering experience. set adds experience to current total
/// </summary>
public int ExperienceEngineer
{
get { return cProficiencies[(int)enuAstronautProficiencies.engineer].intExperience; }
set { cProficiencies[(int)enuAstronautProficiencies.engineer].addExperience(value); }
}
/// <summary>
/// get returns this astronaut's Geology experience. set adds experience to current total
/// </summary>
public int ExperienceGeologist
{
get { return cProficiencies[(int)enuAstronautProficiencies.geologist].intExperience; }
set { cProficiencies[(int)enuAstronautProficiencies.geologist].addExperience(value); }
}
/// <summary>
/// get returns this astronaut's Chemistry experience. set adds experience to current total
/// </summary>
public int ExperienceChemist
{
get { return cProficiencies[(int)enuAstronautProficiencies.chemist].intExperience; }
set { cProficiencies[(int)enuAstronautProficiencies.chemist].addExperience ( value); }
}
public void RemoveFromBase()
{
if (Base == null)
MessageBox.Show("error : Remove Astronaut From -> Astronaut's Base == null");
Base.cObjContainer.removeAstronaut(ref cMyReference);
for (int intAstronautNodeCounter = 0; intAstronautNodeCounter < Base.tNode_Astronauts.Nodes.Count; intAstronautNodeCounter++)
{
if (Base.tNode_Astronauts.Nodes[intAstronautNodeCounter] == tNode)
{
Base.tNode_Astronauts.Nodes.Remove(tNode);
break;
}
}
Base = null;
}
public void AddToBase(ref classBase cBase)
{
cBase.cObjContainer.addAstronaut(ref cMyReference);
cBase.tNode_Astronauts.Nodes.Add(tNode);
cCDO.eLoc = enuLocation.Base;
cCDO.cSolarObject = cBase.cCDO.cSolarObject;
Base = cBase;
}
public void RemoveFromShip()
{
if (Ship == null)
MessageBox.Show("error : Remove Astronaut From -> Astronaut's Ship == null");
Ship.cObjContainer.removeAstronaut(ref cMyReference);
for (int intAstronautNodeCounter = 0; intAstronautNodeCounter < Ship.tNode_Astronauts.Nodes.Count; intAstronautNodeCounter++)
{
if (Ship.tNode_Astronauts.Nodes[intAstronautNodeCounter] == tNode)
{
Ship.tNode_Astronauts.Nodes.Remove(tNode);
break;
}
}
Ship = null;
}
public void AddToShip(ref classShip cShip)
{
cShip.cObjContainer.addAstronaut(ref cMyReference);
cShip.tNode_Astronauts.Nodes.Add(tNode);
cCDO.eLoc = enuLocation.Ship;
cCDO.cSolarObject = cShip.cCDO.cSolarObject;
Ship = cShip;
}
public void Disembark()
{
switch (cCDO.eLoc)
{
case enuLocation.Ship:
RemoveFromShip();
if (Ship.cCDO.eLoc == enuLocation.Base)
{
AddToBase(ref Ship.cBase);
}
else
{
MessageBox.Show("Astronaut Disembark -> but ship's eLoc NOT Base");
}
break;
default:
MessageBox.Show("Astronaut Disembark -> but eLoc NOT Ship");
break;
}
}
public void BoardShip()
{
switch (cCDO.eLoc)
{
case enuLocation.Base:
if (Base.cObjContainer.cShips.Length == 1)
BoardShip(ref Base.cObjContainer.cShips[0]);
else if (Base.cObjContainer.cShips.Length == 0)
MessageBox.Show("Astronaut BoardShip() -> there is NO SHIP");
else if (Base.cObjContainer.cShips.Length > 1)
MessageBox.Show("Astronaut BoardShip() -> there are MORE THAN 1 SHIP");
break;
default:
MessageBox.Show("Astronaut BoardShip() -> eLoc NOT Base");
break;
}
}
public void BoardShip(ref classShip cShip)
{
switch (cCDO.eLoc)
{
case enuLocation.Base:
RemoveFromBase();
AddToShip(ref cShip);
break;
default:
MessageBox.Show("Astronaut BoardShip(ref cShip) -> eLoc NOT Base");
break;
}
}
public void Die()
{
switch (cCDO.eLoc)
{
case enuLocation.Base:
RemoveFromBase();
break;
case enuLocation.Ship:
RemoveFromShip();
break;
case enuLocation.Surface:
break;
}
for (int intAstronautCounter = 0; intAstronautCounter < cAstronauts.Length; intAstronautCounter++)
{
if (cAstronauts[intAstronautCounter] == this)
{
cAstronauts[intAstronautCounter] = cAstronauts[cAstronauts.Length - 1];
Array.Resize<classAstronaut>(ref cAstronauts, cAstronauts.Length - 1);
return;
}
}
}
public static classAstronaut getAstronautByName(string strName)
{
for (int intAstronautCounter = 0; intAstronautCounter < cAstronauts.Length && cAstronauts[intAstronautCounter] != null; intAstronautCounter++)
if (cAstronauts[intAstronautCounter].Name == strName)
{
return cAstronauts[intAstronautCounter];
}
return null;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Christ Kennedy grew up in the suburbs of Montreal and is a bilingual Quebecois with a bachelor’s degree in computer engineering from McGill University. He is unemployable and currently living in Moncton, N.B. writing his next novel.