//---------------------------------------------------------------------------------------------------------------------------------------------------
//
// Copyright (C)2007 DarkWynter Studios. All rights reserved.
//
//---------------------------------------------------------------------------------------------------------------------------------------------------
// {Contact : darkwynter.com for licensing information
//---------------------------------------------------------------------------------------------------------------------------------------------------
namespace DarkWynter.Engine.EventControl.EventTypes
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using DarkWynter.Engine.Init;
using DarkWynter.Engine.Utilities;
using DarkWynter.Engine.Globals;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Text;
using System.Xml;
///
/// Instance of the FogOfWarEvent
/// Extends GameEvent
/// Used to signal that an object's visibility needs to be changed
///
public class FogOfWarEvent : GameEvent
{
///
/// The nameID (arrow number, whatever) of the object you want to make visible
///
public int nameID { get { return _nameID; } set { _nameID = value; } }
public int _nameID;
///
/// The nameID of the second object you want to make visible
///
public int nameID2 { get { return _nameID2; } set { _nameID2 = value; } }
public int _nameID2;
public bool isRange { get { return _isRange; } set { _isRange = value; } }
public bool _isRange;
private List objectList = new List();
public FogOfWarEvent(XmlNode node)
:base(node)
{
this.nameID = int.Parse(node.Attributes["objectID"].Value);
this.nameID2 = int.Parse(node.Attributes["objectID2"].Value);
this.isRange = bool.Parse(node.Attributes["isRange"].Value);
foreach (GameObjects.GameObject gameObject in DarkWynterEngine.objectLibrary.gameObjectList)
{
if (gameObject.model == "Content/_models/arrow")
{
objectList.Add(gameObject);
}
}
}
///
/// Used to set an objects toDraw field
///
public override void FireEvent()
{
foreach (GameObjects.GameObject go in objectList)
{
go.toDraw = false;
}
if (isRange)
{
// Draw all the arrows between those two numbers
for (int x = nameID; x < nameID2 + 1; x++)
{
DarkWynterEngine.objectLibrary.gameObjectList[x].toDraw = true;
}
}
for (int x = 0; x < objectList.Count; x++ )
{
if (int.Parse(objectList[x].name) == this.nameID)
{
DarkWynterEngine.objectLibrary.gameObjectList[x+1].toDraw = true;
}
if (int.Parse(objectList[x].name) == this.nameID2)
{
DarkWynterEngine.objectLibrary.gameObjectList[x+1].toDraw = true;
}
}
this.isFinished = true;
//}
}
}
}