Esempio n. 1
0
    protected override IEnumerator SkillUpdate(Animator animator)
    {
        if (Input.GetKey(KeyCode.K) && force >= 50)
        {
            force -= 1;
            fireBallInstance.UpdateVols((initialForce - force) / (initialForce - 50));
            yield return(new WaitForEndOfFrame());

            damageVal += 0.5f;
            StartCoroutine(SkillUpdate(animator));
        }
        else
        {
            fireBallInstance.WhenBeReleased();
            if (force <= 150)
            {
                hero.audioCtrler.PlaySound(word);
            }
            fireBallInstance.GetComponent <FireBall>().damage = new RagnarosDamage((int)damageVal, damageType, gameObject.layer);
            animator.SetBool("Fireball_low", false);
            yield return(new WaitForSeconds(0.5f));

            fireBallInstance.transform.SetParent(GameController.instance.gameObject.transform);
            fireBallInstance.GetComponent <Rigidbody>().AddForce(-force, 0, 0);
            yield return(new WaitForEndOfFrame());

            force            = initialForce;
            fireBallInstance = null;
        }
    }
Esempio n. 2
0
/*------------------------------------PLAYER1 ATTACK--------------------------------------------------------*/

	public void P1CorrectAttack(){

		//Fire when option is choosen. 
		fireBall = fireBall.GetComponent<FireBall> ();
		source.PlayOneShot(fireballsound);
		fireBall.createShot ();

		//reset the options back to original place. 
		resetOpt = resetOpt.GetComponent<ResetOption> ();
		resetOpt.reset ();
		resetOpt2 = resetOpt.GetComponent<ResetOption2> ();
		resetOpt2.reset ();
		
		gamesqlM.activation();
	}
Esempio n. 3
0
    void checkInputs()
    {
        if (Input.GetKey(KeyCode.H))
        {
            restoreHealth();
        }
        if (attacking && Time.time - attackTime >= .25)
        {
            attacking = false;
            endAttack();
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            attack();
        }
        else if (Input.GetKeyDown(KeyCode.S) && bullets > 0)
        {
            bulletDisplay.GetComponent <BulletCountScript>().setBullets(--bullets);
            shoot();
        }
        else if (Input.GetKeyDown(KeyCode.F) && currentMana - FireBall.GetComponent <FireBallScript>().getManaCost() >= 0)
        {
            currentMana -= FireBall.GetComponent <FireBallScript>().getManaCost();
            manaBar.GetComponent <ManaBarScript>().setMana(currentMana);
            shootFire();
        }
        else if (!attacking)
        {
            sword.noAttack();
            bc.offset = new Vector2(0f, 0f);
            movement();
        }
    }
Esempio n. 4
0
    public void EnemyShooting()
    {
        //Disparo enemigo
        FireBall newFireBall = Instantiate(_fireShoot);

        newFireBall.transform.position = _shootPoint.transform.position;
        newFireBall.GetComponent <Rigidbody2D>().AddForce(Vector2.right * -this.transform.localScale.x * _shootForce, ForceMode2D.Impulse);
        newFireBall.SetDamage(_fireBallDamage);
    }
Esempio n. 5
0
    void Fire()
    {
        FireBall newFireBall = Instantiate(_fireShoot);

        newFireBall.transform.position = _shootPoint.transform.position;
        Vector2 _playerPosition = (_player.transform.position + correction) - _shootPoint.transform.position;

        newFireBall.GetComponent <Rigidbody2D>().AddForce(_playerPosition * _shootForce, ForceMode2D.Impulse);
        newFireBall.SetDamage(_fireBallDamage);
    }
Esempio n. 6
0
        public void Shooting()
        {
            FireBall newFireBall = Instantiate(_fireShoot);

            newFireBall.transform.position   = _shootPoint.transform.position;
            newFireBall.transform.localScale = this.transform.localScale;
            AudioSource.PlayClipAtPoint(_shootClip, this.transform.position);
            newFireBall.GetComponent <Rigidbody2D>().AddForce(Vector2.right * this.transform.localScale.x * _shootForce, ForceMode2D.Impulse);
            newFireBall.SetDamage(_fireBallDamage);
        }
