Ejemplo n.º 1
0
    void Awake()
    {
        proximityDetector = transform.GetComponent <ProximityDetector>();
        fov         = transform.GetComponent <FieldOfView>();
        status      = transform.GetComponent <Health>();
        frustration = transform.GetComponent <FrustrationComponent>();

        playerGun        = GameObject.Find("GunControls").GetComponent <GunControls>();
        previousPosition = transform.position;
        previousRotation = transform.eulerAngles.z;
    }
Ejemplo n.º 2
0
    private void Awake()
    {
        healthBar          = GameObject.Find("PlayerHealthBar").GetComponent <Slider>();
        gunControls        = GameObject.Find("GunControls").GetComponent <GunControls>();
        HPbarSize          = GameObject.Find("PlayerHealthBar").GetComponent <RectTransform>();
        player             = GameObject.Find("PlayerController").transform;
        HPbarPosition      = healthBar.transform.position.x;
        bombIndicatorWidth = HPbarSize.sizeDelta.x / gunControls.startingBombs + 20.5f;

        for (int i = 0; i < gunControls.startingBombs; i++)
        {
            GameObject newProjectileIndicator = Instantiate(bombIndicator, Vector3.zero, Quaternion.identity) as GameObject;
            newProjectileIndicator.GetComponent <RectTransform>().sizeDelta  = new Vector2(bombIndicatorWidth, HPbarSize.sizeDelta.y);
            newProjectileIndicator.GetComponent <RectTransform>().localScale = HPbarSize.localScale;
            newProjectileIndicator.transform.SetParent(gameObject.transform, false);
        }

        bombIndicators = GameObject.FindGameObjectsWithTag("bomb-indicator");
    }