Пример #1
0
 public static void AddDamage(RaycastInfo ri)
 {
     if (G.Settings.WeaponOptions.DamageIndicators && ri.point != new Vector3(0, 0, 0))
     {
         ItemGunAsset currentGun = Player.player.equipment.asset as ItemGunAsset;
         if (currentGun != null && ri.player != null)
         {
             IndicatorObject dmgi = new IndicatorObject
             {
                 HitPos   = ri.point,
                 Damage   = Mathf.FloorToInt(DamageTool.getPlayerArmor(ri.limb, ri.player) * currentGun.playerDamageMultiplier.multiply(ri.limb)), // big maths
                 ShotTime = DateTime.Now
             };
             DamageIndicators.Add(dmgi);
         }
     }
 }
Пример #2
0
    void Indicator()
    {
        Boss = GameObject.FindObjectOfType <FirstBoss>().gameObject;
        Vector3 dir = Boss.transform.position - transform.position;

        dir.Normalize();
        RaycastHit2D hit = Physics2D.Raycast(transform.position, dir, 9, IndicatorLayer);

        if (hit.collider != null && hit.collider.tag != "Blocks")
        {
            if (Boss.GetComponent <SpriteRenderer>().isVisible == false)
            {
                IndicatorObject.SetActive(true);
                IndicatorObject.transform.position = hit.point;
            }
            else
            {
                IndicatorObject.SetActive(false);
            }
        }
    }
 private void DeActivate(IndicatorObject targetRenderer)
 {
     targetRenderer.renderer.material.color = targetRenderer.originalColor;
 }
 private void ActiveFalse(IndicatorObject targetRenderer)
 {
     targetRenderer.renderer.material.color = Color.red;
 }
    //-----------------------------------------------------------------------------

    private void Activate(IndicatorObject targetRenderer)
    {
        targetRenderer.renderer.material.color = Color.green;
    }
Пример #6
0
        void OnGUI()
        {
            if (Provider.isConnected && !Provider.isLoading)
            {
                GUI.skin = AssetUtilities.Skin;
                if (!G.BeingSpied)
                {
                    if (G.Settings.WeaponOptions.WeaponInfo)
                    {
                        GunInfoWin = GUILayout.Window(6, GunInfoWin, GunInfoWindow, "Weapon Info");
                    }

                    #region Tracers
                    if (G.Settings.WeaponOptions.TracerLines && TracerLines.Count > 0)
                    {
                        T.DrawMaterial.SetPass(0);
                        GL.PushMatrix();
                        GL.LoadProjectionMatrix(G.MainCamera.projectionMatrix);
                        GL.modelview = G.MainCamera.worldToCameraMatrix;
                        GL.Begin(GL.LINES);
                        for (int i = TracerLines.Count - 1; i > -1; i--)
                        {
                            TracerObject t = TracerLines[i];
                            if (DateTime.Now - t.ShotTime > TimeSpan.FromSeconds(G.Settings.WeaponOptions.TracerTime))
                            {
                                TracerLines.Remove(t);
                                continue;
                            }

                            GL.Color(Colors.GetColor("Bullet_Tracer_Color"));

                            GL.Vertex(t.PlayerPos);
                            GL.Vertex(t.HitPos);
                        }
                        GL.End();
                        GL.PopMatrix();
                    }
                    #endregion
                    #region Damage Indicators
                    if (G.Settings.WeaponOptions.DamageIndicators && DamageIndicators.Count > 0)
                    {
                        T.DrawMaterial.SetPass(0);
                        for (int i = DamageIndicators.Count - 1; i > -1; i--)
                        {
                            IndicatorObject t = DamageIndicators[i];
                            if (DateTime.Now - t.ShotTime > TimeSpan.FromSeconds(3))
                            {
                                DamageIndicators.Remove(t);
                                continue;
                            }
                            GUI.color = Color.red;
                            Vector3 pos = G.MainCamera.WorldToScreenPoint(t.HitPos + new Vector3(0, 1, 0));
                            pos.y = Screen.height - pos.y;
                            if (pos.z >= 0)
                            {
                                GUIStyle style = GUI.skin.label;
                                style.alignment = TextAnchor.MiddleCenter;
                                Vector2 size = style.CalcSize(new GUIContent($"<b>{t.Damage}</b>"));
                                T.DrawOutlineLabel(new Vector2(pos.x - size.x / 2, pos.y - ((float)(DateTime.Now - t.ShotTime).TotalSeconds * 10)), Color.red, Color.black, $"<b>{t.Damage}</b>");
                                style.alignment = TextAnchor.MiddleLeft;
                            }
                            GUI.color = Main.GUIColor;
                        }
                    }
                    #endregion
                }
            }
        }