Esempio n. 1
0
    IEnumerator generateCopies()
    {
        int     randPlace;
        Vector3 newPos;

        //Pour chaque clone à créer :
        for (int i = 1; i <= nbClones; i++)
        {
            //On choisit une place parmi ceux libres.
            randPlace = Random.Range(0, remaining - 1);
            ORIENTATION o = setNeighbor(randPlace);
            newPos = getPositionNewCopy(o);
            GameObject g = GameObject.Instantiate(gameObject, newPos, gameObject.transform.rotation);
            g.SetActive(false);
            g.name = g.tag + "-" + generationsLeft + "-" + i;
            Destroy(g.GetComponent <MG_Life_Cube>());
            foreach (Transform child in g.transform)
            {
                Destroy(child.gameObject);
            }
            neighbors[(int)o] = g;
            remaining--;
            g.GetComponent <MG_Life_Clone>().setInitialNeighbor(gameObject, o);
            g.GetComponent <MG_Life_Clone>().setGenLeft(generationsLeft - 1);
            g.hideFlags = HideFlags.HideInHierarchy;
            g.SetActive(true);
            yield return(new WaitForSeconds(0.25f));
        }
        System.Array.Clear(neighbors, 0, neighbors.Length);
    }
Esempio n. 2
0
    void Roll(ORIENTATION face)
    {
        switch (face)
        {
        case ORIENTATION.SIDEWAYS_LEFT:
            rbody.AddRelativeTorque(new Vector3(0, 0, rollForce), ForceMode.Acceleration);
            break;

        case ORIENTATION.SIDEWAYS_RIGHT:
            rbody.AddRelativeTorque(new Vector3(0, 0, -rollForce), ForceMode.Acceleration);
            break;

        case ORIENTATION.UPSIDE_DOWN:
            rbody.AddRelativeTorque(new Vector3(2.0f * rollForce, 0, 0), ForceMode.Acceleration);
            break;

        case ORIENTATION.FACE_DOWN:
            rbody.AddRelativeTorque(new Vector3(-rollForce, 0, 0), ForceMode.Acceleration);
            break;

        case ORIENTATION.ON_BACK:
            rbody.AddRelativeTorque(new Vector3(rollForce, 0, 0), ForceMode.Acceleration);
            break;
        }
    }
Esempio n. 3
0
    //Retourne la position de la future copie à créer, selon l'orientation passée en paramètre,
    //de telle sorte qu'elle se trouve "collée" à la face de l'objet courant correspondant.
    //(Exemple : ORIENTATION.UP -> Sur la face supérieure de l'objet courant)
    private Vector3 getPositionNewCopy(ORIENTATION o)
    {
        Vector3 res = gameObject.transform.position, dim = gameObject.transform.lossyScale;

        switch (o)
        {
        case ORIENTATION.UP:
            res = new Vector3(res.x, res.y + dim.y, res.z);
            break;

        case ORIENTATION.DOWN:
            res = new Vector3(res.x, res.y - dim.y, res.z);
            break;

        case ORIENTATION.LEFT:
            res = new Vector3(res.x - dim.x, res.y, res.z);
            break;

        case ORIENTATION.RIGHT:
            res = new Vector3(res.x + dim.x, res.y, res.z);
            break;

        case ORIENTATION.FORWARD:
            res = new Vector3(res.x, res.y, res.z + dim.z);
            break;

        case ORIENTATION.BACKWARD:
            res = new Vector3(res.x, res.y, res.z - dim.z);
            break;
        }
        return(res);
    }
