Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections.Generic;
- using AC;
- [RequireComponent(typeof(ActionList))]
- public class AssetParameters : MonoBehaviour {
- public List<ActionParameter> parameters = new List<ActionParameter>();
- public void Start()
- {
- ApplyValues();
- }
- public void ApplyValues()
- {
- var actionList = this.GetComponent<ActionList>();
- if (actionList.parameters.Count != this.parameters.Count)
- throw new System.Exception("Number of parameters does not match ActionList.");
- for (int i = 0; i < actionList.parameters.Count && i < this.parameters.Count; i++)
- actionList.parameters[i].CopyValues(this.parameters[i]);
- }
- [ExecuteInEditMode]
- public void SetParametersNumber(int num)
- {
- if (num < 0)
- throw new System.Exception("Parameters number can't be less than zero.");
- if (this.parameters == null)
- this.parameters = new List<ActionParameter>();
- while (this.parameters.Count < num)
- this.parameters.Add(new ActionParameter(-1));
- while (this.parameters.Count > num)
- this.parameters.RemoveAt(this.parameters.Count - 1);
- }
- }
- public static class Utils {
- public static GameObject GetObjectByID (ConstantID id)
- {
- if (id == null)
- return null;
- var res = Serializer.returnComponent<Transform>(id.constantID).gameObject;
- return res;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement