public static FractionsReference Instance() { if (instance == null) { instance = new FractionsReference(); } return(instance); }
/// <summary> /// Unity Function. Called upon instantiation of this MonoBehaviour's game object. /// </summary> void Awake() { UnityEngine.Random.InitState(3216); validDenominators = new List <int> (); fractionReference = FractionsReference.Instance(); fractionReference.AddObserver(this.RequestValidDenominators); spriteRenderers = gameObject.GetComponentsInChildren <PartitionableSprite>(); this.objectCollider = gameObject.GetComponent <Collider2D> (); rigidBody2d = gameObject.GetComponent <Rigidbody2D> (); fractionLabel = gameObject.GetComponent <PartitionableObjectMarker> (); }
void Move() { elevatorTransform.localPosition = Vector2.MoveTowards(elevatorTransform.localPosition, positions [currentIndex].localPosition, speed * Time.deltaTime); if (elevatorTransform.localPosition == positions [currentIndex].localPosition) { if (isClosed) { elevator.OpenBars(); isClosed = false; } //spawn enemies if (!spawned) { spawned = true; enemySpawner.EnableSpawnPoints(currentIndex); FractionsReference.Instance().UpdateFractionsRange(); } // Debug.Log ("Arrived"); } }
void Awake() { UnityEngine.Random.InitState(3216); validDenominators = new List <int> (); fractionReference = FractionsReference.Instance(); fractionReference.AddObserver(this.RequestValidDenominators); // fractionReference.UpdateFractionRange (this.RequestValidDenominators); // animator = gameObject.GetComponent<Animator> (); spriteRenderers = gameObject.GetComponentsInChildren <PartitionableSprite>(); this.hintBubble = GetComponentInChildren <HintBubbleManager> (); // spriteRenderer.color = new Color (spriteRenderer.color.r, spriteRenderer.color.g, spriteRenderer.color.b, INTANGIBLE_OPACITY); // childrenSpriteRenderers = gameObject.GetComponentsInChildren<SpriteRenderer> (); this.objectCollider = gameObject.GetComponent <Collider2D> (); rigidBody2d = gameObject.GetComponent <Rigidbody2D> (); fractionLabel = gameObject.GetComponent <PartitionableObjectMarker> (); this.disabledTransparency(); // ChangeSpriteOpacity (INTANGIBLE_OPACITY); }
protected override void UpdateValidDenominators() { Debug.Log("Updated Denominators"); FractionsReference.Instance().UpdateValidDenominators(this.validDenominators); FractionsReference.Instance().UpdateFractionsRange(); }
private void OnSceneUnload(Scene scene) { FractionsReference.Instance().ClearEnemyDenominators(); }