Esempio n. 4
0
    // Transform an angle into ORIENTATION
    public static ORIENTATION AngleToOrientation(float angle, ORIENTATION origin = ORIENTATION.NORTH)
    {
        int roundAngle = (int)Mathf.Round(angle / 90.0f);

        switch (origin)
        {
        case ORIENTATION.NORTH: roundAngle += 0; break;

        case ORIENTATION.EAST: roundAngle += 1; break;

        case ORIENTATION.SOUTH: roundAngle += 2; break;

        case ORIENTATION.WEST: roundAngle += 3; break;
        }
        roundAngle = roundAngle % 4;
        if (roundAngle < 0)
        {
            roundAngle += 4;
        }
        switch (roundAngle)
        {
        case 0: return(ORIENTATION.NORTH);

        case 1: return(ORIENTATION.EAST);

        case 2: return(ORIENTATION.SOUTH);

        case 3: return(ORIENTATION.WEST);

        default: return(ORIENTATION.NONE);
        }
    }
Esempio n. 5
0
        private Sprite CreateSprite(ORIENTATION orientation)
        {
            string texturePath = "./assets/img/agent-";

            switch (orientation)
            {
            case Agent.ORIENTATION.North:
                texturePath += "north";
                break;

            case Agent.ORIENTATION.East:
                texturePath += "east";
                break;

            case Agent.ORIENTATION.South:
                texturePath += "south";
                break;

            case Agent.ORIENTATION.West:
                texturePath += "west";
                break;
            }
            texturePath += ".png";
            Texture texture = new Texture(texturePath);

            return(new Sprite(texture)
            {
                Scale = new Vector2f((float)Config.FIELD_SIZE / (float)texture.Size.X, (float)Config.FIELD_SIZE / (float)texture.Size.Y)
            });
        }
Esempio n. 6
0
    //Place le père de l'objet courant à sa bonne place dans le tableau
    //neighbors selon sa position par rapport à son fils.
    public void setInitialNeighbor(GameObject g, ORIENTATION o)
    {
        ORIENTATION n = toClonePerspective(o);

        neighbors[(int)n] = g;
        remaining--;
    }
Esempio n. 7
0
 public void ChangeOrientation(ORIENTATION _orientation, ALIGN _align)
 {
     m_orientation = _orientation;
     m_align       = _align;
     m_gaugeTransform.localPosition = m_initPos;
     ComputeEdge();
 }
Esempio n. 8
0
    //Retourne la position du père de l'objet courant par rapport à ce dernier.
    private ORIENTATION toClonePerspective(ORIENTATION o)
    {
        ORIENTATION res = ORIENTATION.UP;

        switch (o)
        {
        case ORIENTATION.UP:
            res = ORIENTATION.DOWN;
            break;

        case ORIENTATION.DOWN:
            res = ORIENTATION.UP;
            break;

        case ORIENTATION.LEFT:
            res = ORIENTATION.RIGHT;
            break;

        case ORIENTATION.RIGHT:
            res = ORIENTATION.LEFT;
            break;

        case ORIENTATION.FORWARD:
            res = ORIENTATION.BACKWARD;
            break;

        case ORIENTATION.BACKWARD:
            res = ORIENTATION.FORWARD;
            break;
        }
        return(res);
    }
Esempio n. 9
0
    IEnumerator MoveNextStage(ORIENTATION orientation)
    {
        yield return(new WaitForFixedUpdate());

        //Define a posiçao no centro da proxima tela e move a camera
        Vector3 newPos = new Vector3(this.camera.transform.position.x,
                                     (this.WorldPos.y * this.currentStageY) + (this.WorldPos.y * (int)orientation),
                                     this.camera.transform.position.z);

        this.camera.transform.position = Vector3.MoveTowards(this.camera.transform.position, newPos, this.speedCamera * Time.deltaTime);

        //Confere a distancia para parar o movimento da camera.
        float currentDistance = Vector3.Distance(this.camera.transform.position, newPos);

        if (currentDistance > this.totalDistance / 100)
        {
            StartCoroutine(MoveNextStage(orientation));
        }
        else
        {
            this.cameraMoving = false;
            this.ResetWorldPos();
            this.currentStageY += (int)orientation;
            print(this.currentStageY);
            //	StopCoroutine(this.MoveNextStage(direction));
        }
    }
