void PickPiece(RobotPiece roboPiece) { if (playerPieces[0].owned == false && roboPiece.gameObject.transform.parent == null) { playerPieces[0].owned = true; playerPieces[0].piece = roboPiece.piece; leftItem = roboPiece; roboPiece.transform.parent = carryingPositions[1]; if (carryingPositions[1].GetChild(0) != null) { carryingPositions[1].GetChild(0).transform.localPosition = new Vector3(0, 0, 0); leftItem.gameObject.GetComponent <Part>().MakeNotKickable(); } roboPiece.transform.localPosition = new Vector3(0, 0, 0); } else if (playerPieces[1].owned == false && roboPiece.gameObject.transform.parent == null) { playerPieces[1].owned = true; playerPieces[1].piece = roboPiece.piece; rightItem = roboPiece;; roboPiece.transform.parent = carryingPositions[2]; roboPiece.transform.localPosition = new Vector3(0, 0, 0); if (carryingPositions[2].GetChild(0) != null) { carryingPositions[2].GetChild(0).transform.localPosition = new Vector3(0, 0, 0); rightItem.gameObject.GetComponent <Part>().MakeNotKickable(); } } }
public static Action <PlayerMovementResponsive> PlayerRemoved; // notifiy everyone that a player has been removed // Start is called before the first frame update void Start() { allPlayers.Add(this); PlayerAdded(this); for (int i = 0; i < 2; i++) { playerPieces[i] = new RobotPiece(); } //Cursor.lockState = CursorLockMode.Locked; }
/// <summary> /// Converts a DataRow into a RobotPiece Object. /// </summary> /// <param name="item">DataRow To convert into a RobotPiece.</param> /// <param name="pieceId"></param> /// <param name="materials"></param> /// <returns></returns> private static RobotPiece DataRowToRobotPiece(DataRow item, string pieceId, List <MaterialBucket> materials) { RobotPiece myPiece; int robotSerial = Convert.ToInt32(item["AssociatedRobot_serial"]); Enum.TryParse(item["PieceType"].ToString(), out EPieceType pieceType); Enum.TryParse(item["MetalType"].ToString(), out EMetalType metalType); Enum.TryParse(item["Material"].ToString(), out EMaterial eMaterial); myPiece = new RobotPiece(pieceType, metalType, eMaterial, materials); myPiece.AssociatedRobotSerial = robotSerial; myPiece.PieceID = pieceId; return(myPiece); }
private void OnTriggerExit(Collider other) { if (other.gameObject.tag == "Robot" || other.gameObject.tag == "RobotPiece") { robotInTrigger = null; //robotPieceInTrigger.highlight.SetActive(false); robotPieceInTrigger = null; } if (other.gameObject.tag == "Ground") { grounded = false; } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Robot")// || ) { robotInTrigger = other.gameObject.GetComponent <RoboInfo>(); } else if (other.gameObject.tag == "RobotPiece") { robotPieceInTrigger = other.gameObject.GetComponent <RobotPiece>(); // robotPieceInTrigger.highlight.SetActive(true); } if (other.gameObject.tag == "Ground") { grounded = true; } }
public void Test_01_List_Of_Materials_Of_The_Piece_Not_Null() { #region Arrange piece = new RobotPiece(); #endregion #region Act #endregion #region Assert Assert.IsNotNull(piece.RawMaterial); #endregion }
public void Test_03_Checks_Materials_Equals_30K() { #region Arrange piece = new RobotPiece(EPieceType.Head, EMetalType.ChromeDigizoid, EMaterial.Metal, materials); #endregion #region Act int amountMaterials = piece.AmountOfMaterials(); #endregion #region Assert Assert.AreEqual(30000, amountMaterials); #endregion }
public void Test_02_Checks_Materials_Equals_Zero() { #region Arrange piece = new RobotPiece(); #endregion #region Act int amountMaterials = piece.AmountOfMaterials(); #endregion #region Assert Assert.AreEqual(0, amountMaterials); #endregion }