Beispiel #1
0
 public override void SendAttack(HitDamageInfo info)
 {
     if (info.stat.Health > 0 && !info.stat.SpawnProtected)
     {
         info.player.RPC("TakeDamage", RPCMode.All, AeCore.m_pCoreGame.MyStats.m_iPlayerID, info.weaponDamage, info.weaponID, AeTools.damageLocationToInt(info.damageLocation));
         AeCore.m_pCoreGame.MyStats.PlayerComponents.m_pHud.StartCoroutine(AeCore.m_pCoreGame.MyStats.PlayerComponents.m_pHud.Hitmark(AeTools.damageLocationToInt(info.damageLocation) == 1 ? true : false));
     }
 }
Beispiel #2
0
    public static GameObject CreateParticle(GameObject particle, HitDamageInfo info, bool hole, float offset)
    {
        GameObject BulletHole = MonoBehaviour.Instantiate(particle, info.hit.point + (info.hit.normal * offset), Quaternion.LookRotation(info.hit.normal)) as GameObject;

        if (!hole)
        {
            BulletHole.transform.GetChild(1).gameObject.SetActive(false);
        }
        MonoBehaviour.Destroy(BulletHole, 10.0f);

        return(BulletHole);
    }
Beispiel #3
0
    void DoExplosion(GameObject epicenter)
    {
        var layerMask = ~(1 << 8);

        Collider [] RangedToExplosion = Physics.OverlapSphere(epicenter.transform.position, 3.0f);

        for (int i = 0; i < RangedToExplosion.Length; i++)
        {
            if (AeTools.isEnnemy(RangedToExplosion[i].tag))
            {
                RaycastHit newHit;
                AeStats    stat = RangedToExplosion[i].transform.root.GetComponent <AeStats>();

                if (stat != null && AeTools.canDamage(this, stat, stat.networkView.isMine))
                {
                    if (Physics.Linecast(epicenter.transform.position, RangedToExplosion[i].transform.position, out newHit, layerMask))
                    {
                        if (AeTools.isEnnemy(newHit.transform.tag))
                        {
                            HitDamageInfo info = new HitDamageInfo();
                            stat.AlreadyTouchedByMagic = true;
                            info.stat           = stat;
                            info.damageLocation = newHit.transform.tag;
                            info.hit            = newHit;
                            info.isEnnemy       = true;
                            info.weaponID       = m_iItemID;
                            info.weaponDamage   = Damage;
                            info.player         = stat.networkView;
                            info.physicsFailed  = false;

                            AeCore.m_pCoreGame.m_pNetworkHandler.ServerInformations.GetCurrentMode().SendAttack(info);
                        }
                    }
                    else
                    {
                        HitDamageInfo info = new HitDamageInfo();
                        stat.AlreadyTouchedByMagic = true;
                        info.stat           = stat;
                        info.damageLocation = RangedToExplosion[i].transform.tag;
                        info.isEnnemy       = true;
                        info.weaponID       = m_iItemID;
                        info.weaponDamage   = Damage;
                        info.player         = stat.networkView;
                        info.physicsFailed  = false;

                        AeCore.m_pCoreGame.m_pNetworkHandler.ServerInformations.GetCurrentMode().SendAttack(info);
                    }
                }
            }
        }
    }
Beispiel #4
0
    public override IEnumerator LaunchAction1()
    {
        m_sTransforms.Weapon.root.networkView.RPC("Action1", RPCMode.All);
        HitDamageInfo Attack = AeRaycasts.ShootingRaycast(m_sTransforms.WeaponSpawnPoint, Vector3.forward, m_sStats.Range, m_sStats.Force, (int)m_sStats.WeaponDamage, WeaponID);

        AeCore.m_pCoreGame.MyStats.PlayerComponents.m_pHud.AddKnockBack();
        m_sTransforms.Weapon.Translate(new Vector3(0, 0.001f, 0.015f));


        if (Attack.isEnnemy)
        {
            AeCore.m_pCoreGame.m_pNetworkHandler.ServerInformations.GetCurrentMode().SendAttack(Attack);
        }
        yield return(null);
    }
Beispiel #5
0
    public override IEnumerator LaunchAction1()
    {
        m_sTransforms.Weapon.root.networkView.RPC("Action1", RPCMode.All);

        yield return(new WaitForSeconds(0.2f));

        HitDamageInfo Attack = AeRaycasts.ShootingRaycast(m_sTransforms.WeaponSpawnPoint, Vector3.forward, m_sStats.Range, m_sStats.Force, (int)m_sStats.WeaponDamage, WeaponID);


        if (Attack.isEnnemy)
        {
            AeCore.m_pCoreGame.m_pNetworkHandler.ServerInformations.GetCurrentMode().SendAttack(Attack);
        }
        yield return(null);
    }
