コード例 #1
0
    private void OnSceneLoaded(Scene arg0, LoadSceneMode arg1)
    {
        var player = GameObject.FindGameObjectWithTag("Player");

        healthUi = player.GetComponentInChildren <HeartUI>();
        healthUi.UpdateHearts();

        var memoryGO = GameObject.FindGameObjectWithTag("memory");

        var memory = memoryGO.GetComponent <transitionMemory>();

        memory.fadeOut = true;
        var spawName = memory.nextDoor;
        var door     = GameObject.Find(spawName);

        if (spawName == "HubTeleport")
        {
            var go = GameObject.Find(spawName);
            transform.position = go.transform.position + Vector3.up * GetComponent <CapsuleCollider>().height / 2;
            healthSO.health    = healthSO.maxHealth;
            healthUi.UpdateHearts();
            return;
        }
        var spawnTransform = door.transform.GetChild(0);

        print(spawnTransform.position);
        transform.position = spawnTransform.transform.position + Vector3.up * GetComponent <CapsuleCollider>().height / 2;
    }
コード例 #2
0
ファイル: PlayerHealth.cs プロジェクト: aAlejandroz/Space_Lux
 protected override void OnDamaged(float damage)
 {
     if (!isInvincible)
     {
         audioSource.PlayOneShot(HurtSound);
         CurHP -= damage;
         HeartUI.UpdateHearts();
         GetComponent <SpriteRenderer>().color = new Color(1, 0.5f, 0.5f, 1);
         StartCoroutine(WaitAndChangeColor());
         StartCoroutine(setInvincibleAndWait());
     }
 }
コード例 #3
0
ファイル: PlayerHealth.cs プロジェクト: olcastan/Hundo
 protected override void OnDamaged(float damage)
 {
     if (!isInvincible)
     {
         audioSource.PlayOneShot(HurtSound);
         CurHP -= damage;
         HeartUI.UpdateHearts();
         StartCoroutine(setInvincibleAndWait());
     }
 }