Пример #1
0
    public DamageContainer ReferDamage()  //ダメージを読む
    {
        DamageContainer answer = new DamageContainer(best.a, status[best.a],
                                                     best.b, status[best.b]);

        return(answer);
    }
Пример #2
0
    public void Set(Vector2 position, float time, Vector2 direction, float damage, float speed = 10)
    {
        cameraController = FindObjectOfType <CameraController>();
        audioSource      = GetComponent <AudioSource>();
        trail            = GetComponent <ParticleSystem>();
        shockwave        = transform.Find("ShockwaveSpikes").GetComponent <ParticleSystem>();
        damageContainer  = GetComponent <DamageContainer>();
        collider         = GetComponentInChildren <Collider2D>();
        terrainMask      = 1 << LayerMask.NameToLayer("Terrain");
        damageContainer.SetDamageCall(() => damage);

        this.speed         = speed;
        this.timer         = time;
        this.direction     = direction;
        transform.position = position;

        RaycastHit2D hit = GetGroundHit();

        if (hit)
        {
            transform.position = hit.point;
        }

        trail.Play();
        shockwave.Play();
        audioSource.clip = soundLoop;
        audioSource.loop = true;
        audioSource.Play();
    }
Пример #3
0
 public override void FillFrom(ISlice other)
 {
     if (other is DamageFire @base)
     {
         m_ViewPrefab = @base.m_ViewPrefab;
         m_Damages    = new List <IDamage>(@base.m_Damages);
     }
 }
 public static void Postfix(Player __instance, float dt, ref DamageContainer __state)
 {
     if (__state != null)
     {
         var currentWeapon = __instance.GetCurrentWeapon();
         currentWeapon.m_shared.m_damages         = __state.damage;
         currentWeapon.m_shared.m_damagesPerLevel = __state.damagePerLevel;
     }
 }
Пример #5
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag(playerWeaponTag) && state != State.Dead)
     {
         DamageContainer damageContainer = other.GetComponentInParent <DamageContainer>();
         GetHit(transform.position.x < other.transform.position.x,
                damageContainer.GetDamage());
     }
 }
Пример #6
0
    private void StandardStart()
    {
        hitList = new List <GameObject>();

        damageContainer = default;

        startTime      = Time.fixedTime;
        lastAttackTime = Time.fixedTime;
    }
 void Awake()
 {
     animator        = GetComponent <Animator>();
     rb              = GetComponent <Rigidbody2D>();
     coll            = GetComponent <CapsuleCollider2D>();
     spriteRenderer  = GetComponent <SpriteRenderer>();
     damageContainer = GetComponent <DamageContainer>();
     player          = GetComponent <Player>();
 }
 public void Set(Vector3 position, float damage)
 {
     damageContainer        = GetComponent <DamageContainer>();
     spriteRenderer         = GetComponent <SpriteRenderer>();
     circleCollider         = GetComponent <CircleCollider2D>();
     animator               = GetComponent <Animator>();
     circleCollider.enabled = false;
     damageContainer.SetDamageCall(() => damage);
     DisableCollider();
 }
    //バランス調整の時にこちらの計算式に注目!!!
    public float reserveDamage(DamageContainer damage)
    {
        float damageIReserved = 0;

        damageIReserved  = defence[damage.typeA] - damage.typeADam;
        damageIReserved += defence[damage.typeB] - damage.typeBDam;

        /*まだ決めてないけど、この後修正値を渡すかもしれない*/

        return(damageIReserved);
    }
Пример #10
0
    protected void Initialize()
    {
        rb              = GetComponent <Rigidbody2D>();
        renderer        = GetComponent <SpriteRenderer>();
        coll            = GetComponent <CapsuleCollider2D>();
        animator        = GetComponent <Animator>();
        damageContainer = GetComponent <DamageContainer>();
        target          = FindObjectOfType <Player>().transform;
        List <Collider2D> colls = new List <Collider2D>();

        foreach (var c in transform.Find("DamagePCHitbox").GetComponents <Collider2D>())
        {
            colls.Add(c);
        }
        bodyWeaponColliders = colls.ToArray();
        itemSpawner         = GetComponent <ItemSpawner>();
        xRayLength          = 0.05f;
        yRayLength          = 0.05f;
        originalScale       = transform.localScale;
        aliveColor          = renderer.color;
    }
Пример #11
0
 void Awake()
 {
     player          = FindObjectOfType <Player>();
     spriteRenderer  = GetComponent <SpriteRenderer>();
     damageContainer = GetComponent <DamageContainer>();
 }
        public static bool Prefix(Player __instance, float dt, ref DamageContainer __state)
        {
            if (__instance.InPlaceMode())
            {
                return(true);
            }

            if (__instance.m_rightItem == null)
            {
                return(true);
            }
            string weaponName = __instance.m_rightItem.m_dropPrefab?.name;

            if (weaponName != null & weaponName.Trim() != "")
            {
                if (MyReferences.myListOfExtraAttacks.ContainsKey(weaponName.GetStableHashCode()))
                {
                    bool attack3Input = false;
                    try
                    {
                        if (attack3Hotkey.Value.Length > 0 && Input.GetKey(attack3Hotkey.Value.ToLower()))
                        {
                            attack3Input = true;
                        }
                    }
                    catch (Exception)
                    {
                        if (!invalidKeyAttack3)
                        {
                            Plugin.Log.LogError("You bound an invalid key code for 'attack 3' that Unity cannot recognize. Check the config file.");
                            invalidKeyAttack3 = true;
                        }
                    }

                    if (attack3Input)//__instance.IsBlocking() && __instance.m_secondaryAttack
                    {
                        __instance.AbortEquipQueue();
                        if ((__instance.InAttack() && !__instance.HaveQueuedChain()) ||
                            __instance.InDodge() || !__instance.CanMove() ||
                            __instance.IsKnockedBack() || __instance.IsStaggering() ||
                            __instance.InMinorAction())
                        {
                            return(true);
                        }

                        if (__instance.m_currentAttack != null)
                        {
                            __instance.m_currentAttack.Stop();
                            __instance.m_previousAttack = __instance.m_currentAttack;
                            __instance.m_currentAttack  = null;
                        }

                        //ItemDrop.ItemData currentWeapon = __instance.m_unarmedWeapon.m_itemData;
                        Attack attack        = MyReferences.myListOfExtraAttacks[weaponName.GetStableHashCode()].Clone();
                        var    currentWeapon = __instance.GetCurrentWeapon();
                        //if(currentWeapon.m_shared.m_icons[0].name.Contains("MaceCoreGreatHTD_Icon"))
                        //{
                        //__state = new DamageContainer(currentWeapon);
                        //currentWeapon.m_shared.m_damages = new HitData.DamageTypes { m_frost = 100f };
                        //currentWeapon.m_shared.m_damagesPerLevel = new HitData.DamageTypes { m_frost = 30f };
                        //}


                        if (attack.Start(__instance, __instance.m_body, __instance.m_zanim, __instance.m_animEvent, __instance.m_visEquipment, currentWeapon, __instance.m_previousAttack, __instance.m_timeSinceLastAttack, 0F))
                        {
                            __instance.m_currentAttack   = attack;
                            __instance.m_lastCombatTimer = 0f;
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
Пример #13
0
 public void SufferDamage(DamageContainer damage)
 {
     hitPoint -= (int)physicalProtectiveSystem.reserveDamage(damage);
     CheckAlive();
 }