void killPlayer()
    {
        if (this.GetComponent <PlayerAnimate> ().enabled == true)
        {
            PlayerAnimate  pa  = this.GetComponent <PlayerAnimate> ();
            PlayerMovement pm  = this.GetComponent <PlayerMovement> ();
            RotateToCursor rot = this.GetComponent <RotateToCursor> ();
            WeaponAttack   wa  = this.GetComponent <WeaponAttack> ();
            legDir         ld  = this.GetComponentInChildren <legDir> ();
            wa.dropWeapon();
            pa.legs.sprite  = null;
            pa.legs.enabled = false;
            ld.enabled      = false;

            pa.torso.sprite = deadSpr;
            pa.enabled      = false;

            rot.enabled = false;
            wa.enabled  = false;

            pm.enabled = false;
            CircleCollider2D col = this.GetComponent <CircleCollider2D> ();
            col.enabled = false;
        }
    }
Example #2
0
    void revivePlayer()
    {
        dead = false;

        Debug.Log("PlayerHealth - revivePlayer");

        PlayerAnimate  pa  = this.GetComponent <PlayerAnimate> ();
        PlayerMovement pm  = this.GetComponent <PlayerMovement> ();
        RotateToCursor rot = this.GetComponent <RotateToCursor> ();
        WeaponAttack   wa  = this.GetComponent <WeaponAttack> ();

        dead = false;
        legDir ld = this.GetComponentInChildren <legDir> ();

        wa.dropWeapon();
        pa.legs.enabled = true;
        ld.enabled      = true;
        pa.enabled      = true;
        rot.enabled     = true;
        wa.enabled      = true;
        pm.enabled      = true;
        CircleCollider2D col = this.GetComponent <CircleCollider2D> ();

        col.enabled = true;
    }
Example #3
0
    void Start()
    {
        HUD_health         = GameObject.Find("Health").GetComponent <Text>();
        hungerSlider       = GameObject.Find("HungerSlider").GetComponent <Slider>();
        thirstSlider       = GameObject.Find("ThirstSlider").GetComponent <Slider>();
        shelterSlider      = GameObject.Find("ShelterSlider").GetComponent <Slider>();
        checklistButton    = GameObject.Find("ChecklistButton").GetComponent <Button>();
        foodButton         = GameObject.Find("UseFood").GetComponent <Button>();
        waterButton        = GameObject.Find("UseWater").GetComponent <Button>();
        medkitButton       = GameObject.Find("UseMedkit").GetComponent <Button>();
        playerDays         = GameObject.Find("Days").GetComponent <Text>();
        playerTime         = GameObject.Find("Time").GetComponent <Text>();
        playerTimeCycle    = GameObject.Find("cycle").GetComponent <Text>();
        inventoryList      = GameObject.Find("Inventory").GetComponent <Text>();
        invFoodText        = GameObject.Find("FoodItems").GetComponent <Text>();
        invWaterText       = GameObject.Find("WaterItems").GetComponent <Text>();
        invMedkitText      = GameObject.Find("MedkitItems").GetComponent <Text>();
        invWoodText        = GameObject.Find("WoodItems").GetComponent <Text>();
        checkList          = GameObject.Find("Checklist").GetComponent <Text>();
        days               = GameObject.Find("Days").GetComponent <Text>();
        foodCheck          = checkList.transform.Find("GetFood").GetComponent <Text>();
        waterCheck         = checkList.transform.Find("GetWater").GetComponent <Text>();
        fireCheck          = checkList.transform.Find("GetFire").GetComponent <Text>();
        woodCheck          = checkList.transform.Find("GetWood").GetComponent <Text>();
        completeObjectives = GameObject.Find("CompletedObjectives").GetComponent <Text>();
        infoNote           = GameObject.Find("Note").GetComponent <Text>();
        tutorial           = GameObject.Find("Tutorial");
        tutText            = GameObject.Find("Speach").GetComponent <Text>();
        GO_PC              = GameObject.Find("Player");
        GO_Flashlight      = GameObject.Find("Flashlight");
        GO_Map             = GameObject.Find("Map");
        GO_Death           = GameObject.Find("GameOver");
        pm = GameObject.Find("Player").GetComponent <PlayerMovement>();
        rc = GameObject.Find("Player").GetComponent <RotateToCursor>();

        UpdatePCStats();
        StartTutorial();
    }
Example #4
0
 public void InstantiateComponents()
 {
     weaponController = GetComponentInParent <RotateToCursor>();
     rootObject       = GetComponentInParent <PlayerMovement>();
     combatController = GetComponentInParent <PlayerCombat>();
 }
Example #5
0
    // SYSTEM //

    void Start()
    {
        GetComponentInChildren <AudioListener>().enabled = true;
        PlayerInput    playerInput    = gameObject.AddComponent(typeof(PlayerInput)) as PlayerInput;
        RotateToCursor rotateToCursor = gameObject.AddComponent(typeof(RotateToCursor)) as RotateToCursor;
    }