本文整理汇总了C#中GameInfo类的典型用法代码示例。如果您正苦于以下问题:C# GameInfo类的具体用法?C# GameInfo怎么用?C# GameInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GameInfo类属于命名空间,在下文中一共展示了GameInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Awake
void Awake ()
{
_gi = GetComponent<GameInfo> ();
switch (_gi.Level) {
case GameInfo.Difficulty.easy:
_modifier = 0.85f;
break;
case GameInfo.Difficulty.normal:
_modifier = 1.0f;
break;
case GameInfo.Difficulty.hard:
_modifier = 1.15f;
break;
}
_player = Instantiate (player, Vector3.zero, Quaternion.identity) as GameObject;
_missileLaunchers = new GameObject[4];
_spawnIndex = 0;
if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer) {
helpUI.GetComponent<Text> ().enabled = false;
restartUI.GetComponent<Text> ().text = "Tap to restart";
} else {
helpLeftUI.GetComponent<Text> ().enabled = false;
helpRightUI.GetComponent<Text> ().enabled = false;
}
score = GetComponent<Score> ();
}
示例2: SetNextId
public static void SetNextId( GameInfo gameInfo, Ship ship )
{
//islands.id = this.get_u32("islands id")+1;
//this.set_u32("islands id", islands.id);
ship.id = gameInfo.ShipsID+1;
gameInfo.ShipsID = ship.id;
}
示例3: ProducePart
public void ProducePart( GameInfo gameInfo, GameObject myGO, int amount = 1 )
{
int myGOTeam = myGO.GetComponent<Generic_Team>().TeamNum;
if (isServer)
{
List<GameObject> parts = new List<GameObject>();
for ( int i = 0; i < amount; i++ )
{
parts.Add(MakePart( new Vector2( i, 0 ), Vector2.zero, 0.0f, myGOTeam ));
}
List<GameObject> myGO_parts;
myGO_parts = myGO.GetComponent<Unit_PartPlacement>().parts;
myGO_parts.Clear();
int gOID = myGO.GetInstanceID();
//u16 playerID = blob.getPlayer().getNetworkID();
for (int i = 0; i < parts.Count; i++)
{
GameObject gO = parts[i];
myGO_parts.Add( gO );
gO.GetComponent<Part_Info>().OwnerID = gOID;
//b.set_u16( "playerID", playerID );
gO.GetComponent<Part_Info>().ShipID = -1; // don't push on ship
}
}
}
示例4: Start
void Start()
{
m_Count = 0;
board = GameObject.Find ("Board").GetComponent<Board> ();
player = GameObject.Find ("PlayerInput").GetComponent<PlayerInput>();
gameInfo = GameObject.Find ("GameInfo").GetComponent<GameInfo>();
}
示例5: AddBuilding
public static void AddBuilding(GameObject go, GameInfo.BuildingsTypes type)
{
if(type == GameInfo.BuildingsTypes.BunkRoom)
bunkRooms.Add(go);
if(type == GameInfo.BuildingsTypes.GreasySpoon)
greasySpoons.Add(go);
}
示例6: ChangeTo
public void ChangeTo(GameInfo.States state)
{
uSC.uMC.Reset();
if(state == GameInfo.States.Idle)
uSC.currentState = uSC.idle;
}
示例7: SetUp
public void SetUp()
{
GameInfo gameInfo = new GameInfo();
gameInfo.Mock();
this.Manager = new ScreensManager(gameInfo);
this.Screen1 = new Mock<Screen>("Screen1", ScreenType.Fullscreen);
this.Screen1.Setup(s => s.OnInit());
this.Screen1.Setup(s => s.OnDeinit());
this.Screen2 = new Mock<Screen>("Screen2", ScreenType.Popup);
this.Screen2.Setup(s => s.OnInit());
this.Screen2.Setup(s => s.OnDeinit());
this.Screen3 = new Mock<Screen>("Screen3", ScreenType.Normal);
this.Screen3.Setup(s => s.OnInit());
this.Screen3.Setup(s => s.OnDeinit());
this.Screen4 = new Mock<Screen>("Screen4", ScreenType.Normal);
this.Screen4.Setup(s => s.OnInit());
this.Screen4.Setup(s => s.OnDeinit());
this.Manager.Add(this.Screen1.Object);
this.Manager.Add(this.Screen2.Object);
this.Manager.Add(this.Screen3.Object);
this.Manager.Add(this.Screen4.Object);
this.ScreensList = new IScreen[]
{
this.Screen1.Object,
this.Screen2.Object,
this.Screen3.Object,
this.Screen4.Object
};
}
示例8: Update
/// <summary>
/// これがAIの動作の処理です。
/// gameInfoを用いて1フレームに与える指示を出してください。
/// HumanControllerも全く同じ仕組です
/// </summary>
/// <param name="gameInfo"></param>
/// <param name="input"></param>
public override void Update(GameInfo gameInfo, Input input)
{
//最初に必ずbaseのUpdateを呼び出してください
base.Update(gameInfo, input);
//攻撃する。
Attack();
//移動する(同じフレームでAttackが呼ばれているときはAttackが無条件で優先されます)
//複数回呼んだ場合最後のMoveが使われます。
Move(Direction.UP);
//gameInfoから自分のPlayerInfoを取得
PlayerInfo myInfo;
foreach (PlayerInfo info in gameInfo.PlayerInfos)
{
if (info.Index == PlayerIndex)
{
myInfo = info;
}
}
//おまけ:PlayerIndexをintにしたい!(キャラごとにユニークな値が取れるので乱数のシードなどに使えます)
int index = PlayerIndex - PlayerIndex.One;
}
示例9: PerformLogic
public IGameState[] PerformLogic(GameTime gameTime, GameInfo gameInfo)
{
var currentPlayer = gameInfo.CurrentPlayer;
bool reversing = currentPlayer.CurrentNode == currentPlayer.NextNode;
var currentLocation = currentPlayer.ActualLocation;
var targetLocation =
reversing
? currentPlayer.NextNode.GetTravelPosition(gameInfo.CurrentPlayerIndex, gameInfo.TotalPlayers)
: currentPlayer.NextNode.Center;
float newRotation;
Vector2 normalisedVector;
// If we've reached our destination
if (TravelTo(currentLocation, targetLocation, currentPlayer.Rotation, reversing, out normalisedVector, out newRotation)) {
// We have now reached the 'next' node, and thus it is our current node.
currentPlayer.CurrentNode = currentPlayer.NextNode;
return (!reversing && currentPlayer.RollAmount == 0) ? new IGameState[] { this } : null;
}
currentPlayer.ActualLocation += normalisedVector * MoveSpeed;
currentPlayer.Rotation = newRotation;
return new IGameState[] { this };
}
示例10: CalculateModifiedEffect
public int CalculateModifiedEffect(GameObject character, int initial, GameInfo.Stat stat, float modifierAmount)
{
float modifier = modifierAmount;
CharacterInfo characterInfo = character.GetComponent<CharacterInfo>();
switch (stat) {
case GameInfo.Stat.Strength:
modifier *= characterInfo.GetStrength();
break;
case GameInfo.Stat.Agility:
modifier *= characterInfo.GetAgility();
break;
case GameInfo.Stat.Intelligence:
modifier *= characterInfo.GetIntelligence();
break;
case GameInfo.Stat.Wisdom:
modifier *= characterInfo.GetWisdom();
break;
case GameInfo.Stat.Defense:
modifier *= characterInfo.GetDefense();
break;
default:
break;
}
return (int)(initial + modifier);
}
示例11: Start
void Start()
{
try
{
gameInfo = GameObject.Find("GameInfo").GetComponent<GameInfo>();
}
catch (Exception e)
{
}
if (gameInfo == null)
{
GameObject gameInfoObj = new GameObject("GameInfo");
UnityEngine.Object.DontDestroyOnLoad(gameInfoObj);
gameInfoObj.AddComponent<GameInfo>();
gameInfo = gameInfoObj.GetComponent<GameInfo>();
}
mapName = gameInfo.mapName;
sr = gameObject.GetComponent<SpriteRenderer>();
sr.sprite = Resources.Load<Sprite>("Sprites/Loading/loading_" + mapName + "_01");
beep1 = Resources.Load<AudioClip>("Sounds/Loading/loading_beep_01");
beep2 = Resources.Load<AudioClip>("Sounds/Loading/loading_beep_02");
beep3 = Resources.Load<AudioClip>("Sounds/Loading/loading_beep_03");
beep4 = Resources.Load<AudioClip>("Sounds/Loading/loading_beep_04");
frameCountSinceLvlLoad = 0;
SoundManager.instance.PlaySingle(beep1, false, 1f, 128, false);
}
示例12: PerformLogic
public override IGameState[] PerformLogic(GameTime gameTime, GameInfo gameInfo)
{
var currentPlayer = gameInfo.CurrentPlayer;
currentPlayer.CareerType = CareerType.CollegeCareer;
// Test if they're already taken the exam before
if (currentPlayer.PassedExam) {
return null;
}
var waitState = StateFactory.GetState(GameStates.GameStates.Wait);
if (currentPlayer.CurrentlyTakingExam) {
return TestPassedExamLogic(gameInfo, waitState);
}
if (currentPlayer.CareerType != CareerType.CollegeCareer) {
return CreateAlert(gameInfo, waitState, "You can only take an exam if you took college path", icon: "Images/AlertIcons/Fail");
}
// Strip their roll amount;
currentPlayer.RollAmount = 0;
// Set their taking exam boolean to be true
currentPlayer.CurrentlyTakingExam = true;
return TakeExamLogic(gameInfo);
}
示例13: idle
// ランダムに移動
void idle(GameInfo gameInfo)
{
if (gameInfo.GameTime.TotalGameTime.TotalMilliseconds - preActionTime > 200)
{
Random rnd = new Random((PlayerIndex - PlayerIndex.One)*100 + Environment.TickCount);
int act = rnd.Next(100);
act /= 25;
switch (act)
{
case 0:
nowDirection=Direction.UP;
break;
case 1:
nowDirection=Direction.RIGHT;
break;
case 2:
nowDirection=Direction.LEFT;
break;
case 3:
nowDirection=Direction.DOWN;
break;
}
preActionTime = gameInfo.GameTime.TotalGameTime.TotalMilliseconds;
}
Move(nowDirection);
return;
}
示例14: World
public World(GameInfo game, int size)
{
Game = game;
Size = size;
Cells = TerrainGenerator.generateCells(this);
BaseCell = Cells.Where(c => c.Type == CellType.Start).First();
ActiveCell = BaseCell;
FogOfWar = new FogOfWar(this);
var brush = Marooned.Instance.GetService<ContentCache>().Load<TiledBrush>("brush/base");
brush.Stamp(BaseCell, (Vector2.One * Cell.CELL_SIZE - brush.Bounds) / 2);
// TEMP: Debug
new UnitKekeke(BaseCell[10, 10]);
new UnitKekeke(BaseCell[23, 52]);
new UnitKekeke(BaseCell[5, 49]);
new UnitKekeke(BaseCell[40, 52]);
new UnitKekeke(BaseCell[36, 15]);
//for (int i = 0; i < game.ArtifactsTotal; ++i)
// new ItemArtifact(BaseCell[21, 20 + i]);
// Setup any entities created/etc....
foreach (var c in Cells) c.Update(new TimeSpan(0));
foreach (var u in BaseCell.Entities.Where(e => e is UnitCrew)
.Select(e => (UnitCrew)e))
u.IFF = IFFPlayer;
}
示例15: AddStatusEffect
public void AddStatusEffect(GameInfo.StatusEffect effectName, int duration, int magnitude, int addMagnitude, int removeMagnitude)
{
bool hasDuplicate = false;
GameObject duplicate = null;
StatusEffect duplicateEffect = null;
for (int i = 0; i < statusEffectList.Count; i++) {
if (statusEffectList[i].GetComponent<StatusEffect>().GetEffectName() == effectName) {
hasDuplicate = true;
duplicate = statusEffectList[i];
duplicateEffect = duplicate.GetComponent<StatusEffect>();
break;
}
}
if (hasDuplicate && duplicateEffect.maxStacks > 0 && (duplicateEffect.GetNumberOfStacks() < duplicateEffect.GetMaxStacks())) {
duplicateEffect.AddStack(duration, magnitude);
}
else {
GameObject newEffect = (GameObject)Instantiate(gameInfo.statusEffectList[(int)effectName], transform.position, Quaternion.identity);
newEffect.GetComponent<StatusEffect>().Initialize(duration, magnitude, addMagnitude, removeMagnitude);
newEffect.transform.parent = transform;
statusEffectList.Add(newEffect);
newEffect.GetComponent<StatusEffect>().AddStatusEffect();
}
}