Esempio n. 10
0
    private void GenerateDungeon()
    {
        // Main path generation

        int mainPathLength = Random.Range(minMainPathLength, maxMainPathLength + 1);

        Vector3     buildingPosition  = new Vector2(0, 0);
        ORIENTATION buildingDirection = ORIENTATION.NONE;

        Node firstNode = new Node(buildingPosition, 0, false);

        // Add to nodes list
        nodes.Add(firstNode);

        // Add to dictionary of paths
        if (!paths.ContainsKey(0))
        {
            paths.Add(0, new List <Node>());
        }
        paths[0].Add(firstNode);

        bool success = GeneratePath(0, mainPathLength, buildingPosition, buildingDirection);

        if (!success)
        {
            Debug.LogError("Main path failed. Everything stopped");
        }

        // Secondary paths generation

        int secondaryPathsCount = 0;
        int progressionIndex    = Random.Range(minRoomsBeforeNewSecondary, maxRoomsBeforeNewSecondary);

        while (progressionIndex < paths[0].Count)
        {
            List <ORIENTATION> availableOrientations = paths[0][progressionIndex].GetAvailableOrientations();

            if (availableOrientations.Count == 0)
            {
                progressionIndex++;
                continue;
            }

            int secondaryPathLength = Random.Range(minSecondaryPathLength, maxSecondaryPathLength + 1);

            buildingPosition  = paths[0][progressionIndex].position;
            buildingDirection = availableOrientations[Random.Range(0, availableOrientations.Count)];

            success = GeneratePath(secondaryPathsCount + 1, secondaryPathLength, buildingPosition, buildingDirection);

            if (success)
            {
                progressionIndex += Random.Range(minRoomsBeforeNewSecondary, maxRoomsBeforeNewSecondary);
            }
            else
            {
                progressionIndex++;
            }
        }
    }
Esempio n. 11
0
    // Can only generate linear paths possibly connected to a parent path
    private bool GeneratePath(int pathID, int pathLength, Vector2 startPos, ORIENTATION startDir)
    {
        int pathToBuildRemaining = pathLength;

        Vector2     currentPos = startPos;
        ORIENTATION currentDir = startDir;

        // This can be null
        Node buildFromNode = nodes.FirstOrDefault(x => x.position == currentPos);

        // Returned int is the amount of rooms we wont be able to place anyway
        Tuple <PossibleBuild, int> tuple = GetPossibleBuild(pathToBuildRemaining, currentDir, currentPos, buildFromNode?.GetOrientationsWithoutDoors());

        if (tuple.Item2 > 0)
        {
            if (failIfPossiblePathTooShort)
            {
                return(false);
            }
            else
            {
                // Remove amount of rooms we wont be able to build
                pathToBuildRemaining -= tuple.Item2;
            }
        }

        while (pathToBuildRemaining > 0)
        {
            pathToBuildRemaining--;

            buildFromNode = nodes.FirstOrDefault(x => x.position == currentPos);

            // Returned int is the amount of rooms we wont be able to place anyway
            tuple = GetPossibleBuild(pathToBuildRemaining, currentDir, currentPos, buildFromNode?.GetOrientationsWithoutDoors());

            currentPos = tuple.Item1.newPos;
            currentDir = tuple.Item1.dirToGetThere;

            Node newNode = new Node(currentPos, pathID, pathToBuildRemaining == 0 && pathID != 0);

            // Add to nodes list
            nodes.Add(newNode);

            // Add to dictionary of paths
            if (!paths.ContainsKey(pathID))
            {
                paths.Add(pathID, new List <Node>());
            }
            paths[pathID].Add(newNode);

            if (buildFromNode != null)
            {
                buildFromNode.doors.Add(currentDir, newNode);
                newNode.doors.Add(OppositeOrientation(currentDir), buildFromNode);
            }
        }

        return(true);
    }
Esempio n. 12
0
        public void LocationIsInitialized(ORIENTATION orientation)
        {
            var location = new Location(9266, 90210, orientation);

            Assert.That(location.Coordinate.X, Is.EqualTo(9266));
            Assert.That(location.Coordinate.Y, Is.EqualTo(90210));
            Assert.That(location.Orientation, Is.EqualTo(orientation));
        }
Esempio n. 13
0
    private Tuple <PossibleBuild, int> GetPossibleBuild(int toBuildLeft, ORIENTATION previousDirection, Vector2 previousPosition, List <ORIENTATION> available)
    {
        List <ORIENTATION> directionsAvailable = available != null ? available : existingDirections.ToList();

        // Ignore direction we built from before
        directionsAvailable.Remove(OppositeOrientation(previousDirection));

        Tuple <bool, int> result;
        int smallestRemainingDepth = int.MaxValue;

        bool        fallback          = false;
        Vector2     fallbackPosition  = new Vector2();
        ORIENTATION fallbackDirection = ORIENTATION.NONE;

        Vector2     newPosition;
        ORIENTATION newDirection;

        do
        {
            newDirection = RandomizeDirection(previousDirection, directionsAvailable);
            newPosition  = MoveIntoDirection(newDirection, previousPosition);

            directionsAvailable.Remove(newDirection);

            result = IsCellAvailable(new List <Vector2>(), newPosition, toBuildLeft);

            if (result.Item2 < smallestRemainingDepth)
            {
                smallestRemainingDepth = result.Item2;

                fallbackDirection = newDirection;
                fallbackPosition  = newPosition;
            }

            if (result.Item1)
            {
                break;
            }

            if (directionsAvailable.Count == 0)
            {
                fallback = true;
                break;
            }
        }while (!result.Item1);

        // If no direction is possible for requested length pick the longest possible
        if (fallback)
        {
            return(new Tuple <PossibleBuild, int>(new PossibleBuild(fallbackPosition, fallbackDirection), smallestRemainingDepth));
        }
        else
        {
            return(new Tuple <PossibleBuild, int>(new PossibleBuild(newPosition, newDirection), 0));
        }
    }
Esempio n. 14
0
 public HudElement()
 {
     name        = "";
     position    = new Vector2(0, 0);
     origin      = position;
     size        = position;
     state       = VISIBILITY.SHOWN;
     orientation = ORIENTATION.TOP;
     action      = null;
 }
Esempio n. 15
0
        public void LeftTurnsOrientation(ORIENTATION start, ORIENTATION finish)
        {
            var initialLocation = new Location(9266, 90210, start);

            var newLocation = motor.Move(initialLocation);

            Assert.That(newLocation.Coordinate.X, Is.EqualTo(9266));
            Assert.That(newLocation.Coordinate.Y, Is.EqualTo(90210));
            Assert.That(newLocation.Orientation, Is.EqualTo(finish));
        }
Esempio n. 16
0
 public void Interact()
 {
     if (_currentOrientation == ORIENTATION.WEST)
     {
         _currentOrientation = ORIENTATION.NORTH;
     }
     else
     {
         ++_currentOrientation;
     }
 }
Esempio n. 17
0
        public Agent(Field field, ORIENTATION orientation)
        {
            Orientation = orientation;

            Food  = 100;
            Coins = 0;

            Sprite = CreateSprite(orientation);

            SetField(field);
        }
Esempio n. 18
0
 public HudText(Vector2 pos, Vector2 siz, VISIBILITY vis, ORIENTATION ort, SpriteFont fnt, string txt, Action a)
 {
     position    = pos;
     origin      = pos;
     size        = siz;
     state       = vis;
     orientation = ort;
     font        = fnt;
     text        = txt;
     action      = a;
 }
Esempio n. 19
0
    // Not real random but rather same direction as before or a chance to turn 90 degrees
    // Unless we are fed a ORIENTATION.NONE in which case the result can be anything available
    // If nothing is available returns ORIENTATION.NONE
    private ORIENTATION RandomizeDirection(ORIENTATION previousDirection, List <ORIENTATION> available)
    {
        List <ORIENTATION> directionsAvailable = available;

        // Ignore direction we built from before
        directionsAvailable.Remove(OppositeOrientation(previousDirection));

        // Default behaviours
        if (directionsAvailable.Count == 0)
        {
            return(ORIENTATION.NONE); // Fail (Manage on the other side)
        }
        if (previousDirection == ORIENTATION.NONE)
        {
            return(directionsAvailable[Random.Range(0, directionsAvailable.Count)]);
        }

        // 1-3 directions possible onwards (forward/left/right)

        // Generate turns from our previous direction
        List <ORIENTATION> sidesAvailable = new List <ORIENTATION>();

        sidesAvailable.Add(AngleToOrientation(OrientationToAngle(previousDirection) + 90f)); // Right
        sidesAvailable.Add(AngleToOrientation(OrientationToAngle(previousDirection) - 90f)); // Left

        // Only keep available sides
        sidesAvailable = sidesAvailable.Where(x => directionsAvailable.Contains(x)).ToList();

        if (sidesAvailable.Count == 0)
        {
            return(previousDirection); // Has to be the only one remaining
        }
        else if (directionsAvailable.Contains(previousDirection))
        {
            // 0-2 sides and forward remaining

            if (Random.Range(0f, 100f) < buildingDirectionChangeChance * 100f)
            {
                return(sidesAvailable[Random.Range(0, sidesAvailable.Count)]);
            }
            else
            {
                return(previousDirection);
            }
        }
        else
        {
            return(sidesAvailable[Random.Range(0, sidesAvailable.Count)]); // 0-2 sides remaining
        }
    }
Esempio n. 20
0
    IEnumerator AlignWithFloor(ORIENTATION currentFace)
    {
        flags["flipping"] = true;

        yield return(new WaitForSeconds(0.15f));

        rbody.AddRelativeTorque(+0.004f * GetRollForceVector(currentFace), ForceMode.VelocityChange);

        yield return(new WaitForSeconds(0.15f));

        rbody.AddRelativeTorque(-0.004f * GetRollForceVector(currentFace), ForceMode.VelocityChange);

        flags["flipping"] = false;
    }
Esempio n. 21
0
    private Vector2 MoveIntoDirection(ORIENTATION direction, Vector2 startPosition)
    {
        switch (direction)
        {
        case ORIENTATION.NORTH: return(new Vector2(startPosition.x, startPosition.y + 1));

        case ORIENTATION.EAST: return(new Vector2(startPosition.x + 1, startPosition.y));

        case ORIENTATION.SOUTH: return(new Vector2(startPosition.x, startPosition.y - 1));

        case ORIENTATION.WEST: return(new Vector2(startPosition.x - 1, startPosition.y));

        default: return(MoveIntoDirection(RandomizeDirection(direction, new List <ORIENTATION>()), startPosition));
        }
    }
Esempio n. 22
0
    // Transform an ORIENTATION into direction
    public static Vector2Int OrientationToDir(ORIENTATION orientation)
    {
        switch (orientation)
        {
        case ORIENTATION.NORTH: return(new Vector2Int(0, 1));

        case ORIENTATION.EAST: return(new Vector2Int(1, 0));

        case ORIENTATION.SOUTH: return(new Vector2Int(0, -1));

        case ORIENTATION.WEST: return(new Vector2Int(-1, 0));

        default: return(new Vector2Int(0, 0));
        }
    }
Esempio n. 23
0
    public static ORIENTATION OppositeOrientation(ORIENTATION orientation)
    {
        switch (orientation)
        {
        case ORIENTATION.NORTH: return(ORIENTATION.SOUTH);

        case ORIENTATION.EAST: return(ORIENTATION.WEST);

        case ORIENTATION.SOUTH: return(ORIENTATION.NORTH);

        case ORIENTATION.WEST: return(ORIENTATION.EAST);

        default: return(ORIENTATION.NONE);
        }
    }
Esempio n. 24
0
        public HudGraphic(string n, Vector2 pos, Vector2 siz, VISIBILITY vis, ORIENTATION ort, Texture2D tex, Action a)
        {
            name        = n;
            position    = pos;
            origin      = pos;
            size        = siz;
            state       = vis;
            orientation = ort;
            texture     = tex;
            action      = a;

            //always not clicked on creation...
            clicked = false;

            //set up clickbox
            Point Pos  = new Point((int)pos.X, (int)pos.Y);
            Point Size = new Point((int)size.X, (int)size.Y);

            clickBox = new Rectangle(Pos, Size);
        }
Esempio n. 25
0
    Vector3 GetRollForceVector(ORIENTATION facing)
    {
        switch (facing)
        {
        case ORIENTATION.SIDEWAYS_LEFT:
            return(new Vector3(0, 0, rollForce));

        case ORIENTATION.SIDEWAYS_RIGHT:
            return(new Vector3(0, 0, -rollForce));

        case ORIENTATION.UPSIDE_DOWN:
            return(new Vector3(1.5f * rollForce, 0, 0));

        case ORIENTATION.FACE_DOWN:
            return(new Vector3(-rollForce, 0, 0));

        case ORIENTATION.ON_BACK:
            return(new Vector3(rollForce, 0, 0));
        }
        return(Vector3.zero);
    }
Esempio n. 26
0
        // Read the specified image into an ABGR-format rastertaking in account
        // specified orientation.
        public static bool TIFFReadRGBAImageOriented(TIFF tif, uint rwidth, uint rheight, uint[] raster, ORIENTATION orientation, bool stop)
        {
            string emsg="";
            TIFFRGBAImage img=new TIFFRGBAImage();
            bool ok;

            if(TIFFRGBAImageOK(tif, out emsg)&&TIFFRGBAImageBegin(img, tif, stop, out emsg))
            {
                img.req_orientation=orientation;
                // XXX verify rwidth and rheight against width and height
                ok=TIFFRGBAImageGet(img, raster, (rheight-img.height)*rwidth, rwidth, img.height);
                TIFFRGBAImageEnd(img);
            }
            else
            {
                TIFFErrorExt(tif.tif_clientdata, TIFFFileName(tif), emsg);
                ok=false;
            }

            return ok;
        }
Esempio n. 27
0
        static void drawBeforeExplosion(int startPosition, ref int xPos, int yPos, ORIENTATION orientation)
        {
            Console.ForegroundColor = ConsoleColor.DarkGreen;

            if (orientation == ORIENTATION.RIGHT_TO_LEFT)
            {
                for (int i = startPosition; i > yPos; --i)
                {
                    Program.drawElement('*', xPos - 1, i); // draw in current line
                    Program.drawElement(' ', xPos, i + 1); // hide drawing in previos line
                    --xPos;
                    Thread.Sleep(300);
                }
            }
            else
            {
                if (orientation == ORIENTATION.UP)
                {
                    for (int i = startPosition; i > yPos; --i)
                    {
                        Program.drawElement('*', xPos, i); // draw in current line
                        Program.drawElement(' ', xPos, i + 1); // hide in previous line
                        Thread.Sleep(400);
                    }
                }
                else
                {
                    for (int i = startPosition; i > yPos; --i)
                    {
                        Program.drawElement('*', xPos, i); //draw in current line
                        Program.drawElement(' ', xPos - 1, i + 1); // hide in previous line
                        ++xPos;
                        Thread.Sleep(300);
                    }
                }
            }
        }
    IEnumerator MoveNextStage(ORIENTATION orientation)
    {
        yield return new WaitForFixedUpdate ();
        //Define a posiçao no centro da proxima tela e move a camera
        Vector3 newPos = new Vector3 (this.camera.transform.position.x ,
                                      (this.WorldPos.y * this.currentStageY) + (this.WorldPos.y * (int)orientation),
                                      this.camera.transform.position.z);
        this.camera.transform.position = Vector3.MoveTowards (this.camera.transform.position, newPos, this.speedCamera * Time.deltaTime);

        //Confere a distancia para parar o movimento da camera.
        float currentDistance = Vector3.Distance (this.camera.transform.position, newPos);
        if (currentDistance > this.totalDistance/100)
        {
            StartCoroutine (MoveNextStage (orientation));
        }
        else
        {
            this.cameraMoving = false;
            this.ResetWorldPos();
            this.currentStageY += (int)orientation;
            print (this.currentStageY);
            //	StopCoroutine(this.MoveNextStage(direction));
        }
    }
