コード例 #1
0
ファイル: Floor.cs プロジェクト: totorogee/Shooter2019
 private void MousePressed(PosVector position)
 {
     if (AccpetInput)
     {
         EventManager.TriggerEvent(EventList.TilePressed, GetTileByPos(position));
     }
 }
コード例 #2
0
ファイル: PlaneShape.cs プロジェクト: MarkZuber/raynet
        public override IntersectionInfo Intersect(Ray ray)
        {
            var vd = Position.Dot(ray.Direction);

            if (vd >= 0.0)
            {
                return(new IntersectionInfo());
            }

            var t = -(Position.Dot(ray.Position) + _dval) / vd;

            if (t <= 0.0)
            {
                return(new IntersectionInfo());
            }

            var intersectPosition = ray.Position + ray.Direction * t;

            var u = 0.0;
            var v = 0.0;

            if (GetMaterial().HasTexture)
            {
                var vecU = new PosVector(Position.Y, Position.Z, -Position.X);
                var vecV = vecU.Cross(Position);
                u = intersectPosition.Dot(vecU);
                v = intersectPosition.Dot(vecV);
            }

            var color = GetMaterial().GetColor(u, v);

            return(new IntersectionInfo(color, t, Position, intersectPosition, Id));
        }
コード例 #3
0
 public IntersectionInfo(ColorVector color, double distance, PosVector normal, PosVector position, int elementId)
 {
     Color     = color;
     Distance  = distance;
     ElementId = elementId;
     Normal    = normal;
     Position  = position;
 }
コード例 #4
0
ファイル: MonsterManager.cs プロジェクト: bestans/unity_test
 public void Add(PosVector index, SceneGameObject obj)
 {
     if (monsterMap.ContainsKey(index))
     {
         Debug.LogError("duplicat index:x=" + index.x + ",y=" + index.y);
         return;
     }
     monsterMap.Add(index, obj);
 }
コード例 #5
0
ファイル: Floor.cs プロジェクト: totorogee/Shooter2019
    private Tile GetTileByPos(Tile starting, PosVector position)
    {
        if (Mathf.Abs(starting.Position.x + position.x) > (floorSetting.GroundWidth - 1) / 2)
        {
            return(null);
        }

        if (Mathf.Abs(starting.Position.y + position.y) > (floorSetting.GroundHeight - 1) / 2)
        {
            return(null);
        }

        return(TileList[starting.ID + position.y * floorSetting.GroundWidth + position.x]);
    }
コード例 #6
0
 public Light(PosVector position, ColorVector color)
 {
     Position = position;
     Color    = color;
     Id       = 0;
 }
コード例 #7
0
 public IntersectionInfo() : this(new ColorVector(0.0, 0.0, 0.0), double.MaxValue, PosVector.NewDefault(),
                                  PosVector.NewDefault(), 0)
 {
 }
コード例 #8
0
ファイル: PlaneShape.cs プロジェクト: MarkZuber/raynet
 public PlaneShape(PosVector position, double dval, BaseMaterial material) : base(position)
 {
     _dval     = dval;
     _material = material;
 }
コード例 #9
0
ファイル: Floor.cs プロジェクト: totorogee/Shooter2019
 public Tile GetTileByPos(PosVector position)
 {
     return(GetTileByPos(CenterTile, position));
 }
コード例 #10
0
ファイル: PointLight.cs プロジェクト: MarkZuber/raynet
 /// <inheritdoc />
 public PointLight(PosVector position, ColorVector color) : base(position, color)
 {
 }
コード例 #11
0
ファイル: Shape.cs プロジェクト: MarkZuber/raynet
 protected Shape(PosVector position)
 {
     Position = position;
     Id       = 0;
 }
コード例 #12
0
ファイル: Ray.cs プロジェクト: MarkZuber/raynet
 public Ray(PosVector pos, PosVector dir)
 {
     Position  = pos;
     Direction = dir;
 }