1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Linq課題1

Posted at

課題
GetMaxAtk関数に処理を追記して、仕様を満たすようにしてください。(Linqを使うこと)

using UnityEngine;
using System;
using System.Collections.Generic;

public class StudyLinq : MonoBehaviour
{

	public List<Character> charaList = new List<Character> ();

	void Start ()
	{
		charaList.Add (new Character () { m_hp = 100, m_atk = 20, m_name = "太郎", m_isDead = false });
		charaList.Add (new Character () { m_hp = 344, m_atk = 50, m_name = "花子", m_isDead = false });
		charaList.Add (new Character () { m_hp = 288, m_atk = 70, m_name = "ぼっちゃん", m_isDead = false });
		charaList.Add (new Character () { m_hp = 399, m_atk = 80, m_name = "ジョブス", m_isDead = true });

		var result = GetMaxAtk (charaList);
		Debug.Log (result);

	}

	/// <summary>
	/// 生き残っているキャラの中で一番HPが高い奴の攻撃力のを返す関数
	/// </summary>
	int GetMaxAtk (List<Character> list)
	{
		return -1;
	}
}

[Serializable]
public class Character
{
	public int m_hp;
	public int m_atk;
	public string m_name;
	public bool m_isDead;

}
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?