Ejemplo n.º 1
0
    protected virtual void Hit(Unit unit, AttackProperties property)
    {
        status.hp -= property.damage + (property.damage * (unit.status.bustmodstate == 2 ? 0.1f : 0f));

        GameManager.Instance.SetFillAmount(transform.tag + "Hp", status.hp / 100f);

        if (status.hp < 30f)
        {
            BustMod(true);
        }

        GameManager.Instance.CreateHitParticle(transform.position);

        Vector2 knockback = property.hitProperties.knockback;

        knockback.x = knockback.x * (Attack.isRight ? -1f : 1f);

        transform.rotation = Quaternion.Euler(transform.eulerAngles.x, (unit.Attack.isRight ? 0f : 180f), transform.eulerAngles.z);

        Rigid.velocity = knockback;


        if (property.hitProperties.stun)
        {
            StartCoroutine(StunDelay(property.hitProperties.stuntime));
        }
        else
        {
            StartCoroutine(HitDelay(property.hitProperties.hitdelay));
        }
    }
Ejemplo n.º 2
0
    public void AttackColliderActive(AttackProperties proerties)
    {
        if (isactive)
        {
            Debug.LogError("Collider is already Actived");
            return;
        }

        if (activecollidername == proerties.name)
        {
            return;
        }

        for (int i = 0; i < colliders.Length; i++)
        {
            if (colliders[i].Name == proerties.name)
            {
                activecollidername = proerties.name;
                StartCoroutine(ColliderActive(colliders[i], proerties.fdelay, proerties.delay, proerties.during, proerties.times, proerties.damage));
                return;
            }
        }

        Debug.LogError("Collider is not Actived (collider is not founded)");
    }
Ejemplo n.º 3
0
 public void ReceiveAttackFeedback(AttackProperties attack, bool blocked)
 {
     if (!blocked)
     {
         playerState.LogAttackEvent(attack);
     }
 }
Ejemplo n.º 4
0
 private void SetOutputAttackProperties(AttackProperties attackProperty)
 {
     outputDamage    = attackProperty.damage;
     outputHitStun   = attackProperty.hitStun;
     outputBlockStun = attackProperty.blockStun;
     outputPushBack  = attackProperty.pushBack;
     outputBlockType = attackProperty.blockType;
 }
Ejemplo n.º 5
0
    public int PP(int startingPP)
    {
        AttackProperties attackprop = new AttackProperties();

        attackprop.AttackPP = startingPP; //This is will be used for the permanent max
        //currentPP for the attack's pp left
        return(attackprop.AttackPP);
    }
Ejemplo n.º 6
0
        public static AttackProperties ReadFrom(System.IO.BinaryReader reader)
        {
            var result = new AttackProperties();

            result.AttackRange     = reader.ReadInt32();
            result.Damage          = reader.ReadInt32();
            result.CollectResource = reader.ReadBoolean();
            return(result);
        }
Ejemplo n.º 7
0
        public static AttackProperties ReadFrom(System.IO.BinaryReader reader)
        {
            int  attackRange     = reader.ReadInt32();
            int  damage          = reader.ReadInt32();
            bool collectResource = reader.ReadBoolean();
            var  result          = new AttackProperties(attackRange, damage, collectResource);

            return(result);
        }
    public void ApplyAttack(AttackProperties attack, Transform instigator)
    {
        Vector3 attackDir = user.transform.position - instigator.position;
        attackDir.y = 0;

        Debug.LogWarning ("Attack has landed! Should deal "+attack.AdjustedDamageValue+" damage and "+attack.AdjustedImpactValue+" stun.");
        //Apply attack damage
        ApplyVitalUse (attack.AdjustedDamageValue, charStats.Health);
        //Apply attack stun
        ApplyHitStun (attack.AdjustedImpactValue, attackDir);
    }
