Example #1
0
        // エネミーに当たった時の反応
        protected void EnemyHit(GameObject other, ref Vector2 scale)
        {
            // 相手と自分の大きさの差が0.45f以下なら何もしない
            if (CompVector2.U_DifferenceValue(other.transform.Scale.X, scale.X) <= 0.45f)
            {
                return;
            }

            // 相手より自分の方が大きければ吸収
            if (other.transform.Scale.X < scale.X)
            {
                // エネミーのスケールを自分のスケールに足す(相手のスケールを5で割る:バランス調整)
                scale += other.transform.Scale / 5;
            }
            else
            {
                isDead = true;
            }
        }
Example #2
0
        /// <summary>
        /// プレイヤーと当たった時の処理
        /// </summary>
        /// <param name="other"></param>
        private void CharacterHit(GameObject other, ref Vector2 scale)
        {
            // 相手と自分の大きさの差が0.004f以下なら何もしない
            if (CompVector2.U_DifferenceValue(other.transform.Scale.X, scale.X) <= 0.45f)
            {
                return;
            }

            // 相手より自分の方が大きければ吸収
            if (other.transform.Scale.X < scale.X)
            {
                // エネミーのスケールを自分のスケールに足す(相手のスケールを2で割る:バランス調整)
                scale += other.transform.Scale / 5;

                // 将来的に敵の半径分を自機の半径に足す機構も作る
                //radius += new Vector2(((CircleCollision)other.GetCollision).Radius) / 2;
            }
            else
            {
                isDead = true;
            }
        }