public override void Check(CustomFlatRide RA) { foreach (RotateBetweenHP R in RA.motors.OfType<RotateBetweenHP>().ToList()) if (R.Identifier == identifierMotor) rotator = R; base.Check(RA); }
public static List <motor> LoadMotors(XmlNode ObjNode, GameObject GO, CustomFlatRide CFR) { List <motor> motors = new List <motor>(); foreach (XmlNode motorN in ObjNode.SelectSingleNode("Animation/motors").ChildNodes) { switch (motorN.Name) { case "Rotator": RotatorHP R = GO.AddComponent <RotatorHP>(); R.Identifier = motorN["Identifier"].InnerText; R.axisPath = motorN["axis"].InnerText; R.axis = GO.transform.FindChild(motorN["axis"].InnerText); R.maxSpeed = float.Parse(motorN["maxSpeed"].InnerText); R.accelerationSpeed = float.Parse(motorN["accelerationSpeed"].InnerText); R.rotationAxis = getVector3(motorN["rotationAxis"].InnerText); motors.Add(R); break; case "RotateBetween": RotateBetweenHP RB = GO.AddComponent <RotateBetweenHP>(); RB.Identifier = motorN["Identifier"].InnerText; RB.axisPath = motorN["axis"].InnerText; RB.axis = GO.transform.FindChild(motorN["axis"].InnerText); RB.rotationAxis = getVector3(motorN["rotationAxis"].InnerText); RB.duration = float.Parse(motorN["duration"].InnerText); motors.Add(RB); break; case "Mover": MoverHP M = GO.AddComponent <MoverHP>(); M.Identifier = motorN["Identifier"].InnerText; M.axisPath = motorN["axis"].InnerText; M.axis = GO.transform.FindChild(motorN["axis"].InnerText); M.toPosition = getVector3(motorN["toPosition"].InnerText); M.duration = float.Parse(motorN["duration"].InnerText); motors.Add(M); break; case "MultipleRotations": MultipleRotationsHP MR = GO.AddComponent <MultipleRotationsHP>(); MR.Identifier = motorN["Identifier"].InnerText; MR.axisPath = motorN["MainAxis"].InnerText; XmlNodeList axisNs = motorN.SelectNodes("axis"); foreach (XmlNode axisN in axisNs) { MR.AxissPath.Add(axisN.InnerText); } motors.Add(MR); break; } } return(motors); throw new NotImplementedException(); }
public override void Check(CustomFlatRide RA) { foreach (RotateBetweenHP R in RA.motors.OfType <RotateBetweenHP>().ToList()) { if (R.Identifier == identifierMotor) { rotator = R; } } base.Check(RA); }