Beispiel #6
0
    public override IEnumerator DoAction1CallBack()
    {
        hasAttack = true;

        m_sTransforms.componentsManager.m_pAnimator.PlayAction1();
        m_sTransforms.Sounds.SoundAction1.Play();

        yield return(new WaitForSeconds(0.2f));

        HitDamageInfo HitInfo = AeRaycasts.ShootingRaycast(m_sTransforms.WeaponSpawnPoint, Vector3.forward, m_sStats.Range, m_sStats.Force, (int)m_sStats.WeaponDamage, WeaponID);

        if (HitInfo.isEnnemy || HitInfo.damageLocation == "PlayerRag" || HitInfo.damageLocation == "Player")
        {
            GameObject Impact = MonoBehaviour.Instantiate(m_sTransforms.Particles.Blood, HitInfo.hit.point + (HitInfo.hit.normal * 0.01f), Quaternion.LookRotation(HitInfo.hit.normal)) as GameObject;
            MonoBehaviour.Destroy(Impact, 2.0f);
        }
        else if (HitInfo.damageLocation == "Untagged")
        {
            GameObject Impact = MonoBehaviour.Instantiate(m_sTransforms.Particles.Concrete, HitInfo.hit.point + (HitInfo.hit.normal * 0.01f), Quaternion.LookRotation(HitInfo.hit.normal)) as GameObject;
            Impact.transform.GetChild(1).gameObject.SetActive(false);
            MonoBehaviour.Destroy(Impact, 2.0f);
        }
        else if (HitInfo.damageLocation == "Wood")
        {
            GameObject Impact = MonoBehaviour.Instantiate(m_sTransforms.Particles.Wood, HitInfo.hit.point + (HitInfo.hit.normal * 0.01f), Quaternion.LookRotation(HitInfo.hit.normal)) as GameObject;
            Impact.transform.GetChild(1).gameObject.SetActive(false);
            MonoBehaviour.Destroy(Impact, 2.0f);
        }

        else if (HitInfo.damageLocation == "Metal")
        {
            GameObject Impact = MonoBehaviour.Instantiate(m_sTransforms.Particles.Metal, HitInfo.hit.point + (HitInfo.hit.normal * 0.01f), Quaternion.LookRotation(HitInfo.hit.normal)) as GameObject;
            Impact.transform.GetChild(1).gameObject.SetActive(false);
            MonoBehaviour.Destroy(Impact, 2.0f);
        }

        else if (HitInfo.damageLocation == "WeaponsParry")
        {
            GameObject Impact = MonoBehaviour.Instantiate(m_sTransforms.Particles.Metal, HitInfo.hit.point + (HitInfo.hit.normal * 0.01f), Quaternion.LookRotation(HitInfo.hit.normal)) as GameObject;
            Impact.transform.GetChild(1).gameObject.SetActive(false);
            MonoBehaviour.Destroy(Impact, 2.0f);
        }


        yield return(new WaitForSeconds(m_sStats.FireRate));

        hasAttack = false;
    }
Beispiel #7
0
    void buildInfo(GameObject obj, AeStats h)
    {
        HitDamageInfo info = new HitDamageInfo();

        h.AlreadyTouchedByMagic = true;

        info.damageLocation = obj.tag;
        info.weaponDamage   = gauntlet.Damage;
        info.isEnnemy       = true;
        info.physicsFailed  = false;
        info.player         = obj.transform.root.networkView;

        info.stat = h;

        info.weaponID = gauntlet.m_iItemID;

        Collided.Add(info);

        AeCore.m_pCoreGame.m_pNetworkHandler.ServerInformations.GetCurrentMode().SendAttack(info);
    }
Beispiel #8
0
    public static HitDamageInfo ShootingRaycast(Transform spawn, Vector3 direction, float range, float force, int damage, int weaponID)
    {
        HitDamageInfo info = new HitDamageInfo();
        RaycastHit    hit;
        Vector3       tempDir   = spawn.TransformDirection(direction);
        var           layerMask = ~(1 << 8);

        if (Physics.Raycast(spawn.position, tempDir, out hit, range, layerMask))
        {
            if (hit.rigidbody)
            {
                hit.rigidbody.AddForceAtPosition(force * tempDir, hit.point);
            }

            if (AeTools.isEnnemy(hit.collider.tag))
            {
                AeStats healthInfo = hit.collider.transform.root.GetComponent <AeStats>();
                info.isEnnemy       = true;
                info.damageLocation = hit.collider.tag;
                info.player         = hit.collider.transform.root.networkView;
                info.stat           = healthInfo;
                info.weaponDamage   = damage;
                info.weaponID       = weaponID;
            }
            else
            {
                info.damageLocation = hit.collider.tag;
            }
        }
        else
        {
            info.physicsFailed = true;
        }

        info.hit = hit;
        return(info);
    }