Esempio n. 29
0
    // Transform an ORIENTATION into angle
    public static float OrientationToAngle(ORIENTATION orientation, ORIENTATION origin = ORIENTATION.NORTH)
    {
        float toNorthAngle = 0;

        switch (orientation)
        {
        case ORIENTATION.NORTH: toNorthAngle = 0.0f; break;

        case ORIENTATION.EAST: toNorthAngle = 90.0f; break;

        case ORIENTATION.SOUTH: toNorthAngle = 180.0f; break;

        case ORIENTATION.WEST: toNorthAngle = 270.0f; break;

        default: toNorthAngle = 270.0f; break;
        }
        if (origin == ORIENTATION.NORTH)
        {
            return(toNorthAngle);
        }
        float originToNorthAngle = OrientationToAngle(origin, ORIENTATION.NORTH);

        return(Mathf.Repeat(toNorthAngle - originToNorthAngle, 360.0f));
    }
Esempio n. 30
0
 static void drawFirework(int xPos, int yPos, int startPosition, ORIENTATION orientation)
 {
     Program.drawBeforeExplosion(startPosition, ref xPos, yPos, orientation);
     Program.drawExplosion(xPos, yPos, orientation);
 }
Esempio n. 31
0
        public void Clear()
        {
            td_fieldsset=new uint[libtiff.FIELD_SETLONGS];
            td_imagewidth=td_imagelength=td_imagedepth=0;
            td_tilewidth=td_tilelength=td_tiledepth=0;
            td_subfiletype=0;
            td_bitspersample=0;
            td_sampleformat=0;
            td_compression=0;
            td_photometric=0;
            td_threshholding=0;
            td_fillorder=0;
            td_orientation=0;
            td_samplesperpixel=0;
            td_rowsperstrip=0;
            td_minsamplevalue=td_maxsamplevalue=0;
            td_sminsamplevalue=td_smaxsamplevalue=0;
            td_xresolution=td_yresolution=0;
            td_resolutionunit=0;
            td_planarconfig=0;
            td_xposition=td_yposition=0;
            td_pagenumber=new ushort[2];
            td_colormap=new ushort[3][];
            td_halftonehints=new ushort[2];
            td_extrasamples=0;
            td_sampleinfo=null;

            td_stripsperimage=0;
            td_nstrips=0;				// size of offset & bytecount arrays
            td_stripoffset=null;
            td_stripbytecount=null;
            td_stripbytecountsorted=0;	// is the bytecount array sorted ascending?
            td_nsubifd=0;
            td_subifd=null;

            // YCbCr parameters
            td_ycbcrsubsampling=new ushort[2];
            td_ycbcrpositioning=0;

            // Colorimetry parameters
            td_refblackwhite=null;
            td_transferfunction=new ushort[3][];

            // CMYK parameters
            td_inknameslen=0;
            td_inknames=null;

            td_customValueCount=0;
            td_customValues.Clear();
        }
Esempio n. 32
0
        public void LocationHasDescription(ORIENTATION orientation)
        {
            var location = new Location(9266, 90210, orientation);

            Assert.That(location.Description, Is.EqualTo($"9266 90210 {orientation.ToString().First()}"));
        }
