示例#1
0
文件: Rifle.cs 项目: Rakiah/Aeternam
    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);
    }
示例#2
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);
    }
示例#3
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;
    }
示例#4
0
文件: Rifle.cs 项目: Rakiah/Aeternam
    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;
    }
示例#5
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;
    }