public void UseAbility(int ability)
    {
        Vector2 direction = ((player.transform.position + player.GetDirection() * Random.Range(0, 2)) - rotator.position).normalized;
        float   angle     = 0;

        switch (ability)
        {
        case 0:
            angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
            rotator.eulerAngles = Vector3.forward * angle;
            LavaBulletCone bullets = Instantiate(bulletPattern, shootPoint.position, shootPoint.rotation).GetComponent <LavaBulletCone>();
            break;

        case 1:
            for (int i = 0; i < rocks; i++)
            {
                angle = Random.Range(-60, 60) + Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
                rotator.eulerAngles = Vector3.forward * angle;

                LavaRock newRock = Instantiate(rock, shootPoint.position, shootPoint.rotation).GetComponent <LavaRock>();
                newRock.SetStats(gameObject, Random.Range(0.3f, 1f));
            }
            break;
        }
    }
Beispiel #2
0
        public virtual void OnCrack(Mobile from)
        {
            Item item;

            from.SendSound(0x3B3);

            if (from.RawStr < Utility.Random(150))
            {
                from.SendMessage("You swing, but fail to crack the rock any further.");
                return;
            }

            switch (Utility.Random(5))
            {
            default:
            case 0: item = new GeodeEast(); break;

            case 1: item = new GeodeSouth(); break;

            case 2: item = new GeodeShardEast(); break;

            case 3: item = new GeodeShardSouth(); break;

            case 4: item = new LavaRock(); break;
            }

            if (item != null)
            {
                from.AddToBackpack(item);
                from.SendMessage("You have split the lava rock!");
                Delete();
            }
        }
Beispiel #3
0
        public virtual void OnCrack(Mobile from)
        {
            Item item;

            switch (Utility.Random(5))
            {
            default:
            case 0: item = new GeodeEast(); break;

            case 1: item = new GeodeSouth(); break;

            case 2: item = new GeodeShardEast(); break;

            case 3: item = new GeodeShardSouth(); break;

            case 4: item = new LavaRock(); break;
            }

            if (item != null)
            {
                from.AddToBackpack(item);
                from.SendMessage("You have split the lava rock!");
                Delete();
            }
        }
Beispiel #4
0
    public IEnumerator SpawnLava(float time)
    {
        yield return(new WaitForSeconds(time));

        LavaRock lavaRock  = Instantiate(lavaRockPrefab, transform.position, Quaternion.identity).GetComponent <LavaRock>();
        float    force     = Random.Range(GameManager.Instance.minForce, GameManager.Instance.maxForce);
        Vector3  randomPos = new Vector3(Random.Range(-GameManager.Instance.launchRadius, GameManager.Instance.launchRadius), 0, Random.Range(-GameManager.Instance.launchRadius, GameManager.Instance.launchRadius));

        lavaRock.Launch(randomPos.normalized + Vector3.up, force);
    }