Esempio n. 33
0
    void CheckOrientation()
    {
        // only when NOT held or holding
        if (GetComponent <FixedJoint>() != null ||
            claws != null)
        {
            return;
        }

        // only when NOT MOVING
        if (rbody.velocity.sqrMagnitude > 0.1f &&
            mood != EMOTIONS.ASLEEP && mood != EMOTIONS.BORED)
        {
            return;
        }

        // use dot product
        float dot = 0;

        // check which vector is the closest to up
        dot = Vector3.Dot(transform.up, Vector3.up);
        if (dot > 0.5)
        {
            // no need to flip
            orientation = ORIENTATION.RIGHT_SIDE_UP;
            return;
        }
        else
        {
            // if the cat is not right side up, flip
            flipTimer += 2f * Time.fixedDeltaTime;
            // flip
            if (flipTimer > waitBeforeFlipDuration)
            {
                flipTimer = 0;
                FlipUpwards();
            }
        }
        if (dot < -0.5)
        {
            orientation = ORIENTATION.UPSIDE_DOWN;
            return;
        }
        // left right
        dot = Vector3.Dot(transform.right, Vector3.up);
        if (dot > 0.5)
        {
            orientation = ORIENTATION.SIDEWAYS_RIGHT;
            return;
        }
        if (dot < -0.5)
        {
            orientation = ORIENTATION.SIDEWAYS_LEFT;
            return;
        }
        // back front
        dot = Vector3.Dot(transform.forward, Vector3.up);
        if (dot > 0.5)
        {
            orientation = ORIENTATION.ON_BACK;
            return;
        }
        if (dot < -0.5)
        {
            orientation = ORIENTATION.FACE_DOWN;
            return;
        }
    }
 public IForwardMotor ConstructForwardFor(ORIENTATION orientation)
 {
     return(kernel.Get <IForwardMotor>(orientation.ToString()));
 }
Esempio n. 35
0
 public void setOrientation(ORIENTATION o)
 {
     orientation = o;
 }
Esempio n. 36
0
        static void drawExplosion(int xPos, int yPos, ORIENTATION orientation)
        {
            if (orientation == ORIENTATION.LEFT_TO_RIGHT)
            {
                int j = 0;
                int indexToHide = 0;
                // radius of explosion
                for (int i = 0; i < 5; ++i)
                {
                    // change colors while drawing
                    Console.ForegroundColor = (ConsoleColor)j;

                    // draw explosion
                    Program.drawExplodePositions('*', xPos, yPos, j);

                    // remove drawings when startPosition beginning if j is bigger than const value
                    if (j > Program.START_HIDING_COUNT)
                    {
                        Program.drawExplodePositions(' ', xPos, yPos, indexToHide++);
                    }

                    ++j;
                    Thread.Sleep(380);
                }

                j = 0;

                // hide the rest of explosion
                while (j <= Program.START_HIDING_COUNT)
                {
                    Program.drawExplodePositions(' ', xPos, yPos, indexToHide++);
                    j++;
                    Thread.Sleep(380);
                }
            }
            else
            {
                if (orientation == ORIENTATION.UP)
                {
                    int j = 0;
                    int indexToHide = 0;
                    for (int i = 0; i < 7; ++i)
                    {
                        Console.ForegroundColor = (ConsoleColor)j;

                        Program.drawExplodePositions('*', xPos, yPos, j);

                        if (j > Program.START_HIDING_COUNT)
                        {
                            Program.drawExplodePositions(' ', xPos, yPos, indexToHide++);
                        }
                        ++j;
                        Thread.Sleep(500);
                    }

                    j = 0;

                    while (j <= Program.START_HIDING_COUNT)
                    {
                        Program.drawExplodePositions(' ', xPos, yPos, indexToHide++);
                        j++;
                        Thread.Sleep(500);
                    }
                }
                else
                {
                    int j = 0;
                    int indexToHide = 0;

                    //
                    for (int i = 0; i < 4; ++i)
                    {
                        Console.ForegroundColor = (ConsoleColor)i;

                        Program.drawExplodePositions('*', xPos, yPos, j);

                        if (j > Program.START_HIDING_COUNT)
                        {
                            Program.drawExplodePositions(' ', xPos, yPos, indexToHide++);
                        }
                        ++j;
                        Thread.Sleep(380);
                    }

                    j = 0;

                    while (j <= Program.START_HIDING_COUNT)
                    {
                        Program.drawExplodePositions(' ', xPos, yPos, indexToHide++);
                        j++;
                        Thread.Sleep(380);
                    }

                }
            }
        }
 public GradientType()
 {
     this.orientationField = ORIENTATION.HORIZONTAL;
 }