Ejemplo n.º 9
0
        public MainWindowViewModel()
        {
            _connProperties    = new ConnectionProperties();
            _attackProperties  = new AttackProperties();
            _connectionService = new ConnectionService();

            //ONLY FOR TEST - DEVELOPMENT
            attackProperties.QueryText  = @"SELECT @@VERSION";
            connProperties.ServerName   = @"MARCIN\SQLEXPRESS";
            connProperties.DatabaseName = "CS";
            connProperties.User         = "******";
            connProperties.Password     = "******";

            ExecuteCommand = new CommandHandler(Execute, () => true);
            CreateConnectionStringCommand = new CommandHandler(ConnectToDatabase, () => true);
            DisconnectAndResetCommand     = new CommandHandler(DisconnectAndReset, () => true);
        }
        protected virtual IEnumerator DoAttack(AttackProperties attackProperties)
        {
            WaitForSeconds    hitTime    = new WaitForSeconds(attackProperties.hitTime);
            WaitForEndOfFrame endOfFrame = new WaitForEndOfFrame();
            RaycastHit        raycastHit;

            isAttacking  = true;
            delayTimer   = Time.time;
            currentDelay = attackProperties.delay;
            yield return(endOfFrame);

            weaponAnimator.SetAttack(-1);
            yield return(hitTime);

            if (Physics.Raycast(attackPoint.position, attackPoint.forward, out raycastHit, attackProperties.range))
            {
                Debug.Log(raycastHit.transform.name);
                if (decalProperties != null)
                {
                    DecalProperty decalProperty    = DecalHelper.GetDecalPropertyBySurface(decalProperties, raycastHit);
                    GameObject    decal            = decalProperty.GetRandomDecal();
                    AudioClip     decalSoundEffect = decalProperty.GetRandomSound();
                    if (decal != null)
                    {
                        PoolManager.Instantiate(decal, raycastHit.point, Quaternion.LookRotation(raycastHit.normal));
                    }
                    if (decalSoundEffect != null)
                    {
                        audioSource.PlayOneShot(decalSoundEffect);
                    }
                }

                Rigidbody rigidbody = raycastHit.transform.GetComponent <Rigidbody>();
                if (rigidbody != null)
                {
                    rigidbody.AddForceAtPosition(attackPoint.forward * attackProperties.impulse, raycastHit.point);
                }
            }
        }
Ejemplo n.º 11
0
    public void ReceiveAttack(HitCollider hitCollider, AttackProperties attack)
    {
        bool  blocked  = false;
        Moves nextMove = Moves.None;

        switch (playerState.CheckBlocking(attack.angle))
        {
        case true:
            nextMove = Moves.Blocking;
            blocked  = true;
            break;

        case false:
            nextMove = Moves.BeingHit;
            blocked  = false;
            playerHealth.TakeDamage(attack.damage);
            particle.Play();
            break;
        }
        playerState.SetStateTimer(nextMove, attack.hitStun, attack.blockStun, attack.angle);
        hitCollider.ReceiveAttackFeedback(attack, blocked);
    }
Ejemplo n.º 12
0
    public virtual void BulletHit(Unit unit, BulletAttackReport bullet)
    {
        AttackProperties property = GameManager.Instance.GetAttackProperties(unit.tag, bullet.name);

        Hit(unit, property);
    }
 public void SetAttackProperties(AttackProperties normalAttack, AttackProperties specialAttack)
 {
     this.normalAttack  = normalAttack;
     this.specialAttack = specialAttack;
 }
Ejemplo n.º 14
0
    public virtual void Hit(Unit unit)
    {
        AttackProperties property = GameManager.Instance.GetAttackProperties(unit.tag, unit.ColliderCtrl.ActiveColliderName);

        Hit(unit, property);
    }
 public void SetNormalAttackProperties(AttackProperties value)
 {
     normalAttack = value;
 }
 public void SetSpecialAttackProperties(AttackProperties value)
 {
     specialAttack = value;
 }
 public Attack(AttackProperties properties, GameObject[] targets)
 {
     this.properties = properties;
     this.targets    = targets;
     RollHits();
 }
Ejemplo n.º 18
0
 public void LogAttackEvent(AttackProperties attack)
 {
     PlayerAttacked(this, new EvolutionEventArgs(attack));
 }
Ejemplo n.º 19
0
 public EvolutionEventArgs(AttackProperties attack)
 {
     attackProperties = attack;
 }
 public Hit(AttackProperties properties, GameObject target)
 {
     this.properties = properties;
     this.target     = target;
     DeliverHit();
 }
Ejemplo n.º 21
0
 public EvolutionEventArgs(Moves move, AttackProperties attack)
 {
     loggedMoved      = move;
     attackProperties = attack;
 }