public Enemy(Level level, SceneGraphNode node, Vector3 relativeStartPos, Bullet.Factory createBullet) { Node = node; node.AssociatedObject = this; this.level = level; this.createBullet = createBullet; player = level.LocalPlayer; bodyNode = Node.CreateChild(); bodyNode.Relative = Matrix.Scaling(2, 2, 2) * Matrix.RotationZ(-(float)Math.PI * 0.05f); var bodyEnt = level.CreateEntityNode(bodyNode.CreateChild()); bodyEnt.Mesh = TW.Assets.LoadMesh("Scattered\\Models\\EnemyRobotParts\\Body"); sightNode = bodyNode.CreateChild(); sightEnt = level.CreateEntityNode(sightNode.CreateChild()); sightEnt.Mesh = TW.Assets.LoadMesh("Scattered\\Models\\EnemyRobotParts\\Sight_red"); tailNode = bodyNode.CreateChild(); tailNode.Relative = Matrix.Translation(new Vector3(0, -0.05f, 0)); tailEnt = level.CreateEntityNode(tailNode.CreateChild()); tailEnt.Mesh = TW.Assets.LoadMesh("Scattered\\Models\\EnemyRobotParts\\Tail"); propellorAxesNode = bodyNode.CreateChild(); propellorAxesNode.Relative = Matrix.Translation(new Vector3(-0.02f, -0.05f, 0)); var axesEnt = level.CreateEntityNode(propellorAxesNode.CreateChild()); axesEnt.Mesh = TW.Assets.LoadMesh("Scattered\\Models\\EnemyRobotParts\\PropellorAxes"); propellorLeftNode = propellorAxesNode.CreateChild(); propellorLeftNode.Relative = Matrix.Translation(new Vector3(-0.02f, 0.212f, 0.585f)); propLeftEnt = level.CreateEntityNode(propellorLeftNode.CreateChild()); propLeftEnt.Mesh = TW.Assets.LoadMesh("Scattered\\Models\\EnemyRobotParts\\Propellor"); propellorRightNode = propellorAxesNode.CreateChild(); propellorRightNode.Relative = Matrix.Translation(new Vector3(-0.02f, 0.212f, -0.585f)); propRightEnt = level.CreateEntityNode(propellorRightNode.CreateChild()); propRightEnt.Mesh = TW.Assets.LoadMesh("Scattered\\Models\\EnemyRobotParts\\Propellor"); Node.Relative = Matrix.Translation(relativeStartPos + new Vector3(0, idleHeight, 0)); currentHeight = idleHeight; Vector3 s; Quaternion r; Node.Absolute.Decompose(out s, out r, out currentPos); currentRotation = new Vector3(); newPos = currentPos; newRotation = currentRotation; startLocation = currentPos + new Vector3(0, patrolHeight - idleHeight, 0); LocalBoundingBox = new Vector3(2, 2, 2).CenteredBoundingbox(); level.AddBehaviour(node, update); }
public Tower(Level level, SceneGraphNode node) { this.level = level; Node = node; node.AssociatedObject = this; var ent = level.CreateEntityNode(node); ent.Mesh = TW.Assets.LoadMesh("Scattered\\Models\\Tower"); level.AddBehaviour(Node, stepBehaviour()); }
public JumpPad(Level level, SceneGraphNode node) { this.level = level; Node = node; node.AssociatedObject = this; var mesh = TW.Assets.LoadMesh("Scattered\\Models\\JumpPad"); var renderNode = node.CreateChild(); level.CreateEntityNode(renderNode).Alter(c => c.Mesh = mesh) .Alter(c => c.CreateInteractable(onInteract)); landingNode = node.CreateChild(); landingNode.Relative = Matrix.Translation(new Vector3(0, 2f, 5f)); level.AddBehaviour(node, update); }
public FlightEngine(Level level, SceneGraphNode node, ItemType coalType) { this.level = level; this.coalType = coalType; Node = node; node.AssociatedObject = this; var renderNode = node.CreateChild(); level.CreateEntityNode(renderNode.CreateChild()) .Alter(e => e.Node.Relative = Matrix.RotationY(-MathHelper.PiOver2) * Matrix.Translation(new Vector3(1.5f, 0, 0))) .Alter(ent => ent.Mesh = TW.Assets.LoadMesh("Scattered\\Models\\PropellorEngine")) .Alter(e => e.CreateInteractable(onInteract)); level.CreateEntityNode(renderNode.CreateChild()) .Alter(e => e.Node.Relative = Matrix.RotationY(-MathHelper.PiOver2) * Matrix.Translation(new Vector3(-1.5f, 0, 0))) .Alter(ent => ent.Mesh = TW.Assets.LoadMesh("Scattered\\Models\\PropellorEngine")) .Alter(e => e.CreateInteractable(onInteract)); level.AddBehaviour(node, update); }
public Resource(Level level, SceneGraphNode node, ItemType type) { this.level = level; this.Type = type; Node = node; node.AssociatedObject = this; var renderNode = node.CreateChild(); entityNode = level.CreateEntityNode(renderNode.CreateChild()) .Alter(k => k.Node.Relative = Matrix.Identity) .Alter(k => k.CreateInteractable(onInteract)); panelNode = level.CreateTextPanelNode(renderNode.CreateChild()); panelNode.Node.Relative = Matrix.Translation(0, 2.5f, 0); panelNode.TextRectangle.IsBillboard = true; panelNode.TextRectangle.Radius = 0.35f; Amount = 1; level.AddBehaviour(node, AttemptMerge); }