public override void Execute(GarageGames.Torque.T2D.T2DSceneObject puzzleObject) { this.puzzleObject = puzzleObject; ProcessList.Instance.AddTickCallback(puzzleObject, this); active = false; degrees = 0; }
protected override bool _OnRegister(GarageGames.Torque.Core.TorqueObject owner) { base._OnRegister(owner); // set the object type of the owner so other objects will know it's a player owner.SetObjectType(PlatformerData.PlayerObjectType, true); // create a new PlayerController and possess this actor with it PlayerController controller = new PlayerController(); controller.PossessMover(this); //float coolDown = 1000; // Setup attack timers attackActions = new PlayerActions(); attackActions.AddAction("lightAttack", lightAttackCoolDown); attackActions.AddAction("heavyAttack", heavyAttackCoolDown); attackActions.AddAction("baseShot", baseShotCoolDown); attackActions.AddAction("invincibility", invincibilityLength, new OnTimerEndDelegate(ToggleInvincibility)); punchMeleeTemplate = TorqueObjectDatabase.Instance.FindObject<T2DSceneObject>("punch"); swipeMeleeTemplate = TorqueObjectDatabase.Instance.FindObject<T2DSceneObject>("swipe"); // Temp. Add new collision types for the player and enemies //SceneObject.Collision.CollidesWith += PlatformerData.DamageTriggerObjecType; SceneObject.Collision.CollidesWith += ExtPlatformerData.EnemyDamageObjectType; SceneObject.Collision.CollidesWith += PlatformerData.EnemyObjectType; healthbar = new HealthBar_GUI(); healthbar.DisplayedHealth = (int)Health; healthbar.NumCollectedCrystals = 0; GUICanvas.Instance.SetContentControl(healthbar); #if TORQUE_CONSOLE CustomConsoleRoutinePool.Instance.RegisterMethod(HealPlayer); CustomConsoleRoutinePool.Instance.RegisterMethod(WarpToCheckpoint); #endif return true; }
protected override string _SetupEffect(GarageGames.Torque.SceneGraph.SceneRenderState srs, MaterialInstanceData materialData) { base._SetupEffect(srs, materialData); Effect.Instance.Parameters["Tint"].SetValue(tint); return "TintTechnique"; }
protected override void _SetupObjectParameters(GarageGames.Torque.RenderManager.RenderInstance renderInstance, GarageGames.Torque.SceneGraph.SceneRenderState srs) { base._SetupObjectParameters(renderInstance, srs); Matrix rotation = renderInstance.ObjectTransform; rotation.Translation = Vector3.Zero; _worldViewProjectionParameter.SetValue(renderInstance.ObjectTransform * srs.View * srs.Projection); _rotationParameter.SetValue(rotation); }
protected override void _SetupGlobalParameters(GarageGames.Torque.SceneGraph.SceneRenderState srs, MaterialInstanceData materialData) { base._SetupGlobalParameters(srs, materialData); _cubeTextureParameter.SetValue(_cubemap.Texture); }
protected override string _SetupEffect(GarageGames.Torque.SceneGraph.SceneRenderState srs, MaterialInstanceData materialData) { if (!_cubemap.IsInitialized) _cubemap.Create(_isDynamic, _cubemapSize, _camera); return base._SetupEffect(srs, materialData); }
public override void OnRender(Microsoft.Xna.Framework.Vector2 offset, GarageGames.Torque.MathUtil.RectangleF updateRect) { // Calculate size of health Vector2 tempSize = healthBar.Size; tempSize.X = maxHealthBarSize * ((float)health / 100); healthBar.Size = tempSize; // If dead dont draw anything if (tempSize.X == 0) healthBar.Style.IsOpaque = false; else healthBar.Style.IsOpaque = true; // update crystal count crystalText.Text = crystals.ToString(); base.OnRender(offset, updateRect); }