Esempio n. 7
0
        private void OnFireBallSpread(FireBall fireBall, BaseEntity newFire)
        {
            var flame = fireBall.GetComponent <Flame>();

            if (flame != null)
            {
                var newFlame = newFire.gameObject.AddComponent <Flame>();
                newFlame.Source       = flame.Source;
                newFlame.SourceEntity = flame.SourceEntity;
                newFlame.Initiator    = flame.Initiator;
            }
        }
Esempio n. 8
0
    public void correctAttack()
    {
//		gamesql.timer = 1f;
        //add one point
        scoreCount.correct();

        //Fire when option is choosen.
        fireBall = fireBall.GetComponent <FireBall> ();
        source.PlayOneShot(fireballsound);
        fireBall.createShot();

        //reset the options back to original place.
        resetOpt = resetOpt.GetComponent <ResetOption> ();
        resetOpt.reset();

        gamesql.activation();
    }
Esempio n. 9
0
    void shootFire()
    {
        magic = FireBall.GetComponent <FireBallScript>();
        string temp = magic.changeDirection(direction);

        switch (temp)
        {
        case "forward":
            GameObject.Instantiate(FireBall, this.transform.position + new Vector3(0f, .2f, 0f), magic.rotation());
            break;

        case "back":
            GameObject.Instantiate(FireBall, this.transform.position + new Vector3(0f, -.2f, 0f), magic.rotation());
            break;

        case "right":
            GameObject.Instantiate(FireBall, this.transform.position + new Vector3(0.2f, 0f, 0f), magic.rotation());
            break;

        case "left":
            GameObject.Instantiate(FireBall, this.transform.position + new Vector3(-.2f, 0f, 0f), magic.rotation());
            break;
        }
    }
Esempio n. 10
0
    void OnTriggerEnter(Collider other)
    {
        print(other.tag);

        if (other.tag == "Fireball")
        {
            print("YA");

            FireBall OtherFireball_Data = other.gameObject.GetComponent <FireBall>();

            if (!OtherFireball_Data.GetComponent <Spatter>())
            {
                if (GetComponent <PhotonView>().isMine)
                {
                    if (OtherFireball_Data.Team == gameObject.GetComponent <FireBall>().Team)
                    {
                        GetComponent <PhotonView>().RPC("Damage", PhotonTargets.All, new object[] { other.gameObject.GetComponent <PhotonView>().viewID, this.gameObject.GetComponent <PhotonView>().viewID });
                        CreateFireBall();
                        //GameObject FB = PhotonNetwork.Instantiate("FireBall_mid", transform.position, transform.rotation, 0);

                        GetComponent <PhotonView>().RPC("DestoryFireball", PhotonTargets.All, other.gameObject.GetComponent <PhotonView>().viewID);
                        PhotonNetwork.Destroy(gameObject);
                    }
                }
            }
        }



        /*
         * if (GetComponent<PhotonView>().isMine)
         * {
         *  print("YA5");
         *  GetComponent<PhotonView>().RPC("Damage", PhotonTargets.All, new object[] { other.gameObject.GetComponent<PhotonView>().viewID, this.gameObject.GetComponent<PhotonView>().viewID });
         *
         *  if (OtherFireBall.GetComponent<FireBall>().Team == MyFireBall.GetComponent<FireBall>().Team)
         *  {
         *      print("YA4");
         *      //目標如果不是濺散火球
         *      if (OtherFireBall.GetComponent<Spatter>() == null)
         *      {
         *          print("合體");
         *          //目標如果也是合成火球
         *          if (OtherFireBall.GetComponent<Fusion>() != null)
         *          {
         *              print("YA3"+ OtherFireBall.GetComponent<FireBall>().BornTime +":" + MyFireBall.GetComponent<FireBall>().BornTime);
         *
         *              if (OtherFireBall.GetComponent<FireBall>().BornTime > MyFireBall.GetComponent<FireBall>().BornTime)
         *              {
         *                  print("YA2");
         *                  GetComponent<PhotonView>().RPC("DestoryComponent", PhotonTargets.All, OtherFireBall.gameObject.GetComponent<PhotonView>().viewID);
         *                  //Destroy(OtherFireBall.GetComponent<Fusion>());
         *                  StartCoroutine(CreateFireBall());
         *                  //CreateFireBall();
         *              }
         *              else
         *              {
         *                  print("YA22");
         *                  //GetComponent<PhotonView>().RPC("DestoryComponent", PhotonTargets.All, MyFireBall.gameObject.GetComponent<PhotonView>().viewID);
         *                  StartCoroutine(CreateFireBall());
         *              }
         *
         *
         *          }
         *          else
         *          {
         *              StartCoroutine(CreateFireBall());
         *              //CreateFireBall();
         *          }
         *
         *          //print(OtherFireBall.GetComponent<PhotonView>().viewID);
         *          //print(MyFireBall.GetComponent<PhotonView>().viewID);
         *
         *          GetComponent<PhotonView>().RPC("DestoryFireball", PhotonTargets.All, OtherFireBall.gameObject.GetComponent<PhotonView>().viewID);
         *          PhotonNetwork.Destroy(MyFireBall);
         *
         *      }
         *
         *  }
         * }
         */
    }
