public void OnStart() { if (animator == null || animator != GameObjectAnimatorCollectionConverter.getAnimator(leverAnimator)) animator = GameObjectAnimatorCollectionConverter.getAnimator(leverAnimator); if (sound == null) sound = LeverSoundDataCollectionConverter.getData(soundData); }
public static IGameObjectAnimation getInstance() { if (instance == null) instance = new PositionGameObjectAnimator(); return instance; }
void Start() { leverName = CLang.getInstance().get(idName); leverCaption = CLang.getInstance().get(idCaption); audioSource = gameObject.GetComponent<AudioSource>(); if (audioSource == null) audioSource = gameObject.AddComponent<AudioSource>(); Rigidbody body = gameObject.GetComponent<Rigidbody>(); if (body == null) body = gameObject.AddComponent<Rigidbody>(); body.useGravity = false; body.isKinematic = true; BoxCollider boxCollider = gameObject.GetComponent<BoxCollider>(); if (boxCollider == null) boxCollider = gameObject.AddComponent<BoxCollider>(); animator = GameObjectAnimatorCollectionConverter.getAnimator(leverAnimator); sound = LeverSoundDataCollectionConverter.getData(soundData); }