Esempio n. 1
0
 protected void Awake()
 {
     sprite   = GetComponent <SpriteRenderer>();
     fireBall = Resources.Load <FireBallController>("FireBall");
     coin     = Resources.Load <GameObject>("Coin");
     health   = Resources.Load <GameObject>("Health");
 }
    private void OnTriggerStay2D(Collider2D other)
    {
        FireBallController fireBall = other.GetComponent <FireBallController>();

        if (fireBall)
        {
            lifes--;
            TimeDamageCount = DamageTime;
            Destroy(other.gameObject);
            if (lifes <= 0)
            {
                Destroy(gameObject, DamageTime);
                //рандомные деньги
                var random = Random.Range(1, 5);
                for (var i = 0; i < random; i++)
                {
                    Instantiate(coin, new Vector3(Random.Range(transform.position.x - 2, transform.position.x + 2), -1F, 0F), Quaternion.identity);
                }
                //рандомные жизни
                if (random == 1 || random == 4)
                {
                    Instantiate(health, new Vector3(Random.Range(transform.position.x - 2, transform.position.x + 2), -1F, 0F), Quaternion.identity);
                }

                SpecialEffectsHelper.Instance.Explosion(transform.position);
            }
        }
    }
    private void OnTriggerEnter2D(Collider2D other)
    {
        FireBallController fireBall = other.GetComponent <FireBallController>();

        if (fireBall)
        {
            GetComponent <Rigidbody2D>().AddForce(new Vector2(0, 300));
            health.TakeDamage(30);
        }

        BulletController bullet = other.GetComponent <BulletController>();

        if (bullet)
        {
            GetComponent <Rigidbody2D>().AddForce(new Vector2(0, 300));
            health.TakeDamage(30);
        }
        if (other.tag == "Asteroid")
        {
            health.TakeDamage(30);
        }
        if (other.tag == "health")
        {
            health.AddHealth(25);
            Destroy(other.gameObject);
        }
    }
Esempio n. 4
0
    private void SetUpVariableFireBall(int viewId)
    {
        FireBallController fbc = PhotonView.Find(viewId).gameObject.GetComponent <FireBallController>();

        fbc.CharId = photonView.viewID;
        fbc.Damage = _fb.Damage;
    }
Esempio n. 5
0
    private void Shoot()
    {
        Vector3 position = transform.position;

        position.y += 3.5F;
        position.x += 1F;
        FireBallController newFireBall = Instantiate(fireBall, position, fireBall.transform.rotation) as FireBallController;

        newFireBall.Direction = direction;
    }
Esempio n. 6
0
    protected override void cast()
    {
        steerToAim();//do better

        FireBallController f = Instantiate(fireballPrefab, transform.position + transform.forward, transform.rotation).GetComponent <FireBallController>();

        f.initiator = this;

        manager.releaseAttackBlock();
    }
Esempio n. 7
0
    public override IAbilityObject Execute(ShootObject t)
    {
        if (unlocked && (Utils.GetUnixTime() - coolDownTime) > cooldown)
        {
            GameObject         go = UnityEngine.Object.Instantiate(t.projectilePrefab);
            FireBallController fb = go.GetComponent <FireBallController>();
            fb.start  = t.start.position;
            fb.end    = t.end.position;
            fb.source = t.objectType;
            fb.ReleaseProjectile();
            coolDownTime = Utils.GetUnixTime();
        }

        return(t);
    }
Esempio n. 8
0
    // Generic Method to cast spell
    public void CastSpell(Spell spell)
    {
        photonView.RPC("PlayAnim", PhotonTargets.All, "Move|Cast");

        if (spell is FireBall)
        {
            FireBallController fbc = CastFireBall();
            if (fbc == null)
            {
                return;
            }
            photonView.RPC("SetUpVariableFireBall", PhotonTargets.All, fbc.photonView.viewID);
            _fb.CurrentCooldown = 0;
        }
        if (spell is FireNova)
        {
            FireNovaController fnc = CastFireNova();
            photonView.RPC("SetUpVariableFireNova", PhotonTargets.All, fnc.photonView.viewID);
            _fn.CurrentCooldown = 0;
        }
    }
Esempio n. 9
0
 private void Awake()
 {
     SharedInstance = this;
 }