// On scene load, do this... void Start() { leftArmNode = transform.Find(leftArmNodeName).GetComponent<PickupNode>(); rightArmNode = transform.Find(rightArmNodeName).GetComponent<PickupNode>(); leftArmNode.setPosition(transform.Find(leftArmNodeName)); rightArmNode.setPosition(transform.Find(rightArmNodeName)); leftArmPosition = "North"; rightArmPosition = "North"; float old_ly = leftArmNode.getTransform().localPosition.y; leftArmNode.getTransform().localPosition = new Vector3(-0.3f, old_ly, 1.0f); float old_ry = rightArmNode.getTransform().localPosition.y; rightArmNode.getTransform().localPosition = new Vector3(0.3f, old_ry, 1.0f); animate = GetComponent<Animator>(); itemManager = GetComponent<PlayerItemManager> (); animate.SetBool("LF", LF); animate.SetBool("RF", RF); // NOTE: // "Node Position" is really only the coordinates of game objects called // "Left Arm Node", "Right Arm Node" and such. The Nodes themselves are a part // of this own manager's abstract class. // // In other words, no properties are ever allocated to those node objects in the // game space. They are only the points at which }
// On scene load, do this... void Start() { leftArmNode = transform.Find(leftArmNodeName).GetComponent <PickupNode>(); rightArmNode = transform.Find(rightArmNodeName).GetComponent <PickupNode>(); leftArmNode.setPosition(transform.Find(leftArmNodeName)); rightArmNode.setPosition(transform.Find(rightArmNodeName)); leftArmPosition = "North"; rightArmPosition = "North"; float old_ly = leftArmNode.getTransform().localPosition.y; leftArmNode.getTransform().localPosition = new Vector3(-0.3f, old_ly, 1.0f); float old_ry = rightArmNode.getTransform().localPosition.y; rightArmNode.getTransform().localPosition = new Vector3(0.3f, old_ry, 1.0f); animate = GetComponent <Animator>(); itemManager = GetComponent <PlayerItemManager> (); animate.SetBool("LF", LF); animate.SetBool("RF", RF); // NOTE: // "Node Position" is really only the coordinates of game objects called // "Left Arm Node", "Right Arm Node" and such. The Nodes themselves are a part // of this own manager's abstract class. // // In other words, no properties are ever allocated to those node objects in the // game space. They are only the points at which }
void AppendItem(GameObject otherObject, PickupNode nodeToAppendTo) { // disable pickup's rigid body to give it that ephemeral feel // also make it kinematic to disable effective forces // also make it unpickupable otherObject.GetComponent <Rigidbody>().detectCollisions = false; otherObject.GetComponent <Rigidbody>().isKinematic = true; otherObject.GetComponent <PickupProperties>().makePickupable(false); // append object to player node, make it a child of that node otherObject.transform.parent = nodeToAppendTo.transform; otherObject.transform.position = nodeToAppendTo.transform.position; // obtain pickup's properties ArrayList pickupProperties = otherObject.GetComponent <PickupProperties>().GetProperties(); nodeToAppendTo.updateProps(pickupProperties); // add the object to the node, this also updates the node's attack and defense and such nodeToAppendTo.updateItems(otherObject.GetComponent <PickupProperties>()); //if (otherObject.transform.GetComponentInParent<PickupNode>() != null) { // print(otherObject.transform.GetComponentInParent<PickupNode>().getNodeAtk()); // foreach (var elemen in pickupProperties) { // print (elemen); // } //} AudioSource.PlayClipAtPoint(pickup_sound, nodeToAppendTo.getTransform().position); nodeToAppendTo.printMe(); }
void AppendItem(GameObject otherObject, PickupNode nodeToAppendTo) { // disable pickup's rigid body to give it that ephemeral feel // also make it kinematic to disable effective forces // also make it unpickupable otherObject.GetComponent<Rigidbody>().detectCollisions = false; otherObject.GetComponent<Rigidbody>().isKinematic = true; otherObject.GetComponent<PickupProperties>().makePickupable(false); // append object to player node, make it a child of that node otherObject.transform.parent = nodeToAppendTo.transform; otherObject.transform.position = nodeToAppendTo.transform.position; // obtain pickup's properties ArrayList pickupProperties = otherObject.GetComponent<PickupProperties>().GetProperties(); nodeToAppendTo.updateProps(pickupProperties); // add the object to the node, this also updates the node's attack and defense and such nodeToAppendTo.updateItems(otherObject.GetComponent<PickupProperties>()); //if (otherObject.transform.GetComponentInParent<PickupNode>() != null) { // print(otherObject.transform.GetComponentInParent<PickupNode>().getNodeAtk()); // foreach (var elemen in pickupProperties) { // print (elemen); // } //} AudioSource.PlayClipAtPoint(pickup_sound, nodeToAppendTo.getTransform().position); nodeToAppendTo.printMe(); }