Tumgik
dellahu-blog · 7 years
Video
0 notes
dellahu-blog · 7 years
Video
Array Homework
Array of cubes instantiated:
using System.Collections; using System.Collections.Generic; using UnityEngine; public class InstantiateToArray : MonoBehaviour {     public GameObject[] cubePlacement = new GameObject[64];    // Number of placements on the table     public GameObject[] cubes;        // The cards, that have to be placed randomly on the table     void Update()     {         PlaceCards();    // I placed it on another function     }     void PlaceCards()     {                  int randomCard = Random.Range (0, cubes.Length);         // Get Random Card         for (int i = 0; i < cubePlacement.Length; i++) {    // Loop through all slots on the table             // Instantiate random card into each slot on the table and position the card on that place             Instantiate (cubes [randomCard], cubePlacement [i].transform.position, cubePlacement [i].transform.rotation);             GameObject[] goDestroy = GameObject.FindGameObjectsWithTag ("Holder");             foreach (GameObject goHolder in goDestroy)                 Destroy (goHolder);         }     }     }
array of colors
using System.Collections; using System.Collections.Generic; using UnityEngine; public class MaterialLerp : MonoBehaviour {          Color[] colors = new Color[6];     // Use this for initialization     void Start () {         //colors[0] = new Color (0.5f, 1f, 0.3f);         //colors[1] = new Color(1f,0.8f, 0.6f);         //colors[2] = new Color(0.3f,0.5f, 1f);         //colors[3] = new Color(0.2f, 0.3f, 0.8f);         //colors[4] = new Color(1f, 1f, 0.2f);         //colors[5] = new Color(0.4f, 0.5f, 0.8f);         colors[0] = Color.blue;         colors[1] = Color.cyan;         colors[2] = Color.yellow;         colors[3] = new Color(0.2f, 0.3f, 0.8f);         colors[4] = Color.red;         colors[5] = Color.magenta;     }          // Update is called once per frame     void Update () {         GetComponent<MeshRenderer>().material.color =Color.Lerp(colors[Random.Range(0, colors.Length)], colors[Random.Range(0, colors.Length)],Mathf.PingPong(Time.time, 1));     } }
0 notes
dellahu-blog · 7 years
Video
0 notes
dellahu-blog · 7 years
Video
CSharp Day_08
0 notes
dellahu-blog · 7 years
Video
Unity Editor Audio Assignment
0 notes
dellahu-blog · 7 years
Video
CSharp Day_06
0 notes
dellahu-blog · 7 years
Photo
Tumblr media
Texture
0 notes
dellahu-blog · 7 years
Video
Cat can’t make sandwiches!
0 notes
dellahu-blog · 7 years
Video
find the fish that makes slurping sound. I failed
0 notes
dellahu-blog · 7 years
Video
Day 05: Reacting to Events
0 notes
dellahu-blog · 7 years
Video
0 notes
dellahu-blog · 7 years
Video
Day 04: Movement with Math
0 notes
dellahu-blog · 7 years
Video
Day 03: Methods & Conditionals
0 notes
dellahu-blog · 7 years
Video
I made the game extra easy and because I can’t win my own game. 
0 notes
dellahu-blog · 7 years
Photo
Tumblr media
Day 03: Methods & Conditionals
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; //Remember to add this if you want the game to pause in RealisticGuess.Start()
namespace ConsoleApplication1 {    class RealisticGuess //Simulates a guessing game between two people. Guessing efficiency is not a goal.    {        private int max;        private int min;        private int guess;
       public void Start()        {            Console.Clear();            string guessMin;            string guessMax;
           try            {                Console.WriteLine("Please enter the lower boundary");                guessMin = Console.ReadLine();                min = Convert.ToInt32(guessMin);                Console.WriteLine("Please enter the upper boundary");                guessMax = Console.ReadLine();                max = Convert.ToInt32(guessMax);            }            catch (FormatException)            {                Console.WriteLine("The entry you have made is invalid. Please make sure your entry is an integer and try again.");                Console.ReadKey(true);                Start();            }            Console.WriteLine("Think of a number between {0} and {1}.", min, max);            Thread.Sleep(2500);            Console.WriteLine("Ready?");            Console.WriteLine("Press any key to begin.");            Console.ReadKey(true);            Guess(min, max);        }        public void Guess(int min, int max)        {            int counter = 1;            string userAnswer;            bool correct = false;            Random rand = new Random();
           while (correct == false)            {                guess = rand.Next(min, max);                Console.Clear();                Console.WriteLine("{0}", guess);                Console.WriteLine("Is this number correct? {Y/N}");                userAnswer = Console.ReadLine();                if (userAnswer != "y" && userAnswer != "Y" && userAnswer != "n" && userAnswer != "N")                {                    Console.WriteLine("Your entry is invalid. Please enter either 'Y' or 'N'");                    Console.WriteLine("Is the number correct? {Y/N}");                    userAnswer = Console.ReadLine();                }                if (userAnswer == "y" || userAnswer == "Y")                {                    correct = true;                }                if (userAnswer == "n" || userAnswer == "N")                {                    counter++;                    if (max == min)                    {                        Console.WriteLine("Error: Range Intersect. Press enter to restart the game.");  //This message should never pop up if the user enters good data.                        Console.ReadKey(true);                                                          //It handles the game-breaking exception that occurs                        Guess(1, 101);                                                                  //when the max guess number is the same as the min number.                    }                    Console.WriteLine("Is the number you're thinking of lower or higher? {L/H}");                    userAnswer = Console.ReadLine();                    if (userAnswer != "l" && userAnswer != "L" && userAnswer != "h" && userAnswer != "H")                    {                        Console.WriteLine("Your entry is invalid. Please enter either 'L' or 'H'");                        Console.WriteLine("Is the number you're thinking of lower or higher? {L/H}");                        userAnswer = Console.ReadLine();                    }                    if (userAnswer == "l" || userAnswer == "L")                    {                        max = guess;                    }                    if (userAnswer == "h" || userAnswer == "H")                    {                        min = guess;                    }                }            }            if (correct == true)            {                EndAndLoop(counter);            }        }
       public void EndAndLoop(int iterations)        {            string userChoice;            bool loop = false;            Console.WriteLine("Game over. It took {0} guesses to find the number.", iterations);            while (loop == false)            {                Console.WriteLine("Would you like to play again? {Y/N}");                userChoice = Console.ReadLine();                if (userChoice != "Y" && userChoice != "y" && userChoice != "N" && userChoice != "n")                {                    Console.WriteLine("Sorry, your input is invalid. Please answer 'Y' to play again, or 'N' to quit.");                }                if (userChoice == "Y" || userChoice == "y")                {                    Start();                }                if (userChoice == "N" || userChoice == "n")                {                    Environment.Exit(1);                }            }        }    }    class Program    {        static void Main(string[] args)        {            Console.Title = "Random Number";            RealisticGuess game = new RealisticGuess();            game.Start();        }    } }
0 notes
dellahu-blog · 7 years
Video
0 notes
dellahu-blog · 7 years
Photo
Day 02: Alogrithms & Variables
Tumblr media
using System;
public class Example {   public static void Main()   {      Random rnd = new Random();      int hrd = rnd.Next(1, 10);      int ten = rnd.Next(1, 10);      int sig = rnd.Next(1, 10);
     Console.WriteLine(“Pick three random integers from 1 to 10:”);      for (int ctr = 1; ctr <= 1; ctr++)      {         Console.Write(“{0,6}”, hrd);
     }
     for (int ctr = 1; ctr <= 1; ctr++)      {         Console.Write(“{0,6}”, ten);
     }
     for (int ctr = 1; ctr <= 1; ctr++)      {         Console.Write(“{0,6}”,sig);
     }      int pos = hrd*100+ten*10+sig;      int neg = sig*100+ten*10+hrd;
     Console.WriteLine(“\nMake them into a three-numbered integer:”);       Console.Write(“{0,13}”, pos );
     Console.WriteLine(“\nNow reverse the three-numbered integer:”);       Console.Write(“{0,13}”, neg);
     Console.WriteLine(“\nSubtract them:”);       Console.Write(“{0,13}”, pos-neg);
     Console.WriteLine(“\nFind the absolute vaue of the above number:”);       Console.Write(“{0,13}”, Math.Abs(pos-neg));
     Console.WriteLine(“\nNow revers the above number :”);      Console.Write(“{0,13}”, (Math.Abs(pos-neg)% 10*100)+((Math.Abs(pos-neg)/10) % 10*10)+(Math.Abs(pos-neg)/100)% 10);
     Console.WriteLine(“\nAdd the the last two numbers up and it’s always going to be 1089 :”);      Console.Write(“{0,13}”, Math.Abs(pos-neg)+(Math.Abs(pos-neg)% 10*100)+((Math.Abs(pos-neg)/10) % 10*10)+(Math.Abs(pos-neg)/100)% 10);      Console.WriteLine(“\nWell most times, sometimes the answer is 0 because my code is flawed!”);
  } }
1 note · View note