Beispiel #9
0
    public override IEnumerator DoAction1CallBack()
    {
        ammoLeft--;
        HitDamageInfo HitInfo = AeRaycasts.ShootingRaycast(m_sTransforms.WeaponSpawnPoint, Vector3.forward, m_sStats.Range, m_sStats.Force, (int)m_sStats.WeaponDamage, WeaponID);

        DoRecoil();
        GameObject TrailBull = MonoBehaviour.Instantiate(Trailbullet, MuzzleFlash.position, MuzzleFlash.rotation) as GameObject;

        m_sTransforms.Sounds.SoundAction1.Play();

        MonoBehaviour.Destroy(TrailBull, 3.0f);

        if (HitInfo.physicsFailed)
        {
            Vector3 forward = m_sTransforms.WeaponSpawnPoint.TransformDirection(Vector3.forward);
            TrailBull.transform.LookAt((m_sTransforms.WeaponSpawnPoint.position + (forward * m_sStats.Range)));
        }
        else
        {
            TrailBull.transform.LookAt(HitInfo.hit.point);
        }

        if (HitInfo.isEnnemy || HitInfo.damageLocation == "PlayerRag" || HitInfo.damageLocation == "Player")
        {
            if (HitInfo.isEnnemy)
            {
                if (AeTools.damageLocationToInt(HitInfo.damageLocation) != -1)
                {
                    AeTools.CreateParticle(m_sTransforms.Particles.Blood, HitInfo, true);
                }
                else
                {
                    AeTools.CreateParticle(m_sTransforms.Particles.Metal, HitInfo, false);
                }
            }
            else
            {
                AeTools.CreateParticle(m_sTransforms.Particles.Blood, HitInfo, true);
            }
        }

        else if (HitInfo.damageLocation == "Untagged")
        {
            AeTools.CreateParticle(m_sTransforms.Particles.Concrete, HitInfo, true);
        }
        else if (HitInfo.damageLocation == "Wood")
        {
            AeTools.CreateParticle(m_sTransforms.Particles.Wood, HitInfo, true);
        }
        else if (HitInfo.damageLocation == "Metal")
        {
            AeTools.CreateParticle(m_sTransforms.Particles.Metal, HitInfo, true);
        }

        MuzzleFlash.localRotation = Quaternion.AngleAxis(Random.Range(0, 359), Vector3.forward);
        LightIndex++;
        if (LightIndex > m_sTransforms.Lights.Count - 1)
        {
            LightIndex = 0;
        }

        hasShot = true;
        m_sTransforms.Lights[LightIndex].gameObject.SetActive(true);
        MuzzleFlash.gameObject.SetActive(true);
        yield return(new WaitForSeconds(0.05f));

        m_sTransforms.Lights[LightIndex].gameObject.SetActive(false);
        MuzzleFlash.gameObject.SetActive(false);
        yield return(new WaitForSeconds(m_sStats.FireRate - 0.05f));

        hasShot = false;
    }
Beispiel #10
0
 public abstract void SendAttack(HitDamageInfo info);
Beispiel #11
0
    public override IEnumerator ActionCallBack()
    {
        HitDamageInfo info = AeRaycasts.ShootingRaycast(SpawnPoint, Vector3.forward, Range, Force, Damage, m_iItemID);

        if (info.physicsFailed)
        {
            Vector3 point = SpawnPoint.position + SpawnPoint.TransformDirection(Vector3.forward) * Range; info.hit.point = point; info.hit.normal = point;
        }

        float distance = Mathf.Round(Vector3.Distance(SpawnPointGraphic.transform.position, info.hit.point) * 2.0f);

        int vertexs = (int)(distance / sizeByVertex);

        vertexs += 1;

        float timeWait = ((distance / sizeByVertex) * timeBetweenVertex);

        canFire = false;

        if (componentsManager.m_pNetworkCaller.networkView.isMine)
        {
            Beams[0].parent.collider.enabled = true;
        }
        componentsManager.m_pWeaponHandler.StartCoroutine(GenerateNormalVertex(vertexs, info.hit.point));
        for (int i = 1; i < Beams.Count; i++)
        {
            componentsManager.m_pWeaponHandler.StartCoroutine(GenerateSinusoidalVertex(i, vertexs, info.hit.point));
        }

        float t = 0.0f;

        while (t < timeWait)
        {
            for (int j = 0; j < Beams.Count; j++)
            {
                Beams[j].Rotate();
            }

            t += Time.deltaTime;
            yield return(null);
        }

        DoExplosion(AeTools.CreateParticle(ParticleOnHit, info, true, info.physicsFailed == false ? 0.4f : 0.0f));



        float t2 = 0.0f;

        while (t2 < ShowTime)
        {
            for (int j = 0; j < Beams.Count; j++)
            {
                Beams[j].Rotate();
            }

            t2 += Time.deltaTime;
            yield return(null);
        }

        Beams[0].parent.collider.enabled = false;
        resetBeams();


        yield return(new WaitForSeconds(Cooldown));

        canFire = true;
    }