/// <summary> /// Funzione che esegue il setup /// </summary> public virtual void Setup() { spawnPosition = transform.position; collider.enabled = true; isSetupped = true; OnObjectSpawn?.Invoke(this); }
/// <summary> /// Spawns a gameobject. /// </summary> /// <param name="pos">The position to spawn the gameobject.</param> /// <param name="rot">The rotation to spawn the gameobject.</param> /// <returns>The spawned gameobject.</returns> public GameObject Spawn(Vector3 pos, Quaternion rot) { GameObject com = null; if (DespawnedElements.Count != 0) { while (com == null && DespawnedElements.Count > 0) { com = DespawnedElements.Dequeue(); } if (com == null) { com = Instantiate(); } } else { com = Instantiate(); } com.transform.position = pos; com.transform.transform.rotation = rot; ActiveObject.Add(com); com.gameObject.SetActive(true); if (OnObjectSpawn != null) { OnObjectSpawn.Invoke(com, this); } return(com); }
public void Setup(ShapeScriptable _shape, Camera _cam) { shape = _shape; spriteMask = GetComponent <SpriteMask>(); spriteRenderer = GetComponent <SpriteRenderer>(); spriteRenderer.sprite = shape.guessShapeSprite; bound = _cam.GetOrthographicBounds(); OnObjectSpawn?.Invoke(this); isToGuess = true; isSetupped = true; }
/// <summary> /// Funzione che esegue il Setup /// </summary> /// <param name="_groupCtrl"></param> public void Setup(GroupController _groupCtrl) { groupCtrl = _groupCtrl; movementCtrl.Setup(); agentDistanceCtrl.Setup(); agentGravityCtrl.Setup(groupCtrl); graphicCtrl.Setup(groupCtrl); agentGroupCtrl.Setup(groupCtrl); OnObjectSpawn?.Invoke(this); }