Exemplo n.º 1
0
        void BtnSaVE_Clicked(object sender, EventArgs e)
        {
            DamageArea retArea = listArea.FirstOrDefault(a => a.Area == GetEditItemValue("Area"));

            if (retArea != null)
            {
                damage.AreaID     = retArea.ID;
                damage.AreaSideID = retArea.AreaSideID;
                damage.Area       = retArea.Area;
            }

            DamageType retType = listType.FirstOrDefault(t => t.TypeName == GetEditItemValue("Type"));

            if (retType != null)
            {
                damage.TypeID   = retType.ID;
                damage.TypeName = retType.TypeName;
            }

            damage.Length = 0;
            string len = GetEditItemValue("Length-Inches");

            if (!string.IsNullOrWhiteSpace(len) && len.ToInt() > 0)
            {
                damage.Length = len.ToInt();
            }

            damage.Comments   = tvComments.Text;
            damage.CategoryID = categoryid;
            damage.VehicleID  = vehicleid;

            Validate();
        }
Exemplo n.º 2
0
 /// <summary>
 /// The "reaction" script to a damage area contacting a creep.
 /// </summary>
 /// <param name="db"></param>
 public void GetShot(DamageArea db)
 {
     db.OnHit(this);
     //
     //
     TakeDamage(db.isSustained ? db.power / Helper.SECOND : db.power);
     //
     db.BreakUp(1);
 }
Exemplo n.º 3
0
 public Damage(int _min, int _max, DamageType _dt, int _ap, DamageArea _da, int deviation)
 {
     this.min = _min;
     this.max = _max;
     this.dt  = _dt;
     this.armourPenetration = _ap;
     this.da        = _da;
     this.deviation = deviation;
 }
Exemplo n.º 4
0
    private void OnEnable()
    {
        source    = (DamageArea)target;
        sourceRef = serializedObject;

        //set styles
        boldStyle.fontStyle = FontStyle.Bold;

        ResetAreYouSures();
        GetProperties();
    }
Exemplo n.º 5
0
 /// <summary>
 /// The function that is subscribed when StartAttack(animation) is called..
 /// when RaiseAttack# is called by the animation that startAttack plays,
 /// that animation will call a trigger that calls RaiseAttack#
 /// Which in turn calls this
 /// </summary>
 void OnSmash()
 {
     //Instantiate an growing area of effect
     dmgArea = ((GameObject)Instantiate(this.effectArea, new Vector3(this.myProperties.attackArea.position.x,0.1f, this.myProperties.attackArea.position.z), Quaternion.identity)).GetComponent<DamageArea>();
     dmgArea.Init(this.myProperties.damage, this.growthTime, this.myProperties.attackRadius, this);
     if (this.myAI.myProperties.myMovement.myProperties.myAgent.isOnNavMesh)
     {
         this.myAI.myProperties.myMovement.myProperties.myAgent.Resume(); //we can walk after he does that
     }
     
 }
Exemplo n.º 6
0
    /// <summary>
    /// Passes out and "spawns" a DamageArea instance.
    /// Essentially Object Pooling code.
    /// </summary>
    /// <returns>Returns a DamageArea</returns>
    public DamageArea Supply()
    {
        DamageArea da = weaponCache[weaponIndex];

        //
        weaponIndex = (weaponIndex + 1) % weaponCache.Count;
        //
        da.OnSpawn();
        //
        //
        return(da);
    }
    private void Start()
    {
        _div = (16.0f / 9.0f) / ((float)Screen.height / Screen.width);

        damageArea = transform.Find("DamageArea").gameObject;
        _damageAreaDamageSystem = damageArea.GetComponent <DamageArea>();
        _damageAreaCollider     = damageArea.GetComponent <PolygonCollider2D>();
        for (var i = 0; i < _damageAreaCollider.points.Length; ++i)
        {
            _damageAreaCollider.points[i] *= _div;
        }
        damageArea.SetActive(false);
        swordSprite = transform.Find("Sword").gameObject.GetComponent <SpriteRenderer>();
        SetSword(new DefaultSword());
        camera = Camera.main;
    }
Exemplo n.º 8
0
    public void DealDamageAt(Entity victim, int amount, Vector3 hitPoint, Vector3 hitNormal, Collider hitCollider)
    {
        Combat victimCombat = victim.combat;

        if (victim.health.current > 0)
        {
            DamageArea damageArea       = hitCollider.GetComponent <DamageArea>();
            float      multiplier       = damageArea != null ? damageArea.multiplier : 1;
            int        amountMultiplied = Mathf.RoundToInt(amount * multiplier);
            int        damageDealt      = Mathf.Max(amountMultiplied - victimCombat.defense, 1);
            victim.health.current -= damageDealt;
            victimCombat.onServerReceivedDamage.Invoke(entity, damageDealt);
            victimCombat.RpcOnReceivedDamage(damageDealt, hitPoint, hitNormal);
            lastCombatTime = NetworkTime.time;
            victimCombat.lastCombatTime = NetworkTime.time;
        }
    }
