示例#1
0
    public bool isActived = false;// playerController

    protected virtual void Start()
    {
        shield = Instantiate(shieldPrefab, transform.position, Quaternion.identity);
        shield.transform.SetParent(transform);
        shield.SetActive(false);

        visualBarRtrans = GameObject.FindGameObjectWithTag(visualBarTag).GetComponent <VisualBar>();
    }
    protected override void Start()
    {
        base.Start();
        ammunitionLeft = maxammunition;

        // get references
        magnetController = GetComponent<MagnetController>();
        animator = transform.Find("PlayerModel").GetComponent<Animator>();
        damageImage = GameObject.Find("DamageImage").GetComponent<Image>();
        enemyHealthBar = GameObject.Find("EnemyHealth").GetComponent<VisualBar>();
        ammunitionText = GameObject.Find("Ammunition").GetComponent<Text>();
        smokeController = GetComponent<SmokeController>();
        staminaController = GetComponent<StaminaController>();
        bombController = GetComponent<BombController>();

        ammunitionText.text = ammunitionLeft.ToString();
        enemyLayer = LayerMask.GetMask("Enemy");                                        // Get enemy mask
        orginalSpeed = horizontalMove;                                                  // remember orginal speed because some method can change it
        currentFuel = maxFuel;
        healthBar.UpdateBar(currentHealth, maxHealth);                                  // update healthBar
    }
    private VisualBar staminaBar;                           // reference to staminaBar that controll bar on screen


    void OnEnable()
    {
        currentStamina = maxStamina;                                                    // set current stamina value to max

        GameMaster.instance.staminaController = this;                                   // set in GameMaster reference to stamina Controller

        staminaBar = GameObject.FindWithTag("StaminaBar").GetComponent <VisualBar>();   // get reference to stamina bar that controlls bar on screen
        staminaBar.UpdateBar(currentStamina, maxStamina);                               // update this value on bar

        audioSource = staminaBar.gameObject.GetComponent <AudioSource>();               // get reference to audioSource in staminaBar object

        if (isIncreaseWithTime)                                                         // if IncreaseWithTime is On
        {
            StartCoroutine(IncreaseWithTime());                                         // Run coroutine that will increase stamina with time
        }
        if (isIncreaseWithKill)                                                         // if - because can be both option active Time and kill
        {
            GameMaster.instance.StaminaByKill = true;                                   // set in GameMaster bollen to true, because GameMaster will invoke method IncreaseWithKilling when player kill the enemy
        }
        ReadyToUse();                                                                   // invoke animation, sounds that shows that stamina is full
    }
 void AdjustVisualBars()                                                                          // Get references to GUI  bars after start game
 {
     healthBar = GameObject.Find(namePlayerHealth).GetComponent<VisualBar>();
     fuelBar = GameObject.Find(namePlayerFuel).GetComponent<VisualBar>();
 }
 void Start()
 {
     shieldBar = GameObject.Find("ShieldBar").GetComponent<VisualBar>();
     CreateShield();
     ActiveShield(2);
 }
示例#6
0
 void Awake()
 {
     shieldBar = GameObject.FindWithTag("ShieldBar").GetComponent <VisualBar>();
     CreateShield();
 }
 // Get references to GUI  bars after start game
 void AdjustVisualBars()
 {
     healthBar = GameObject.Find(namePlayerHealth).GetComponent<VisualBar>();
     fuelBar = GameObject.Find(namePlayerFuel).GetComponent<VisualBar>();
 }
 void Awake()
 {
     shieldBar = GameObject.FindWithTag("ShieldBar").GetComponent<VisualBar>();
     CreateShield();
 }
    void OnEnable()
    {
        currentStamina = maxStamina;                                                    // set current stamina value to max

        GameMaster.instance.staminaController = this;                                   // set in GameMaster reference to stamina Controller

        staminaBar = GameObject.FindWithTag("StaminaBar").GetComponent<VisualBar>();    // get reference to stamina bar that controlls bar on screen
        staminaBar.UpdateBar(currentStamina, maxStamina);                               // update this value on bar

        audioSource = staminaBar.gameObject.GetComponent<AudioSource>();                // get reference to audioSource in staminaBar object

        if (isIncreaseWithTime)                                                         // if IncreaseWithTime is On
            StartCoroutine(IncreaseWithTime());                                         // Run coroutine that will increase stamina with time

        if (isIncreaseWithKill)                                                         // if - because can be both option active Time and kill
            GameMaster.instance.StaminaByKill = true;                                   // set in GameMaster bollen to true, because GameMaster will invoke method IncreaseWithKilling when player kill the enemy

        ReadyToUse();                                                                   // invoke animation, sounds that shows that stamina is full
    }
    protected override void Start()
    {
        base.Start();
        ammunitionLeft = maxammunition;

        // get references
        magnetController = GetComponent<MagnetController>();
        animator = transform.FindChild("PlayerModel").GetComponent<Animator>();
        damageImage = GameObject.Find("DamageImage").GetComponent<Image>();
        enemyHealthBar = GameObject.Find("EnemyHealth").GetComponent<VisualBar>();
        ammunitionText = GameObject.Find("Ammunition").GetComponent<Text>();
        smokeController = GetComponent<SmokeController>();
        staminaController = GetComponent<StaminaController>();
        bombController = GetComponent<BombController>();

        ammunitionText.text = ammunitionLeft.ToString();
        enemyLayer = LayerMask.GetMask("Enemy");                                        // Get enemy mask
        orginalSpeed = horizontalMove;                                                  // remember orginal speed because some method can change it
        currentFuel = maxFuel;
        healthBar.UpdateBar(currentHealth, maxHealth);                                  // update healthBar
    }
示例#11
0
 void Start()
 {
     shieldBar = GameObject.Find("ShieldBar").GetComponent <VisualBar>();
     CreateShield();
     ActiveShield(2);
 }