コード例 #1
0
    void FixedUpdate()
    {
        if (!entity.IsOwner)
        {
            return;
        }
        if (!mainPlayerMovementFSM.IsAttacking)
        {
            return;
        }

        Collider[] hits = Physics.OverlapSphere(weaponPosition.position, attackRadius, layerMask);
        if (hits.Length > 0)
        {
            for (int i = 0; i < hits.Length; ++i)
            {
                Collider hit = hits[i];
                if (hit.gameObject == gameObject)
                {
                    continue;
                }
                var serializer = hit.GetComponent <BoltEntity>();
                if (serializer != null && serializer.IsAttached && !serializer.GetState <IPenguinState>().IsDead)
                {
                    TakeDamage newEvent = TakeDamage.Create(serializer);
                    newEvent.Amount = 1;
                    newEvent.From   = entity;
                    newEvent.Send();
                }
            }
        }
    }