Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        pauseMenu.SetActive(false);
        NextDoor.SetActive(false);
        LockedDoor.SetActive(false);

        CharBody = GetComponent <Rigidbody2D>();


        if (TORSOpiecesRight.Length == 0 || TORSOpiecesLeft.Length == 0 || TORSOpiecesUp.Length == 0 || TORSOpiecesDown.Length == 0)
        {
            Debug.LogError("Catastrophic failure; missing some TORSO sprites for character.");
        }
        if (LEGpiecesRight.Length == 0 || LEGpiecesLeft.Length == 0 || LEGpiecesUp.Length == 0 || LEGpiecesDown.Length == 0)
        {
            Debug.LogError("Catastrophic failure; missing some LEG sprites for character.");
        }

        Torso.sprite = TORSOpiecesDown[0];
        Legs.sprite  = LEGpiecesDown[0];
        SpriteUpdate = Time.time;
        DoorLock     = Time.time;
        IsInDoorway  = false;

        Health             = 100;
        Healthbar.maxValue = Health;

        AttackCooldown = Time.time;

        GameObject PlayerAoE = new GameObject("PlayerAoE");

        PlayerAoE.transform.SetParent(gameObject.transform);
        PlayerAoE.AddComponent <CircleCollider2D>();
        HurtCircle           = PlayerAoE.GetComponent <CircleCollider2D>();
        HurtCircle.radius    = 1.0f;
        HurtCircle.offset    = new Vector2(0.0f, -0.1f);
        HurtCircle.isTrigger = true;
        PlayerAoE.tag        = "AoE_Damage";
        HurtCircle.enabled   = false;
    }
Esempio n. 2
0
 private void OnGUI()
 {
     if (IsInDoorway)
     {
         GameObject temp = GameObject.Find("Enemy");
         if (temp == null)
         {
             if (!IsDoorLocked)
             {
                 NextDoor.SetActive(true);
             }
             else
             {
                 LockedDoor.SetActive(true);
             }
         }
     }
     else
     {
         NextDoor.SetActive(false);
         LockedDoor.SetActive(false);
     }
     Healthbar.value = Health;
 }