//this is used to process the incomming data from the item public override void recieveNetworkData(CSteamID steamID, string[] dataSplit) { PlayerNetworkIndividualController playerNetworkIndividualController = GameReference.self.playerNetwork.getIndividualController(steamID); base.recieveNetworkData(steamID, dataSplit); if (dataSplit[1] == "InPlayerHand") { onEnterHandsNetwork(playerNetworkIndividualController); } else if (dataSplit[1] == "OutPlayerHand") { //print(rig.velocity); onExitHandsNetwork(playerNetworkIndividualController, false); transform.parent = null; transform.position = new Vector3(float.Parse(dataSplit[2]), float.Parse(dataSplit[3]), float.Parse(dataSplit[4])); transform.rotation = new Quaternion(float.Parse(dataSplit[5]), float.Parse(dataSplit[6]), float.Parse(dataSplit[7]), float.Parse(dataSplit[8])); rig.velocity = new Vector3(float.Parse(dataSplit[9]), float.Parse(dataSplit[10]), float.Parse(dataSplit[11])); rig.angularVelocity = new Vector3(float.Parse(dataSplit[12]), float.Parse(dataSplit[13]), float.Parse(dataSplit[14])); rig.isKinematic = false; } else if (dataSplit[1] == "Dropped") { onExitHandsNetwork(playerNetworkIndividualController, true); transform.parent = null; transform.position = new Vector3(float.Parse(dataSplit[2]), float.Parse(dataSplit[3]), float.Parse(dataSplit[4])); transform.rotation = new Quaternion(float.Parse(dataSplit[5]), float.Parse(dataSplit[6]), float.Parse(dataSplit[7]), float.Parse(dataSplit[8])); rig.velocity = new Vector3(float.Parse(dataSplit[9]), float.Parse(dataSplit[10]), float.Parse(dataSplit[11])); rig.angularVelocity = new Vector3(float.Parse(dataSplit[12]), float.Parse(dataSplit[13]), float.Parse(dataSplit[14])); rig.isKinematic = false; } else if (dataSplit[1] == "InInv") { onPutInContainerNetwork(Savable.findGameObjectByID((int)StringToFloat(dataSplit[2])).GetComponent <Container>(), playerNetworkIndividualController); } else if (dataSplit[1] == "OutInv") { onTakenOutOfContainerNetwork(); transform.position = new Vector3(float.Parse(dataSplit[2]), float.Parse(dataSplit[3]), float.Parse(dataSplit[4])); transform.rotation = new Quaternion(float.Parse(dataSplit[5]), float.Parse(dataSplit[6]), float.Parse(dataSplit[7]), float.Parse(dataSplit[8])); rig.velocity = new Vector3(float.Parse(dataSplit[9]), float.Parse(dataSplit[10]), float.Parse(dataSplit[11])); rig.angularVelocity = new Vector3(float.Parse(dataSplit[12]), float.Parse(dataSplit[13]), float.Parse(dataSplit[14])); } else if (dataSplit[1] == "Anim") { anim.SetBool(dataSplit[2], StringToBool(dataSplit[3])); } else if (dataSplit[1] == "InvRot") { rotatedItem = StringToBool(dataSplit[2]); } }
//sets the item's attributes once loaded from a text file public override void setAttributes(List <Attribute> attributes) { base.setAttributes(attributes); bool testHidden = false; foreach (Attribute attr in attributes) { if (attr.Key == "InvRot") { rotatedItem = StringToBool(attr.Value); //if (rotatedItem) { // Debug.Break(); // } } if (attr.Key == "Hidden") { testHidden = true; } if (attr.Key == "containerIn") { if (attr.Value != "-1") { // Debug.Log(attr.Value, gameObject); isWithinContainer = Savable.findGameObjectByID((int)StringToFloat(attr.Value)).GetComponent <Container>(); } } } if (testHidden) { hideFromWorld(); } else { showToWorld(); } }