Esempio n. 11
0
    public override void OnKilled(HitInfo info)
    {
        if (base.isClient)
        {
            return;
        }
        this.CreateExplosionMarker(10f);
        Effect.server.Run(this.explosionEffect.resourcePath, this.mainTurretEyePos.transform.position, Vector3.up, null, true);
        Vector3          vector3    = Vector3.zero;
        GameObject       component  = this.servergibs.Get().GetComponent <ServerGib>()._gibSource;
        List <ServerGib> serverGibs = ServerGib.CreateGibs(this.servergibs.resourcePath, base.gameObject, component, vector3, 3f);

        for (int i = 0; i < 12 - this.maxCratesToSpawn; i++)
        {
            BaseEntity baseEntity = GameManager.server.CreateEntity(this.fireBall.resourcePath, base.transform.position, base.transform.rotation, true);
            if (baseEntity)
            {
                float   single   = 3f;
                float   single1  = 10f;
                Vector3 vector31 = UnityEngine.Random.onUnitSphere;
                baseEntity.transform.position = (base.transform.position + new Vector3(0f, 1.5f, 0f)) + (vector31 * UnityEngine.Random.Range(-4f, 4f));
                Collider collider = baseEntity.GetComponent <Collider>();
                baseEntity.Spawn();
                baseEntity.SetVelocity(vector3 + (vector31 * UnityEngine.Random.Range(single, single1)));
                foreach (ServerGib serverGib in serverGibs)
                {
                    UnityEngine.Physics.IgnoreCollision(collider, serverGib.GetCollider(), true);
                }
            }
        }
        for (int j = 0; j < this.maxCratesToSpawn; j++)
        {
            Vector3    vector32    = UnityEngine.Random.onUnitSphere;
            Vector3    vector33    = (base.transform.position + new Vector3(0f, 1.5f, 0f)) + (vector32 * UnityEngine.Random.Range(2f, 3f));
            BaseEntity baseEntity1 = GameManager.server.CreateEntity(this.crateToDrop.resourcePath, vector33, Quaternion.LookRotation(vector32), true);
            baseEntity1.Spawn();
            LootContainer lootContainer = baseEntity1 as LootContainer;
            if (lootContainer)
            {
                lootContainer.Invoke(new Action(lootContainer.RemoveMe), 1800f);
            }
            Collider  component1 = baseEntity1.GetComponent <Collider>();
            Rigidbody rigidbody  = baseEntity1.gameObject.AddComponent <Rigidbody>();
            rigidbody.useGravity             = true;
            rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
            rigidbody.mass            = 2f;
            rigidbody.interpolation   = RigidbodyInterpolation.Interpolate;
            rigidbody.velocity        = vector3 + (vector32 * UnityEngine.Random.Range(1f, 3f));
            rigidbody.angularVelocity = Vector3Ex.Range(-1.75f, 1.75f);
            rigidbody.drag            = 0.5f * (rigidbody.mass / 5f);
            rigidbody.angularDrag     = 0.2f * (rigidbody.mass / 5f);
            GameManager gameManager = GameManager.server;
            string      str         = this.fireBall.resourcePath;
            Vector3     vector34    = new Vector3();
            Quaternion  quaternion  = new Quaternion();
            FireBall    fireBall    = gameManager.CreateEntity(str, vector34, quaternion, true) as FireBall;
            if (fireBall)
            {
                fireBall.SetParent(baseEntity1, false, false);
                fireBall.Spawn();
                fireBall.GetComponent <Rigidbody>().isKinematic = true;
                fireBall.GetComponent <Collider>().enabled      = false;
            }
            baseEntity1.SendMessage("SetLockingEnt", fireBall.gameObject, SendMessageOptions.DontRequireReceiver);
            foreach (ServerGib serverGib1 in serverGibs)
            {
                UnityEngine.Physics.IgnoreCollision(component1, serverGib1.GetCollider(), true);
            }
        }
        base.OnKilled(info);
    }
