plantilla base para movimiento básico
This commit is contained in:
Robii Aragon
2026-02-05 05:07:55 -08:00
parent ed7b223c04
commit fd87a6ffd5
14441 changed files with 13711084 additions and 20 deletions

View File

@@ -0,0 +1,71 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class setGameObjectActiveState : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool setInitialState;
public bool initialState;
[Space]
[Header ("Debug")]
[Space]
public bool objectActive;
[Space]
[Header ("Components")]
[Space]
public GameObject objectToActive;
void Start ()
{
if (objectToActive == null) {
objectToActive = gameObject;
}
if (objectToActive.activeSelf) {
objectActive = true;
}
if (setInitialState) {
setActiveState (initialState);
}
}
public void changeActiveState ()
{
objectActive = !objectActive;
setActiveState (objectActive);
}
public void setActiveState (bool state)
{
objectActive = state;
if (objectToActive.activeSelf != state) {
objectToActive.SetActive (state);
}
}
public void changeActiveStateFromEditor ()
{
changeActiveState ();
updateComponent ();
}
void updateComponent ()
{
GKC_Utils.updateComponent (this);
GKC_Utils.updateDirtyScene ("Update Set GameObject Active State " + gameObject.name, gameObject);
}
}