Pages 1
Universal Fighting Engine Forum Due to increased bot activity, we have discontinued support through the forum. For assistance, questions, and community discussions, please join our official Discord server |
You are not logged in. Please login or register.
Universal Fighting Engine Forum → General → Enable/Disable weapons in Combat Stances
Sure thing. I'll edit my post when I can.
using System.Collections.Generic;
using UFE3D;
using UnityEngine;
public class NewBehaviourScript1 : MonoBehaviour
{
private ControlsScript controlsScript;
[System.Serializable]
public class Options
{
public CombatStances[] combatStances;
public GameObject[] disableGameObjects;
public GameObject[] enableGameObjects;
}
public Options[] options;
private void Start()
{
controlsScript = GetComponentInParent<ControlsScript>();
}
private void Update()
{
if (controlsScript != null)
{
for (int i = 0; i < options.Length; i++)
{
for (int j = 0; j < options[i].combatStances.Length; j++)
{
if (controlsScript.MoveSet.currentCombatStance == options[i].combatStances[j])
{
SetGameObjectActive(options[i].disableGameObjects, false);
SetGameObjectActive(options[i].enableGameObjects, true);
}
}
}
}
}
#region GameObject Methods
public static void SetGameObjectActive(GameObject[] gameObject, bool active)
{
if (gameObject == null)
{
return;
}
int length = gameObject.Length;
for (int i = 0; i < length; i++)
{
var item = gameObject[i];
if (item == null)
{
continue;
}
item.SetActive(active);
}
}
public static void SetGameObjectActive(List<GameObject> gameObject, bool active)
{
if (gameObject == null)
{
return;
}
int count = gameObject.Count;
for (int i = 0; i < count; i++)
{
var item = gameObject[i];
if (item == null)
{
continue;
}
item.SetActive(active);
}
}
#endregion
}
Hi @FreedTerror. I want to ask you if this script could be extended by Body Parts Visibility Changes. In Enabled objects for specific Stance for a specific Move add an exception. So that the object is invisible for certain Move in Enabled game objects for selected Stance. thank you
You want to enable and disable objects based on what stance and what move the character is doing?
I can add that sometime.
Universal Fighting Engine Forum → General → Enable/Disable weapons in Combat Stances
Powered by PunBB, supported by Informer Technologies, Inc.