Exemplo n.º 9
0
        private void OpenListScreen(string ItemName, string[] data, bool isSearchable)
        {
            if (ItemName == "Type")
            {
                string     selectedArea = GetEditItemValue("Area");
                DamageArea area         = listArea.FirstOrDefault(a => a.Area == selectedArea);
                if (string.IsNullOrWhiteSpace(selectedArea) || area == null)
                {
                    Controls.OkDialog("Area is Required", "You must select a damage area first");
                    return;
                }

                List <int> listTypeIDs = listAreaType.Where(t => t.AreaID == area.ID).Select(t => t.TypeID).ToList();
                data = listType.Where(t => listTypeIDs.Contains(t.ID)).Select(t => t.TypeName).ToArray();
            }

            PresentModalViewController(new ListScreenController(SetEditItemValue, data, ItemName), true);
        }
Exemplo n.º 10
0
        public override void _Process(float delta)
        {
            if (IsFrozen)
            {
                PlayerAnimation.Stop();
            }
            else
            {
                PlayerAnimation.Play();
            }

            base._Process(delta);

            if (!IsFrozen && IsAlive)
            {
                // ReSharper disable once CompareOfFloatsByEqualityOperator
                if (PlayerInput.MoveVector.Length() == 1)
                {
                    Facing = PlayerInput.MoveVector;
                }

                PushSensor.CastTo = Facing * 6;
                PushSensor.ForceRaycastUpdate();

                UpdatePlayerAnimation();
                UpdatePushing();

                if (DamageArea.Monitoring)
                {
                    foreach (var body in DamageArea.GetOverlappingBodies().Cast <Node>())
                    {
                        /* Allow sword to pick up items */
                        _on_ItemDetector_body_entered(body);

                        if (!(body is IDamageable damageable))
                        {
                            continue;
                        }
                        damageable.Damage(Facing);
                    }
                }
            }
        }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.CompareTag("Indestructible"))
        {
            if (detonable)
            {
                if (explodeSound != null)
                {
                    AudioSource.PlayClipAtPoint(explodeSound, new Vector3(0, 0, 0), volume);
                }
                GameObject damageArea = new GameObject();
                damageArea.transform.position = transform.position;
                damageArea.AddComponent <DamageArea>();
                damageArea.GetComponent <DamageArea>().radius   = 3f;
                damageArea.GetComponent <DamageArea>().lifetime = 1f;
            }
            Destroy(gameObject);
        }
        //友方子弹
        else if (CompareTag("Friendly Bullet"))
        {
            if (collision.CompareTag("Enemy"))
            {
                //致伤
                Enemy enemy = collision.GetComponent <Enemy>();
                enemy.BeAttacked(damage, d * transform.right * impactForce);

                if (detonable)
                {
                    if (explodeSound != null)
                    {
                        AudioSource.PlayClipAtPoint(explodeSound, new Vector3(0, 0, 0), volume);
                    }
                    GameObject damageArea = new GameObject();
                    damageArea.transform.position = transform.position;
                    damageArea.AddComponent <DamageArea>();
                    DamageArea d = damageArea.GetComponent <DamageArea>();
                    d.radius     = 3f;
                    d.lifetime   = 0.1f;
                    d.damage     = damage;
                    d.enemyDmg   = true;
                    d.noInterval = false;
                }
                Destroy(gameObject);
            }
        }
        //敌方子弹
        else if (CompareTag("Hostile Bullet"))
        {
            if (collision.CompareTag("Player") || collision.CompareTag("Retinue"))
            {
                if (collision.CompareTag("Player") && collision.GetComponent <Player>().status == 2)
                {
                    return;
                }
                //致伤
                Player player = collision.GetComponent <Player>();
                player.BeAttacked(damage, d * transform.right * impactForce);

                if (detonable)
                {
                    if (explodeSound != null)
                    {
                        AudioSource.PlayClipAtPoint(explodeSound, new Vector3(0, 0, 0), volume);
                    }
                    GameObject damageArea = new GameObject();
                    damageArea.transform.position = transform.position;
                    damageArea.AddComponent <DamageArea>();
                    DamageArea d = damageArea.GetComponent <DamageArea>();
                    d.radius    = 3f;
                    d.lifetime  = 0.1f;
                    d.damage    = damage;
                    d.friendDmg = true;
                }
                Destroy(gameObject);
            }
        }
    }
Exemplo n.º 12
0
 private void Awake()
 {
     //Cache
     damageArea = GetComponentInChildren <DamageArea>();
 }