// CONSTRUCTORS ---------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="Crystallography.WildCardCrystallonEntity"/> class. /// </summary> /// <param name='pScene'> /// The Parent Scene. /// </param> /// <param name='pGamePhysics'> /// Instance of <c>GamePhysics</c> /// </param> /// <param name='pTextureInfo'> /// <see cref="Sce.PlayStation.HighLevel.GameEngine2D.Base.TextureInfo"/> /// </param> /// <param name='pTileIndex2D'> /// <see cref="Sce.PlayStation.HighLevel.GameEngine2D.Base.Vector2i"/> /// </param> /// <param name='pShape'> /// <see cref="Sce.PlayStation.HighLevel.Physics2D.PhysicsShape"/> /// </param> public WildCardCrystallonEntity(Scene pScene, GamePhysics pGamePhysics, int pId, PhysicsShape pShape) : base(pScene, pGamePhysics, pId, // pTextureInfo, pTileIndex2D, pShape) { Wild = true; Flash (); }
// CONSTRUCTOR --------------------------------------------------------------------- protected GroupManager() { availableGroups = new List<GroupCrystallonEntity>(); _scene = Director.Instance.CurrentScene; _physics = GamePhysics.Instance; Reset( _scene ); #if DEBUG Console.WriteLine(GetType().ToString() + " created" ); #endif }
// CONSTRUCTORS-------------------- /// <summary> /// Initializes a new instance of the <see cref="Crystallography.AbstractCrystallonEntity"/> class. /// </summary> /// <param name='pScene'> /// Reference to the current scene. /// </param> /// <param name='pGamePhysics'> /// Reference to the <see cref="Crystallography.GamePhysics"/>. /// </param> public AbstractCrystallonEntity( Scene pScene, GamePhysics pGamePhysics ) { GUID = Guid.NewGuid(); _scene = pScene; _physics = pGamePhysics; _offset = Vector2.Zero; #if DEBUG Console.WriteLine("{0} {1} created", this.GetType(), GUID); #endif }
// CONSTRUCTORS ---------------------------------------------------------- public NodeCrystallonEntity(Scene pScene, GamePhysics pGamePhysics, PhysicsShape pShape = null) : base(pScene, pGamePhysics) { _node = new Node(); if (pShape != null) { _body = _physics.RegisterPhysicsBody(pShape, 0.1f, 0.01f, _node.Position); } else { _body = null; } Scheduler.Instance.Schedule(_node, Update, 0, false, 0); }
// CONSTRUCTORS -------------------------------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="Crystallography.CardCrystallonEntity"/> class. /// </summary> /// <param name='pScene'> /// The Parent Scene. /// </param> /// <param name='pGamePhysics'> /// Instance of <c>GamePhysics</c> /// </param> /// <param name='pTextureInfo'> /// <see cref="Sce.PlayStation.HighLevel.GameEngine2D.Base.TextureInfo"/> /// </param> /// <param name='pTileIndex2D'> /// <see cref="Sce.PlayStation.HighLevel.GameEngine2D.Base.Vector2i"/> /// </param> /// <param name='pShape'> /// <see cref="Sce.PlayStation.HighLevel.Physics2D.PhysicsShape"/> /// </param> public CardCrystallonEntity(Scene pScene, GamePhysics pGamePhysics, int pId, PhysicsShape pShape) : base(pScene, pGamePhysics, pShape) { id = pId; _anim = null; GlowSprite = null; Scored = false; // _sprite.Scale*=CARD_SCALAR; _sprite.Position = new Vector2(-Width/2, -Height/2); _keepOnScreenTimer = -1.0f; setVelocity(DEFAULT_SPEED, GameScene.Random.NextAngle()); }
// CONSTRUCTOR --------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="Crystallography.CardManager"/> class. /// </summary> protected CardManager() { NextId = 0; availableCards = new List<CardCrystallonEntity>(); availableWildCards = new List<CardCrystallonEntity>(); _scene = Director.Instance.CurrentScene; _physics = GamePhysics.Instance; CubeCrystallonEntity.CubeCompleteDetected += HandleSelectionGroupInstanceCubeCompleteDetected; Reset (_scene); #if DEBUG Console.WriteLine(GetType().ToString() + " created" ); #endif }
// CONSTRUCTOR ----------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="Crystallography.GroupCrystallonEntity"/> class. /// </summary> /// <param name='pScene'> /// Instance of the parent scene. /// </param> /// <param name='pGamePhysics'> /// Instance of <c>GamePhysics</c> /// </param> /// <param name='pShape'> /// <see cref="Sce.PlayStation.HighLevel.Physics2D.PhysicsShape"/> /// </param> /// <param name='pMaxMembers'> /// <c>int</c> Maximum allowed population. Probs 3. 0 = no limit. /// </param> public GroupCrystallonEntity(Scene pScene, GamePhysics pGamePhysics, PhysicsShape pShape = null, int pMaxMembers=0, bool pComplete = false) : base(pScene, pGamePhysics, pShape) { _maxMembers = pMaxMembers; _numMembers = 0; members = new AbstractCrystallonEntity[_maxMembers]; _pucks = new Node[_maxMembers]; for (int i=0; i < _maxMembers; i++) { AddPuck(i); } complete = pComplete; }
// CONSTRUCTORS---------------------------------------------------------------------------- public SpriteTileCrystallonEntity( Scene pScene, GamePhysics pGamePhysics, PhysicsShape pShape = null) : base(pScene, pGamePhysics, pShape) { // SPRITE STUFF _orientationIndex = 0; _patternIndex = 0; // _sprite = new SpriteTile(pTextureInfo); _sprite = new SpriteTile(); // _sprite.Scale = _sprite.CalcSizeInPixels(); _node.AddChild(_sprite); // PHYSICS STUFF // if (pShape != null) { // _body = _physics.RegisterPhysicsBody(pShape, 0.1f, 0.01f, _sprite.Position); // } else { // _body = null; // } // Scheduler.Instance.Schedule(_sprite, Update, 0.0f, false); }
// CONSTRUCTORS -------------------------------------------------------- public CubeCrystallonEntity(Scene pScene, GamePhysics pGamePhysics, PhysicsShape pShape = null ) : base(pScene, pGamePhysics, pShape, 3, true) { // setVelocity(DEFAULT_SPEED, GameScene.Random.NextAngle()); }
// CONSTRUCTOR ---------------------------------------------------------------------------------- public GameScene( GameSceneData pData ) { gameTimeLimit = pData.timeLimit; this.AddChild( BackgroundLayer = new Layer() ); this.AddChild( GameplayLayer = new Layer() ); this.AddChild( ForegroundLayer = new Layer() ); this.AddChild( DialogLayer = new Layer() ); Layers = new Layer[] {BackgroundLayer, GameplayLayer, ForegroundLayer, DialogLayer}; Touch.GetData(0).Clear(); InputManager.Instance.Reset(); currentLevel = pData.level; this.Camera.SetViewFromViewport(); _physics = GamePhysics.Instance; Hud = new Crystallography.UI.GameSceneHud(this); if (gameTimeLimit > 0.0f) { Hud.SetGameTimeLimit(gameTimeLimit); } ForegroundLayer.AddChild(Hud); SG = SelectionGroup.Instance; SG.Reset( this ); ForegroundLayer.AddChild(SG.getNode()); #if DEBUG // This is debug routine that will draw the physics bounding box around all physics bodies if(DEBUG_BOUNDINGBOXS) { this.AdHocDraw += () => { foreach (ICrystallonEntity e in _allEntites) { if (e is SpriteTileCrystallonEntity) { // Node n = e.getNode(); // Vector2 halfDimensions = new Vector2((e as SpriteTileCrystallonEntity).Width, (e as SpriteTileCrystallonEntity).Height) /4.0f; // var bl = n.Position - halfDimensions; // var tr = n.Position + halfDimensions; Director.Instance.DrawHelpers.DrawBounds2( e.getBounds() ); } } // foreach (PhysicsBody pb in _physics.SceneBodies) { // if ( pb != null ) { // var bottomLeft = pb.AabbMin; // var topRight = pb.AabbMax; // Director.Instance.DrawHelpers.DrawBounds2Fill ( // new Bounds2(bottomLeft*GamePhysics.PtoM, topRight*GamePhysics.PtoM)); // } // } }; this.AdHocDraw += () => { var s = SelectionGroup.Instance.getNode().Position; var bl = s - (20*Vector2.One); var tr = s + (20*Vector2.One); Director.Instance.DrawHelpers.DrawBounds2Fill( new Bounds2(bl,tr) ); }; this.AdHocDraw += () => { // var s = SelectionGroup.Instance.getPosition() - SelectionGroup.Instance.heading.Normalize() * FMath.Max( 80.0f, FMath.Min(120.0f, (120.0f * SelectionGroup.Instance.velocity/100.0f))); var s = SelectionGroup.Instance.getNode().LocalToWorld( SelectionGroup.UP_LEFT_SELECTION_POINT ); var bl = s - (2*Vector2.One); var tr = bl + (4*Vector2.One); Director.Instance.DrawHelpers.DrawBounds2Fill( new Bounds2(bl,tr) ); }; this.AdHocDraw += () => { var s = SelectionGroup.Instance.getNode().LocalToWorld( SelectionGroup.UP_RIGHT_SELECTION_POINT ); var bl = s - (2*Vector2.One); var tr = bl + (4*Vector2.One); Director.Instance.DrawHelpers.DrawBounds2Fill( new Bounds2(bl,tr) ); }; this.AdHocDraw += () => { var s = SelectionGroup.Instance.getNode().LocalToWorld( SelectionGroup.LEFT_UP_SELECTION_POINT ); var bl = s - (2*Vector2.One); var tr = bl + (4*Vector2.One); Director.Instance.DrawHelpers.DrawBounds2Fill( new Bounds2(bl,tr) ); }; this.AdHocDraw += () => { var s = SelectionGroup.Instance.getNode().LocalToWorld( SelectionGroup.RIGHT_UP_SELECTION_POINT ); var bl = s - (2*Vector2.One); var tr = bl + (4*Vector2.One); Director.Instance.DrawHelpers.DrawBounds2Fill( new Bounds2(bl,tr) ); }; } #endif Scheduler.Instance.ScheduleUpdateForTarget(this,0,false); Pause (false); Sequence sequence = new Sequence(); sequence.Add( new DelayTime(0.1f) ); sequence.Add( new CallFunc( () => ResetToLevel() ) ); this.RunAction(sequence); ForegroundLayer.AddChild( Support.ParticleEffectsManager.Instance ); #if METRICS DataStorage.AddMetric("Level", () => currentLevel, 1); #endif }
public void Destroy() { availableCards.Clear (); availableCards = null; availableWildCards.Clear (); availableWildCards = null; DeckOfIDs.Clear(); DeckOfIDs = null; _instance = null; _scene = null; _physics = null; }