public void Init(XElement xml, HandleScript handle) { transform = handle.grenade.transform.Find((string)xml.Attribute("path") ?? "HandleTransform"); originalRotation = transform.localRotation; axis = GrenadesMod.ParseV3((string)xml.Attribute("axis") ?? "1,0,0") ?? Vector3.right; factor = (float?)xml.Attribute("factor") ?? 1f; }
internal void Init(XElement xml) { fuseTime = (float?)xml.Attribute("fuse") ?? 5f; XElement el = xml.Element("Explode"); if (el != null) { this.explosion = new ExplosionModule(); this.explosion.Init(el, this); } el = xml.Element("Handle"); if (el != null) { this.handle = gameObject.AddComponent <HandleScript>(); this.handle.Init(el, this); } el = xml.Element("Pin"); if (el != null) { var obj = this.transform.Find((string)el.Attribute("grip") ?? "PinGrip"); if (obj != null) { this.pin = obj.gameObject.AddComponent <PinScript>(); this.pin.Init(el, this); } } init = true; }