public void ShapeAdd(AreaWorldModMagicValueType shape) { Vector3 pos = UnityEngine.Random.onUnitSphere * 0.2f; AreaWorldModMagicValue mod = new AreaWorldModMagicValue(); mod.position = pos; mod.rotation = Quaternion.identity; mod.myType = shape; switch (shape) { case AreaWorldModMagicValueType.Sphere: mod.SetValuesAsSphere(0.5f); break; case AreaWorldModMagicValueType.Capsule: mod.SetValuesAsCapsule(0.5f, 2f); break; case AreaWorldModMagicValueType.Cuboid: mod.SetValuesAsCuboid(0.5f, 0.5f, 0.5f); break; } mod.id = allMods.Count; mod.container = this; mod.SetDirty(); allMods.Add(mod); RecalculateBounds(); }
public AreaWorldModMagicValue Copy() { AreaWorldModMagicValue result = new AreaWorldModMagicValue(); result.name = name; //result.mode = mode; result.myType = myType; result.position = position; result.rotation = rotation; result.bounds = bounds; result.value1 = value1; result.value2 = value2; result.value3 = value3; return(result); }
public void ShapeCopyAt(int index) { if (index <0 | index> allMods.Count - 1) { return; } AreaWorldModMagicValue copy = allMods[index].Copy(); copy.container = this; copy.SetDirty(); allMods.Insert(index, copy); CheckDirty(); ReassignIndexes(); }
public void ShapeIncreaseValueID(int index) { if (index <0 | index> allMods.Count - 2) { return; } AreaWorldModMagicValue a = allMods[index]; AreaWorldModMagicValue b = allMods[index + 1]; allMods[index + 1] = a; allMods[index] = b; allMods[index + 1].id = index + 1; allMods[index].id = index; }