Exemple #1
0
    IEnumerator Fire()
    {
        Player.Script.bullets--;
        BulletUI.RemoveBullet();
        ShootBullets();
        GetComponent <AudioSource>().PlayOneShot(Resources.Load <AudioClip>("Sounds/Shoot"));

        transform.localPosition -= transform.TransformDirection(new Vector3(0, 0.3f, 0));
        int tick = 0;

        while (Vector3.Distance(transform.localPosition, new Vector3(origPos.x, origPos.y, transform.localPosition.z)) > 0.001f)
        {
            while (Forest.Paused)
            {
                yield return(null);
            }
            transform.localPosition = Vector3.MoveTowards(transform.localPosition, new Vector3(origPos.x, origPos.y, transform.localPosition.z), 0.00875f);

            tick++;
            if (tick > 100)
            {
                break;
            }
            yield return(new WaitForEndOfFrame());
        }
        yield return(new WaitForEndOfFrame());

        doneShooting = true;
    }
Exemple #2
0
    private void Awake()
    {
        currentBulletCount = GameManager.Instance.getStageBulletLimit();

        viewCamera = Camera.main;

        bulletUI = GameObject.FindGameObjectWithTag("BulletUI").GetComponent <BulletUI>();
        ResetbulletUI();
    }
    //弾丸のUI表示。
    public void DisplayBulletUI(BulletInfo info)
    {
        //非アクティブなUIを取得。
        BulletUI ui = _UIList.Find((a) => a.gameObject.activeSelf == false);

        ui.gameObject.SetActive(true);

        //一番後ろに回す。
        ui.transform.SetAsLastSibling();
        ui.bulletInfo = info;
    }
Exemple #4
0
    void Start()
    {
        Broom = transform.Find("Broom").gameObject;
        Gun   = transform.Find("Gun").gameObject;

        Script = this;

        HealthScript.SetMax(healthMax);
        BulletUI.AddBullets(bullets);
        animator = transform.Find("Sprite").GetComponent <SpriteAnimator>();
        animator.SetSpeed(10);
    }
Exemple #5
0
    protected override void Awake()
    {
        base.Awake();
        healthInfo        = GameObject.FindObjectOfType <HealthUI>();
        ammoInfo          = GameObject.FindObjectOfType <BulletUI>();
        activeItemInfo    = GameObject.FindObjectOfType <ActiveItemUI>();
        notificationPanel = GameObject.FindObjectOfType <NotificationUI>();
        deathPanel        = GameObject.FindObjectOfType <DeathPanel>();

        notificationPanel.gameObject.SetActive(false);
        EventManager.Instance.OnNotifyChange        += SendNotification;
        EventManager.Instance.onAmmoChange          += updateAmmoUI;
        EventManager.Instance.onHealthTrigger       += updatehealthUI;
        EventManager.Instance.onMaxHealthTrigger    += updateMaxHealthUI;
        EventManager.Instance.onItemPickupTrigger   += updateActiveItemPickupUI;
        EventManager.Instance.onItemActivateTrigger += updateActiveItemUseUI;
    }
Exemple #6
0
	public void AddBullet(Bullet.Type type, int quantity) {
		// Check if this type already exist on list
		int count = listBullets.Count;
		for (int i = 0; i < count; i++) {
			if (listBullets[i].bulletType == type) {
				// rePosition it
				currentBullet = listBullets[i];
				currentBullet.Init(type, quantity);
				
				return;
			}
		}
	
		currentBullet = NGUITools.AddChild(bottomLeft, prefabBulletUI).GetComponent<BulletUI>();
		currentBullet.transform.localPosition = new Vector3(30.0f + (count * (60.0f + 15.0f)), 30.0f, 0.0f);
		currentBullet.Init(type, quantity);
		listBullets.Add(currentBullet);
	}
Exemple #7
0
    IEnumerator Die()
    {
        dead = true;
        Forest.Sound.PlayOneShot(Resources.Load <AudioClip>("Sounds/dieSound"));
        yield return(StartCoroutine(LevelManager.Fogger.FogScreen()));

        if (TotemScript.activatedTotems < 4)
        {
            transform.position = GameObject.Find("RespawnPoint").transform.position;
        }
        else
        {
            transform.position = totemSpawn;
        }



        dead = false;
        SetHealth(healthMax);

        BulletUI.SetBullets(10);
        bullets = 10;

        Forest.Sound.PlayOneShot(Resources.Load <AudioClip>("Sounds/fogFadeAway"));
        yield return(StartCoroutine(LevelManager.Fogger.ShowScreen()));

        if (TotemScript.activatedTotems < 4 && TotemScript.activatedTotems != 3)
        {
            HelpText.Say("That hurt. Welp. I still have " + (4 - TotemScript.activatedTotems).ToString() + " totems to go.");
        }
        else if (TotemScript.activatedTotems == 3)
        {
            HelpText.Say("That hurt. Welp, just one totem left to go.");
        }
        else
        {
            HelpText.Say("Poop. I just need to get to the Enlightener, and it'll kill all of those monsters.");
        }


        yield break;
    }
Exemple #8
0
    public void PickupItem(GameObject item)
    {
        if (item.GetComponent <ItemScript>().type == Item.Type.Bullet && bullets < 20)
        {
            bullets++;
            BulletUI.AddBullets(1);
            nearbyItems[0].SendMessage("Pickup");
        }

        if (item.GetComponent <ItemScript>().type == Item.Type.Medkit && health < healthMax)
        {
            float newHealth = health + 20;

            if (newHealth > healthMax)
            {
                newHealth = healthMax;
            }

            SetHealth(newHealth);
            nearbyItems[0].SendMessage("Pickup");
        }
    }
Exemple #9
0
 void Awake()
 {
     instance = this;
 }
Exemple #10
0
	public void SetCurrentBullet(BulletUI bulletUI) {
		currentBullet = bulletUI;
	}