void Start() { heart1 = transform.FindChild("Heart1").GetComponent<HeartController>(); heart2 = transform.FindChild("Heart2").GetComponent<HeartController>(); heart3 = transform.FindChild("Heart3").GetComponent<HeartController>(); setHP(3); }
private IEnumerator bestowHeart(PlayerController winner) { Debug.Assert(PrincessCard != null); Debug.Assert(HeartPrefab != null); // Flip the Princess' card, if not yet flipped PrincessCard.FlipUp(); // Spawn a new heart under the Princess' heart GameObject heart = Instantiate(Resources.Load("Prefabs/Heart", typeof(GameObject))) as GameObject; heart.name = "Heart"; heart.transform.position = PrincessCard.transform.position; heart.GetComponent <SpriteRenderer>().sortingOrder = TotalHeartCount++; // Set the heart to move towards a random spot in the winner's heart container HeartController hc = heart.GetComponent <HeartController>(); hc.transform.SetParent(winner.HeartContainer.transform); hc.TargetPosition = UnityEngine.Random.insideUnitCircle * 1.5f; yield return(new WaitUntil(() => (hc.hasStopped))); Debug.LogFormat("{0} received a heart from the Princess, congratulations!", winner); winner.HeartCount += 1; // The winner of the current round goes first in the next for (int i = 0; i < Players.Length; i++) { if (Players[i] == winner) { CurrentPlayer = i; break; } } CurrentStage = STAGE_END; }
void Start() { heart1 = transform.FindChild("Heart1").GetComponent <HeartController>(); heart2 = transform.FindChild("Heart2").GetComponent <HeartController>(); heart3 = transform.FindChild("Heart3").GetComponent <HeartController>(); setHP(3); }
private void Start() { player = Instantiate(playerObj).GetComponent <HeartController>(); levelManager = LevelManager.Instance; //Instantiate(background); LoadLevel(); }
// --- END Plyer Stats --- // dungeonFloors = DungeonGenerator.generateFloors(random parameters, 3) public void transitionToDungeonScene() { dungeonController.generateDungeon(maxHealth + items.Count); SceneManager.LoadScene(2); hearts = FindObjectOfType <HeartController>(); inDungeon = true; }
//void Start () void Init() { gameState = GameState.Init; _heartController = GameObject.FindObjectOfType <HeartController>(); InitPopups(); sourceEffect = GameObject.Find("Audio Source Effects").GetComponent <SoundManager>(); sourceMusic = GameObject.Find("Audio Source Music").GetComponent <SoundManagerMusic>(); }
void MarkHeartsForCheck() { for (int i = 0; i < nrHearts; i++) { HeartController heartController = hearts [i].GetComponent <HeartController> (); heartController.shouldBeConsideredDiscovered = true; } }
public HeartBeatViewPage() { InitializeComponent(); #region For HeartAdapter Test IHeartModel heartModel = new HeartModel(); IBeatModel beatModel = new HeartAdapter(heartModel); IDJController btmController = new DJController(djView, beatModel); IBeatController heartController = new HeartController(beatView, beatModel); #endregion }
public HeartController AddNewHeart() { var newObject = Instantiate <GameObject>(_heartPrefab); newObject.transform.SetParent(transform); newObject.transform.localPosition = Vector3.zero; _gridController.AddObject(newObject); var heartController = newObject.GetComponent <HeartController>(); _hearts.Add(heartController); if (_currentHeart != null) { _currentHeart.SetPulsing(false); } _currentHeart = heartController; _currentHeart.SetPulsing(true); return(heartController); }
void CountNrVisibleHearts() { for (int i = 0; i < nrHearts; i++) { CircleCollider2D heartCollider = hearts [i].GetComponent <CircleCollider2D> (); if (heartCollider) { HeartController heartController = hearts [i].GetComponent <HeartController> (); if (!heartController.wasDiscovered && heartController.nrOverlayedItems == 0 || !heartController.wasDiscovered && heartController.shouldBeConsideredDiscovered) { // heart is visible nrVisibleHearts++; heartCollider.isTrigger = false; heartController.wasDiscovered = true; hearts[i].GetComponent <Animator>().SetTrigger("wasDiscovered"); heartController.shouldBeConsideredDiscovered = false; print("se descubrio el corazon " + i); } } } }
void Start() { _instance = this; Health = GameController._instance.GetHealth(); }
public static void Run() { HeartModel heartModel = new HeartModel(); IController controller = new HeartController(heartModel); }
// Update is called once per frame void FixedUpdate() { if (standby) { // waiting for input (allow user input) ResetTimer(); // print ("in standby"); if (!usingKinect && GameObject.Find("TUIOHand") != null) { // start game standby = false; isPlaying = true; // user is allowed to move items print("game started"); } else if (usingKinect) { KinectManager kinectManager = KinectManager.Instance; if (kinectManager && kinectManager.IsInitialized()) { // print("kinnect manager is initialized"); if (kinectManager.IsUserDetected()) { // print ("user was detected"); uint userId = kinectManager.GetPlayer1ID(); trackJoint(kinectManager, userId, iTrackedJoint, rightHandObject); trackJoint(kinectManager, userId, iLeftHandJoint, leftHandObject); standby = false; isPlaying = true; // user is allowed to move items print("game started"); } } } else { // print ("waiting for user"); } } else { // user is interacting with kinect or tuio if (isPlaying) { if (Input.GetKeyDown(KeyCode.A)) { UnityEngine.Debug.Log("nr items above each heart:"); for (int i = 0; i < nrHearts; i++) { HeartController heartController = hearts [i].GetComponent <HeartController> (); UnityEngine.Debug.Log(heartController.nrOverlayedItems); } print("nr corazones descubiertos" + nrVisibleHearts); } // check game over if (timeLeft <= 0) { gameOver = true; } else { // check if player won // print("mainController: antes de contar corazones"); CountNrVisibleHearts(); MarkHeartsForCheck(); // print("mainController: despues de setear corazones a true"); if (nrVisibleHearts == nrHearts) { won = true; } UpdateTimer(); } isPlaying = !gameOver && !won; // print ("is playing: " + isPlaying); if (!isPlaying) { // take picture with gopro if (takePicture) { // Process process = Process.Start (processInfo); } UnityEngine.Debug.Log("retorno de la toma de foto"); // do not allow collision between hands and items anymore Physics2D.IgnoreLayerCollision(playerLayer, itemsLayer); // playAgainBtn.SetActive(true); if (won) { winMessage.SetActive(true); // print ("gano"); } else { loseMessage.SetActive(true); // print ("perdio"); } StartCoroutine(RestartGameCoroutine()); } } else { // user is not allowed to move items anymore but can still click on playAgainBtn // print ("waiting for user to press play again button"); } // update player's hands if (usingKinect) { KinectManager kinectManager = KinectManager.Instance; if (kinectManager && kinectManager.IsInitialized()) { // print("kinnect manager is initialized"); if (kinectManager.IsUserDetected()) { // print ("user was detected"); uint userId = kinectManager.GetPlayer1ID(); trackJoint(kinectManager, userId, iTrackedJoint, rightHandObject); trackJoint(kinectManager, userId, iLeftHandJoint, leftHandObject); } } } } }
void Awake() { instance = this; }
public void SceneLoaded(Scene scene, LoadSceneMode mode) { hearts = FindObjectOfType <HeartController>(true); CoinageText = FindObjectOfType <CoinTextController>(true); }
void Start() { anim = GetComponent <Animator>(); mover = GetComponent <PlayerMovement>(); hearts = GameObject.FindGameObjectWithTag("Hearts").GetComponent <HeartController>(); }
private List <GameObject> hearts; // The hearts on screen void Awake() { instance = this; hearts = new List <GameObject>(); }