void Start() { controlsScript = transform.parent.gameObject.GetComponent<ControlsScript>(); myMoveSetScript = GetComponent<MoveSetScript>(); UpdateRenderer(); foreach(MoveInfo move in myMoveSetScript.moves){ foreach(InvincibleBodyParts invBodyPart in move.invincibleBodyParts){ List<HitBox> invHitBoxes = new List<HitBox>(); foreach(BodyPart bodyPart in invBodyPart.bodyParts){ foreach(HitBox hitBox in hitBoxes){ if (bodyPart == hitBox.bodyPart) { invHitBoxes.Add(hitBox); break; } } } invBodyPart.hitBoxes = invHitBoxes.ToArray(); } } }
void Start() { if (gameObject.name == "Player1") { transform.position = new Vector3(UFE.config.roundOptions.p1XPosition, .009f, 0); opponent = GameObject.Find("Player2"); if (UFE.config.player1Character == null) Debug.LogError("Player 1 character not found! Make sure you have set the characters correctly in the Global Editor"); myInfo = (CharacterInfo) Instantiate(UFE.config.player1Character); UFE.config.player1Character = myInfo; debugger = UFE.debugger1; mirror = -1; playerNum = 1; inputController = UFE.GetPlayer1Controller(); debugInfo = UFE.config.debugOptions.p1DebugInfo; }else{ transform.position = new Vector3(UFE.config.roundOptions.p2XPosition, .009f, 0); opponent = GameObject.Find("Player1"); if (UFE.config.player2Character == null) Debug.LogError("Player 2 character not found! Make sure you have set the characters correctly in the Global Editor"); myInfo = (CharacterInfo) Instantiate(UFE.config.player2Character); UFE.config.player2Character = myInfo; debugger = UFE.debugger2; mirror = 1; playerNum = 2; inputController = UFE.GetPlayer2Controller(); debugInfo = UFE.config.debugOptions.p2DebugInfo; } myInfo.currentLifePoints = (float)myInfo.lifePoints; if (myInfo.characterPrefab == null) Debug.LogError("Character prefab for "+ gameObject.name +" not found. Make sure you have selected a prefab character in the Character Editor"); character = (GameObject) Instantiate(myInfo.characterPrefab); character.transform.parent = transform; character.AddComponent<MoveSetScript>(); standardYRotation = character.transform.rotation.eulerAngles.y; myPhysicsScript = GetComponent<PhysicsScript>(); myMoveSetScript = character.GetComponent<MoveSetScript>(); myHitBoxesScript = character.GetComponent<HitBoxesScript>(); cameraScript = transform.parent.GetComponent<CameraScript>(); myHitBoxesScript.controlsScript = this; if (myInfo.headLook.enabled){ character.AddComponent<HeadLookScript>(); headLookScript = character.GetComponent<HeadLookScript>(); headLookScript.segments = myInfo.headLook.segments; headLookScript.nonAffectedJoints = myInfo.headLook.nonAffectedJoints; headLookScript.effect = myInfo.headLook.effect; headLookScript.overrideAnimation = !myInfo.headLook.overrideAnimation; foreach(BendingSegment segment in headLookScript.segments) { segment.firstTransform = myHitBoxesScript.GetTransform(segment.bodyPart).parent.transform; segment.lastTransform = myHitBoxesScript.GetTransform(segment.bodyPart); } foreach(NonAffectedJoints nonAffectedJoint in headLookScript.nonAffectedJoints) nonAffectedJoint.joint = myHitBoxesScript.GetTransform(nonAffectedJoint.bodyPart); } if (gameObject.name == "Player2") { testCharacterRotation(100, true); UFE.FireGameBegins(); } if (UFE.config.roundOptions.allowMovement) { UFE.config.lockMovements = false; }else{ UFE.config.lockMovements = true; } }
public void Start() { /*Plane groundPlane = (Plane) GameObject.FindObjectOfType(typeof(Plane)); if (groundPlane == null) Debug.LogError("Plane not found. Please add a plane mesh to your stage prefab!");*/ groundLayer = LayerMask.NameToLayer("Ground"); groundMask = 1 << groundLayer; myControlsScript = GetComponent<ControlsScript>(); character = myControlsScript.character; myHitBoxesScript = character.GetComponent<HitBoxesScript>(); myMoveSetScript = character.GetComponent<MoveSetScript>(); appliedGravity = myControlsScript.myInfo.physics.weight * UFE.config.gravity; }