87 lines
3.1 KiB
C#
87 lines
3.1 KiB
C#
using System.Xml.Linq;
|
|
|
|
public class MinEventActionSetTransformActiveRebirth : MinEventActionBase
|
|
{
|
|
public override void Execute(MinEventParams _params)
|
|
{
|
|
//Log.Out("SetTransformActiveRebirth-Execute: Start");
|
|
Transform transform;
|
|
if (this.parent_transform.EqualsCaseInsensitive("#HeldItemRoot"))
|
|
{
|
|
//Log.Out("SetTransformActiveRebirth-Execute: 1");
|
|
transform = _params.Self.inventory.GetHoldingItemTransform();
|
|
}
|
|
else if (this.parent_transform != "")
|
|
{
|
|
//Log.Out("SetTransformActiveRebirth-Execute: 2");
|
|
transform = GameUtils.FindDeepChildActive(_params.Self.RootTransform, this.parent_transform);
|
|
}
|
|
else
|
|
{
|
|
//Log.Out("SetTransformActiveRebirth-Execute: 3");
|
|
transform = _params.Self.RootTransform;
|
|
}
|
|
if (transform == null)
|
|
{
|
|
//Log.Out("SetTransformActiveRebirth-Execute: 4");
|
|
return;
|
|
}
|
|
Transform transform2 = GameUtils.FindDeepChild(transform, this.transformPath);
|
|
if (transform2 == null)
|
|
{
|
|
//Log.Out("SetTransformActiveRebirth-Execute: 5");
|
|
return;
|
|
}
|
|
//Log.Out("SetTransformActiveRebirth-Execute: 6");
|
|
|
|
//Log.Out("localPosition.x: " + transform2.localPosition.x);
|
|
//Log.Out("localPosition.y: " + transform2.localPosition.y);
|
|
//Log.Out("localPosition.z: " + transform2.localPosition.z);
|
|
//Log.Out("localRotation.x: " + transform2.localRotation.x);
|
|
//Log.Out("localRotation.y: " + transform2.localRotation.y);
|
|
//Log.Out("localRotation.z: " + transform2.localRotation.z);
|
|
|
|
transform2.gameObject.SetActive(this.isActive);
|
|
|
|
LightManager.LightChanged(transform2.position + Origin.position);
|
|
}
|
|
|
|
public override bool CanExecute(MinEventTypes _eventType, MinEventParams _params)
|
|
{
|
|
//Log.Out("SetTransformActiveRebirth-CanExecute: Start");
|
|
return base.CanExecute(_eventType, _params) && _params.Self != null && _params.ItemValue != null && this.transformPath != null && this.transformPath != "";
|
|
}
|
|
|
|
public override bool ParseXmlAttribute(XAttribute _attribute)
|
|
{
|
|
bool flag = base.ParseXmlAttribute(_attribute);
|
|
if (!flag)
|
|
{
|
|
string name = _attribute.Name.LocalName;
|
|
if (name != null)
|
|
{
|
|
if (name == "active")
|
|
{
|
|
this.isActive = StringParsers.ParseBool(_attribute.Value, 0, -1, true);
|
|
return true;
|
|
}
|
|
if (name == "parent_transform")
|
|
{
|
|
this.parent_transform = _attribute.Value;
|
|
return true;
|
|
}
|
|
if (name == "transform_path")
|
|
{
|
|
this.transformPath = _attribute.Value;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return flag;
|
|
}
|
|
|
|
private string transformPath;
|
|
private string parent_transform = "";
|
|
private bool isActive;
|
|
}
|