コード例 #1
0
        private new void TriggerEffect(object ths, TriggerEventArgs args)
        {
            Obstacle rockM = new Obstacles.Rock("rockM");
            Obstacle rockL = new Obstacles.PartialRock("rockL");
            Obstacle rockR = new Obstacles.PartialRock("rockR");

            rockL.Orientation = Orientations.Left;
            rockL.Orientation = Orientations.Right;

            rockM.CenterOn(this);
            rockL.CenterOn(this);
            rockR.CenterOn(this);

            rockM.Pos.Y += Tile.TileSize * Math.Sign(-Direction.Y);
            rockL.Pos.Y += Tile.TileSize * Math.Sign(-Direction.Y);
            rockR.Pos.Y += Tile.TileSize * Math.Sign(-Direction.Y);

            Vector3 normalDir = Vector3.Cross(new Vector3(this.Direction, 0), new Vector3(0, 0, -1));

            rockL.Pos.X -= Tile.TileSize * Math.Sign(-normalDir.X);
            rockR.Pos.X += Tile.TileSize * Math.Sign(-normalDir.X);

            this.Enabled = false;
        }
コード例 #2
0
ファイル: Trigger.cs プロジェクト: nemec/4Realms
        private new void TriggerEffect(object ths, TriggerEventArgs args)
        {
            Obstacle rockM = new Obstacles.Rock("rockM");
            Obstacle rockL = new Obstacles.PartialRock("rockL");
            Obstacle rockR = new Obstacles.PartialRock("rockR");
            rockL.Orientation = Orientations.Left;
            rockL.Orientation = Orientations.Right;

            rockM.CenterOn(this);
            rockL.CenterOn(this);
            rockR.CenterOn(this);

            rockM.Pos.Y += Tile.TileSize * Math.Sign(-Direction.Y);
            rockL.Pos.Y += Tile.TileSize * Math.Sign(-Direction.Y);
            rockR.Pos.Y += Tile.TileSize * Math.Sign(-Direction.Y);

            Vector3 normalDir = Vector3.Cross(new Vector3(this.Direction, 0), new Vector3(0, 0, -1));

            rockL.Pos.X -= Tile.TileSize * Math.Sign(-normalDir.X);
            rockR.Pos.X += Tile.TileSize * Math.Sign(-normalDir.X);

            this.Enabled = false;
        }