Esempio n. 12
0
    public override void OnKilled(HitInfo info)
    {
        if (base.isClient || Interface.CallHook("OnEntityDestroy", this) != null)
        {
            return;
        }
        CreateExplosionMarker(10f);
        Effect.server.Run(explosionEffect.resourcePath, mainTurretEyePos.transform.position, Vector3.up, null, true);
        Vector3          zero      = Vector3.zero;
        GameObject       gibSource = servergibs.Get().GetComponent <ServerGib>()._gibSource;
        List <ServerGib> list      = ServerGib.CreateGibs(servergibs.resourcePath, base.gameObject, gibSource, zero, 3f);

        for (int i = 0; i < 12 - maxCratesToSpawn; i++)
        {
            BaseEntity baseEntity = GameManager.server.CreateEntity(this.fireBall.resourcePath, base.transform.position, base.transform.rotation);
            if (!baseEntity)
            {
                continue;
            }
            float   min          = 3f;
            float   max          = 10f;
            Vector3 onUnitSphere = UnityEngine.Random.onUnitSphere;
            baseEntity.transform.position = base.transform.position + new Vector3(0f, 1.5f, 0f) + onUnitSphere * UnityEngine.Random.Range(-4f, 4f);
            Collider component = baseEntity.GetComponent <Collider>();
            baseEntity.Spawn();
            baseEntity.SetVelocity(zero + onUnitSphere * UnityEngine.Random.Range(min, max));
            foreach (ServerGib item in list)
            {
                UnityEngine.Physics.IgnoreCollision(component, item.GetCollider(), true);
            }
        }
        for (int j = 0; j < maxCratesToSpawn; j++)
        {
            Vector3 onUnitSphere2 = UnityEngine.Random.onUnitSphere;
            onUnitSphere2.y = 0f;
            onUnitSphere2.Normalize();
            Vector3    pos         = base.transform.position + new Vector3(0f, 1.5f, 0f) + onUnitSphere2 * UnityEngine.Random.Range(2f, 3f);
            BaseEntity baseEntity2 = GameManager.server.CreateEntity(crateToDrop.resourcePath, pos, Quaternion.LookRotation(onUnitSphere2));
            baseEntity2.Spawn();
            LootContainer lootContainer = baseEntity2 as LootContainer;
            if ((bool)lootContainer)
            {
                lootContainer.Invoke(lootContainer.RemoveMe, 1800f);
            }
            Collider  component2 = baseEntity2.GetComponent <Collider>();
            Rigidbody rigidbody  = baseEntity2.gameObject.AddComponent <Rigidbody>();
            rigidbody.useGravity             = true;
            rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
            rigidbody.mass            = 2f;
            rigidbody.interpolation   = RigidbodyInterpolation.Interpolate;
            rigidbody.velocity        = zero + onUnitSphere2 * UnityEngine.Random.Range(1f, 3f);
            rigidbody.angularVelocity = Vector3Ex.Range(-1.75f, 1.75f);
            rigidbody.drag            = 0.5f * (rigidbody.mass / 5f);
            rigidbody.angularDrag     = 0.2f * (rigidbody.mass / 5f);
            FireBall fireBall = GameManager.server.CreateEntity(this.fireBall.resourcePath) as FireBall;
            if ((bool)fireBall)
            {
                fireBall.SetParent(baseEntity2);
                fireBall.Spawn();
                fireBall.GetComponent <Rigidbody>().isKinematic = true;
                fireBall.GetComponent <Collider>().enabled      = false;
            }
            baseEntity2.SendMessage("SetLockingEnt", fireBall.gameObject, SendMessageOptions.DontRequireReceiver);
            foreach (ServerGib item2 in list)
            {
                UnityEngine.Physics.IgnoreCollision(component2, item2.GetCollider(), true);
            }
        }
        base.OnKilled(info);
    }