Inheritance: MonoBehaviour
Ejemplo n.º 1
0
	// Use this for initialization
	void Start () {
		gc = gco.GetComponent<GameControl>();
		gp = gco.GetComponent<GamePlay>();

		pos.y = -3.5F;
		pos.z = -2;
	}
Ejemplo n.º 2
0
    public void load()
    {
        //Create the GameControl and a Player.
        //Checks that loads are correctly done.
        GameControl subGameControl = new GameControl();
        PlayerData subPlayerData = new PlayerData();
        subGameControl.playerData = subPlayerData;

        subPlayerData.playerStr = 8;
        subPlayerData.playerAgl = 7;
        subPlayerData.playerDex = 6;
        subPlayerData.playerInt = 5;
        subPlayerData.playerVit = 4;
        subPlayerData.currentGameLevel = 3;
        subPlayerData.abilityPoints = 2;

        subGameControl.Load();

        Assert.That(subGameControl.playerStr == 8);
        Assert.That(subGameControl.playerAgl == 7);
        Assert.That(subGameControl.playerDex == 6);
        Assert.That(subGameControl.playerInt == 5);
        Assert.That(subGameControl.playerVit == 4);
        Assert.That(subGameControl.currentGameLevel == 3);
        Assert.That(subGameControl.abilityPoints == 2);
    }
Ejemplo n.º 3
0
    void Start()
    {
        GameObject[] wps = GameObject.FindGameObjectsWithTag (Tags.waypoint).OrderBy (go => go.name).ToArray();
        List<Vector3> wplist = new List<Vector3> (wps.Length + 15);
        GameObject[] racks = GameObject.FindGameObjectsWithTag (Tags.rack).OrderBy (go => go.name).ToArray();
        int i = 0;
        foreach (GameObject r in racks) {
            int n = int.Parse (r.name.Last().ToString());
            Vector3 rack = r.transform.position;
            UnityEngine.AI.NavMeshHit hit;
            if (UnityEngine.AI.NavMesh.SamplePosition (rack, out hit, 0.5f, UnityEngine.AI.NavMesh.AllAreas))
                rack = hit.position;
            wplist.Add (rack);
            while (i < wps.Length && wps[i].name.Contains (n + "-")) {
                wplist.Add (wps[i].transform.position);
                i++;
            }
            wplist.Add (rack);
        }
        waypoints = wplist.ToArray();

        gameControl = GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<GameControl>();

        agent.SetDestination (waypoints[currentWP]);
    }
Ejemplo n.º 4
0
    private void OnEnable()
    {
        #region Singleton Constructor
        if (m_gameControl == null)
        {
            m_gameControl = this;
        }
        else if (m_gameControl != this)
        {
            Destroy(this);
        }
        #endregion

        // Load / Save Functions
        gameIO = SerializationIO.m_SerializationIO;
        gameIO.SetCurrentLevel(Application.loadedLevel);

        // Try Load, if failed generate a new Save file.
        try
        {
            Load();
        }
        catch
        {
            Save();
        }
    }
Ejemplo n.º 5
0
	public void StartEvent(float x, float y, float flowY) {
		gameControl = GameObject.Find("GameControl").GetComponent("GameControl") as GameControl; 
		gameControl.eventRun = true;;
		eventObject = Instantiate(Stalactite,new Vector3(x, y + Stalactite.transform.localScale.y/2, -2F),Quaternion.Euler(0f,0f,0f)) as GameObject;
		downY = -3 + flowY;
		step = 1;
	}
Ejemplo n.º 6
0
    public void resetStat()
    {
        //Create the GameControl, IncreaseStat and a Player.
        //Check that attributes are correctly reset.
        IncreaseStat subIS = new IncreaseStat();
        GameControl subGameControl = new GameControl();
        GameControl.control = subGameControl;
        Player subPlayer = new Player();

        subPlayer.strength = 5;
        subPlayer.dexterity = 5;
        subPlayer.vitality = 5;
        subPlayer.intelligence = 5;
        subPlayer.agility = 5;
        subIS.player = subPlayer;

        subGameControl.playerStr = 5;
        subGameControl.playerDex = 5;
        subGameControl.playerVit = 5;
        subGameControl.playerInt = 5;
        subGameControl.playerAgl = 5;

        subIS.doReset();

        Assert.That(subPlayer.strength == 1);
        Assert.That(subPlayer.dexterity == 1);
        Assert.That(subPlayer.vitality == 1);
        Assert.That(subPlayer.intelligence == 1);
        Assert.That(subPlayer.agility == 1);
        Assert.That(subGameControl.playerStr == 1);
        Assert.That(subGameControl.playerDex == 1);
        Assert.That(subGameControl.playerVit == 1);
        Assert.That(subGameControl.playerInt == 1);
        Assert.That(subGameControl.playerAgl == 1);
    }
Ejemplo n.º 7
0
	// Use this for initialization
	void Start () {
		lv = PlayerPrefs.GetInt("LV_Rocket");
		if(lv == 0)
			time = 8;
		else if(lv == 1)
			time = 10;
		else if(lv == 2)
			time = 14;
		else if(lv == 3)
			time = 18;
		else
			time = 24;
		//////////////////////////////////////////////////
		gp = GameObject.Find("GameControl").GetComponent<GamePlay>();
		gc = GameObject.Find("GameControl").GetComponent<GameControl>();
		gc.Rocket = true;
		gp.checkrungame = false;
		speed = gc.speedControl;
		if(GameObject.Find("CharacterControl") != null) {
			_character = GameObject.Find("CharacterControl");
			_character.transform.name = "CC";
			Debug.Log("CharacterControl");
		}else
			_character = GameObject.Find("CC");
		cc = _character.GetComponent<CharacterControl>();
		pos.x = gc.stopCharacterX+2;
		pos.y = -3.5F;
		pos.z = -2;

		posY.z = -2;
	}
Ejemplo n.º 8
0
	void Start () {
	

	   guiScore = GameObject.Find ("guiScore").guiText;
		game = GameControl.getInstence ();
		game.Score = 0;
	}
Ejemplo n.º 9
0
 //-----------------------------------------------------------------------------
 // Constructor
 //-----------------------------------------------------------------------------
 public ScriptRunner(GameControl gameControl)
 {
     this.gameControl		= gameControl;
     this.scriptObject		= null;
     this.compiledAssembly	= null;
     this.scriptMethods		= new Dictionary<string, MethodInfo>();
 }
Ejemplo n.º 10
0
 public Player(List<Card> deck, GameControl gameControl)
 {
     Deck = deck;
     Hand = new List<Card>();
     GuiHand = new List<GUICard>();
     this.gameControl = gameControl;
 }
Ejemplo n.º 11
0
	// Use this for initialization
	void Start () {
		box = new GameObject[texture.Length];
		gameControl = GameObject.Find("GameControl").GetComponent("GameControl") as GameControl; 
		gp = GameObject.Find("GameControl").GetComponent<GamePlay>(); 

		endPoint = gameControl.stopCharacterX + 2.2F;
	}
Ejemplo n.º 12
0
    public void OnPointerDown(PointerEventData data)
    {
        gc = (GameControl)GameObject.FindWithTag("GameController").GetComponent<GameControl>();
        GameObject parent = gameObject.transform.parent.gameObject;

        for(int i=0; i<gc.player.cards.Count; i++)
        {
            if(gc.player.cards[i].picture == parent)
            {
                card = gc.player.cards[i];
            }
        }
        for(int i=0; i<gc.computer.cards.Count; i++)
        {
            if(gc.computer.cards[i].picture == parent)
            {
                card = gc.computer.cards[i];
            }
        }
         	email = PlayerPrefs.GetString ("email", "");
        if (!email.Contains ("@"))
        {
            gc.ShowEmail();
            StartCoroutine(WaitForEmail());
        }
        else StartCoroutine(SendMail());
    }
Ejemplo n.º 13
0
Archivo: Ball.cs Proyecto: Janin-K/SG
 // Use this for initialization
 void Start()
 {
     ballcolor = new BallColor(Material1, Material2, renderer);
     scoreboard = new Scoreboard();
     gameControl = new GameControl();
     startPos = transform.position;
 }
Ejemplo n.º 14
0
	void Start () {
		gameControl = GameObject.Find("GameControl").GetComponent("GameControl") as GameControl;
		gp			= GameObject.Find("GameControl").GetComponent<GamePlay>();
		speedControl = gameControl.speedControl;
		CountSpeedUp = gp.countSpeedUp;
		SpeedUp = gp.speedUp;
	}
Ejemplo n.º 15
0
	public void StartEvent(float x, float y) {
		character = GameObject.Find("CharacterControl").GetComponent("CharacterControl") as CharacterControl;
		gameControl = GameObject.Find("GameControl").GetComponent("GameControl") as GameControl; 
		gameControl.eventRun = true;
		eventObject = Instantiate(Ice,new Vector3(x, y, -2F),Quaternion.Euler(0f,0f,0f)) as GameObject;
		step = 1;
	}
Ejemplo n.º 16
0
	public void StartEvent(float x, float y) {
		gameControl = GameObject.Find("GameControl").GetComponent("GameControl") as GameControl; 
		gameControl.eventRun = true;
		eventObject = Instantiate(pricker,new Vector3(x, y - pricker.transform.localScale.y/2-0.5F, -2F),Quaternion.Euler(90f,180f,0f)) as GameObject;
		height = y + pricker.transform.localScale.y/2 -0.5F;
		step = 1;
	}
Ejemplo n.º 17
0
	public void StartPattern() {
		gameControl = (GameControl)GameObject.Find("GameControl").GetComponent("GameControl");
		gp			= GameObject.Find("GameControl").GetComponent<GamePlay>();
		gp.PatterOn = true;
		
		float flowY = (int)Random.Range(0F,1.9F);
		transform.position = new Vector3(transform.position.x, transform.position.y + flowY, transform.position.z);
		
		int i = 0;
		while(i < stone.Length) {
			StoneRealTime s = stone[i].GetComponent("StoneRealTime") as StoneRealTime;
			s.StartEvent(stone[i].transform.position.x, stone[i].transform.position.y, stone[i].transform.position.z);
			i++;
		}
		i = 0;
		while(i < ice.Length) {
			IceRealTime s = ice[i].GetComponent("IceRealTime") as IceRealTime;
			s.StartEvent(ice[i].transform.position.x, ice[i].transform.position.y);
			i++;
		}
		i = 0;
		while(i < pricker.Length) {
			PrickerRealTime s = pricker[i].GetComponent("PrickerRealTime") as PrickerRealTime;
			s.StartEvent(pricker[i].transform.position.x, pricker[i].transform.position.y);
			i++;
		}
		i = 0;
		while(i < stalactite.Length) {
			StalactiteRealTime s = stalactite[i].GetComponent("StalactiteRealTime") as StalactiteRealTime;
			s.StartEvent(stalactite[i].transform.position.x, stalactite[i].transform.position.y, flowY);
			i++;
		}
	}
Ejemplo n.º 18
0
    // Use this for initialization
    void Start()
    {
        m_Control = theGameControl.GetComponent<GameControl> ();

        NumberofCats = GameObject.FindGameObjectsWithTag ("Player").Length;
        CatNumber.text = "Cat Counter: " + NumberofCats;
    }
Ejemplo n.º 19
0
	// Use this for initialization
	void Awake () {
	
		if(control == null) {
			DontDestroyOnLoad(gameObject);
			musicVolume = 10f;
			soundsVolume = 10f;
			diff = 0;
			pages = 0;
			kills = 0;
			score = 0;
			ignorance = 0;
			cDamage = damageCoeffs[diff];
			fShot = shotFrequences[diff];
			cScore = scoreCoeffs[diff];
			sDiff = difficulties[diff];
			for(int i=0; i<bestScores.GetLength(0); i++) {
				bestPlayers[i] = "---";
				bestScores[i] = (i+1)*100;
			}
			control = this;
		}
		else if (control != this) {
			Destroy(gameObject);
		}

	}
Ejemplo n.º 20
0
 public static GameControl getInstance()
 {
     if (instance == null)
     {
         instance = new GameControl();
     }
     return instance;
 }
Ejemplo n.º 21
0
	void Awake () {
		if (control == null) {
			DontDestroyOnLoad (gameObject);
			control = this;
		} else if (control != this) {
			Destroy (gameObject);
		}
	}
Ejemplo n.º 22
0
	// Use this for initialization
	void Start () {
		Debug.Log (Application.persistentDataPath);
		Instance=this;
		if(is_custom_level){
		LoadLevel (level_to_play);
		ground.Play ("lookUp");
		}
	}
Ejemplo n.º 23
0
 // Use this for initialization
 void Start()
 {
     cntrl = GameObject.Find ("Main Camera").GetComponent<CutSceneControl> ();
     gm_cntrl = GameObject.Find ("Main Camera").GetComponent<GameControl> ();
     if (ini_pos != null) {
         transform.position = ini_pos.position;
     }
 }
 // Use this for initialization
 void Start()
 {
     energyBallObject.GetComponent<SpriteRenderer> ().enabled = false;
     energyBallObject.GetComponent<ParticleSystem> ().enableEmission = false;
     game = GameObject.Find ("Game").GetComponent<GameControl>();
     toPlayerPart.enableEmission = false;
     fromPlayerPart.enableEmission = false;
 }
Ejemplo n.º 25
0
	// Use this for initialization
	void Start () {
		gameControl = GameObject.Find("GameControl").GetComponent("GameControl") as GameControl;
		mod			= gameObject.GetComponent<Modifier>();
		boot_boom	= PlayerPrefs.GetInt("Boot_Boom");
		item_revive		= PlayerPrefs.GetInt("Revive");

		_fb = gameObject.GetComponent<GUIFB>();
	}
    // Use this for initialization
    void Start () {

        // Find camera with script on it
        GameObject camera = GameObject.FindGameObjectWithTag("MainCamera");

        // Get reference to the script GameControl
        gc = camera.GetComponent<GameControl>();

    }// End Start()
Ejemplo n.º 27
0
	// Use this for initialization
	void Start () {
		pos.z = -2;
		pos.x = transform.position.x;
		gameControl = GameObject.Find("GameControl").GetComponent<GameControl>();
		if(!gameControl.ghost) {
			character = GameObject.Find("CharacterControl");
			_do = true;
		}
	}
 public void Init()
 {
     gameControl = GameObject.Find("Game").GetComponent<GameControl>();
     int ix = Random.Range (0, gameControl.nBricksX * 2);
     int iy = Random.Range (0, gameControl.nBricksY);
     nextIntersetion =  new Intersection(ix, iy);
     PlaceAtIntersection();
     clearTrail();
 }
Ejemplo n.º 29
0
    void Start()
    {
        // switch the chests minimap dot
        miniMapDot = transform.Find("MiniMap");
        miniMapDotHacked = transform.Find("miniMapDotHacked");

        GameObject gameControlObj = GameObject.Find ("GameControl");
        gameControl = gameControlObj.GetComponent<GameControl>();
    }
Ejemplo n.º 30
0
	// Use this for initialization
	void Start () {
		//cc = GameObject.Find("CharacterControl").GetComponent<CharacterControl>();
		gc = GameObject.Find("GameControl").GetComponent<GameControl>();
		gp = GameObject.Find("GameControl").GetComponent<GamePlay>();
		if(!gc.ghost) {
			_Character = GameObject.Find("CharacterControl").transform;
			_do = true;
		}
		down = -2.5F + gp.lastFlowY;
	}
Ejemplo n.º 31
0
 // 初始化
 public void Init()
 {
     this.startTime   = 0f;
     this.endTime     = 0f;
     this.gameControl = new GameControl();
 }
Ejemplo n.º 32
0
 void Start()
 {
     healthandscore = GameObject.Find("Gobel").GetComponent <HealthandScore>();
     gunsystem      = GameObject.Find("Main Camera").GetComponent <GunSystem>();
     GameControl    = GameObject.Find("Main Camera").GetComponent <GameControl>();
 }
Ejemplo n.º 33
0
        public async Task ExecuteKillFlash()
        {
            await GameControl.PlaySoundWait(LotaSound.VeryBad);

            Combat.Monsters.RemoveAll(monst => monst.KillFlashImmune == false);
        }
Ejemplo n.º 34
0
 private void Awake()
 {
     Instance = this;
 }
Ejemplo n.º 35
0
 void Start()
 {
     Cursor.visible = false;
     gobelMove      = GameObject.Find("Gobel").GetComponent <GobelMove>();
     GameControl    = GameObject.Find("Main Camera").GetComponent <GameControl>();
 }
Ejemplo n.º 36
0
 // Use this for initialization
 void Start()
 {
     GameControl.ReadStats();
 }
Ejemplo n.º 37
0
 //private int HP;
 // Start is called before the first frame update
 void Start()
 {
     dMAn = FindObjectOfType <DialogueManager>();
     GC   = FindObjectOfType <GameControl>();
 }
Ejemplo n.º 38
0
 private void Start()
 {
     PS.SpawnPuyo();
     GC       = GameObject.Find("PuyoSpawn").GetComponent <GameControl>();
     Particle = Resources.Load <GameObject>("Particle/Particle");
 }
Ejemplo n.º 39
0
 // Use this for initialization
 void Start()
 {
     myCam = GetComponent <Camera>();
     //target = FindObjectOfType<Transform>();
     player = FindObjectOfType <GameControl>();
 }
Ejemplo n.º 40
0
 public override void Hit(int damage)
 {
     base.Hit(damage);
     GameControl.GetInstance().UpdateLifeGauge();
 }
Ejemplo n.º 41
0
 public void SetGameControlReference(GameControl controller)
 {
     control = controller;
 }
Ejemplo n.º 42
0
        public void Reset()
        {
            GameControl newGame = new GameControl();

            newGame.Start();
        }
Ejemplo n.º 43
0
        public override LayoutDTO GetNextPiece()
        {
            var       nextPiece     = pieceQueue.Peek();
            var       possiblePlays = Board.Instance.PossiblePlays(nextPiece.Layout);
            LayoutDTO layoutValues;

            if (possiblePlays > 0)
            {
                //Creates a new piecePreview to be enqueued
                var newPiecePreview = GameControl.Instantiate(GameController.previewPiecePrefab, new Vector3(PIECE_PREVIEW_INITIAL_X, -0.6f, 0), Quaternion.identity) as PreviewPiece;
                newPiecePreview.gameObject.name = GameController.previewPiecePrefab.name;

                //Selects what layout that piece will have
                var minUsage = layoutUsage.MinBy(x => x.Value);
                var newIndex = layoutUsage.Where(x => x.Value <= minUsage.Value + 1).RandomElement().Key;
                layoutUsage[newIndex]++;

                //Enqueues the new piecePreview
                newPiecePreview.Init(GameController.PieceLayouts[newIndex].Copy(), newIndex);
                pieceQueue.Enqueue(newPiecePreview);

                var position = 0;
                foreach (var piecePreview in pieceQueue)
                {
                    iTween.MoveTo(piecePreview.gameObject, iTween.Hash(
                                      "name", "tweenY",
                                      "y", PIECE_PREVIEW_INITIAL_Y + (TOTAL_PIECE_PREVIEWS - position++) * 1.6f,
                                      "time", 1f));
                }

                //Dequeues top piece
                var headPiece = pieceQueue.Dequeue();
                layoutValues = new LayoutDTO {
                    Layout = headPiece.Layout, Variant = headPiece.Variant
                };

                iTween.ValueTo(headPiece.gameObject, iTween.Hash(
                                   "name", "tweenAlpha",
                                   "from", 1f,
                                   "to", 0f,
                                   "time", 0.25f,
                                   "easetype", "easeOutCubic",
                                   "onupdate", "TweenAlpha",
                                   "oncomplete", "Destroy"));
                //Destroy(headPiece.gameObject);
            }
            else
            {
                var layout = new Grid <int>();
                layout[0, 0] = 4;
                layoutValues = new LayoutDTO {
                    Layout = layout, Variant = Block.TOTAL_VARIANTS + 1
                };                                                                                    //This is a heart piece
                if (GameController.lifeCounter.Count >= 1)
                {
                    GameController.lifeCounter.Count++;
                }
            }

            if (UserHasPlayed)   //If the player has already started playing
            {
                StopCoroutine("DecreaseMultiplier");
                StartCoroutine("DecreaseMultiplier");

                hintTimer = TIME_TILL_HINT;
            }

            return(layoutValues);
        }
Ejemplo n.º 44
0
 void Start()
 {
     rb2D              = GetComponent <Rigidbody2D>();
     player            = GameObject.Find("Player");
     GameControlScript = player.GetComponent <GameControl> ();
 }
Ejemplo n.º 45
0
 public override void Cure(int cure)
 {
     base.Cure(cure);
     GameControl.GetInstance().UpdateLifeGauge();
 }
Ejemplo n.º 46
0
 void Awake()
 {
     manager = this;
 }
Ejemplo n.º 47
0
 void Awake()
 {
     Instance = this;
     gc       = GameObject.Find("GameManager").GetComponent <GameControl>();
     gci      = GameObject.Find("GameManagerInScene").GetComponent <GameControlInPlay>();
 }
Ejemplo n.º 48
0
    // Start is called before the first frame update
    void Start()
    {
        gc    = FindObjectOfType <GameControl>();
        timer = GetComponent <TimerObjects>();
        //Init players
        for (int i = 0; i < 4; i++)
        {
            p_input[i] = ReInput.players.GetPlayer(i);
        }


        //Init aim sprites
        for (int i = 0; i < 4; i++)
        {
            gap = new Vector2(-8 + i * 5, 0);
            if (i > 1)
            {
                gap.x += 1;
            }
            p_aims[i] = new GameObject();
            p_aims[i].AddComponent <SpriteRenderer>();
            p_aims[i].AddComponent <Rigidbody2D>();
            p_aims[i].GetComponent <Rigidbody2D>().gravityScale = 0;
            p_aims[i].GetComponent <Rigidbody2D>().MovePosition(gap);
            p_aims[i].GetComponent <SpriteRenderer>().sprite = aims;
        }


        //Init tomato sprite
        tomato_pos = new Vector2(0, -3);
        obj_tomato = new GameObject("tomato");
        obj_tomato.AddComponent <SpriteRenderer>();
        obj_tomato.AddComponent <Rigidbody2D>();
        obj_tomato.AddComponent <BoxCollider2D>();
        obj_tomato.GetComponent <Rigidbody2D>().gravityScale = 0;
        obj_tomato.GetComponent <Rigidbody2D>().MovePosition(tomato_pos);
        obj_tomato.GetComponent <SpriteRenderer>().sprite = tomato[0];
        //translate the tomato in the Z axis so it's behind the background
        obj_tomato.GetComponent <Transform>().Translate(0, 0, 2);


        for (int i = 0; i < 4; i++)
        {
            place = new Vector2(-8 + i * 2.5f, -3.5f);
            if (i > 1)
            {
                place.x += 10;
            }
            else if (i == 1)
            {
                place.y += .25f;
            }
            p_toppings[i] = new GameObject();
            p_toppings[i].AddComponent <SpriteRenderer>();
            p_toppings[i].AddComponent <Rigidbody2D>();
            p_toppings[i].GetComponent <Rigidbody2D>().gravityScale = 0;
            p_toppings[i].GetComponent <Rigidbody2D>().MovePosition(place);
            p_toppings[i].GetComponent <SpriteRenderer>().sprite = toppings[i];
            p_toppings[i].GetComponent <Transform>().localScale  = new Vector3(.4f, .4f, 0);
            if (i == 0)
            {
                p_toppings[i].GetComponent <SpriteRenderer>().flipX = true;
            }
            else if (i == 2)
            {
                p_toppings[i].GetComponent <SpriteRenderer>().flipX = true;
            }
        }

        //Init audio
        fire = GetComponent <AudioSource>();
    }
Ejemplo n.º 49
0
	public Transform farRight;          // The transform representing the right bound of the camera's position.

    void Start()
    {
        control = GetComponent<GameControl>();
        TryFindProjectile();
    }
Ejemplo n.º 50
0
 // Use this for initialization
 void Start()
 {
     control = GameObject.FindObjectOfType <GameControl> ();
     //	groundrenderer = GetComponent<Renderer> ();
 }
Ejemplo n.º 51
0
 // Use this for initialization
 void Start()
 {
     this.goControle    = GameObject.FindGameObjectWithTag("GameControl");
     this.controleGeral = goControle.GetComponent <GameControl>() as GameControl;
 }
Ejemplo n.º 52
0
    public IEnumerator Register(string username, string password, string email)
    {
        WWWForm form = new WWWForm();

        form.AddField("user_name", username);
        form.AddField("user_password", password);
        form.AddField("user_email", email);
        //  Debug.Log("5");


        using (UnityWebRequest www = UnityWebRequest.Post("https://crystalis.herokuapp.com/forest/createInfo?user_name=" + username + "&user_password="******"&user_email" + email, form))
        {
            yield return(www.SendWebRequest());


            if (www.isNetworkError || www.isHttpError)
            {
                // Debug.Log(www.responseCode);
                int rCode = (int)www.responseCode;
                switch (rCode)
                {
                case 409:
                    Debug.Log("Username already exists");
                    GameObject.Find("/Canvas/Background/RegisterUser/Inputs/LoginButton").GetComponent <Button>().interactable       = false;
                    GameObject.Find("/Canvas/Background/RegisterUser/Inputs/BackToLoginButton").GetComponent <Button>().interactable = false;
                    GameObject.Find("/Canvas/Background/RegisterUser/UsernameConflict").SetActive(true);
                    break;

                case 400:
                    Debug.Log("Bad Request");
                    GameObject.Find("/Canvas/Background/RegisterUser/Inputs/LoginButton").GetComponent <Button>().interactable       = false;
                    GameObject.Find("/Canvas/Background/RegisterUser/Inputs/BackToLoginButton").GetComponent <Button>().interactable = false;
                    GameObject.Find("/Canvas/Background/RegisterUser/BadRequest").SetActive(true);
                    break;

                case 405:
                    Debug.Log("Email is not valid");
                    GameObject.Find("/Canvas/Background/RegisterUser/Inputs/LoginButton").GetComponent <Button>().interactable       = false;
                    GameObject.Find("/Canvas/Background/RegisterUser/Inputs/BackToLoginButton").GetComponent <Button>().interactable = false;
                    GameObject.Find("/Canvas/Background/RegisterUser/EmailNotFound").SetActive(true);
                    break;

                case 500:
                    Debug.Log("Internal server");
                    GameObject.Find("/Canvas/Background/RegisterUser/Inputs/LoginButton").GetComponent <Button>().interactable       = false;
                    GameObject.Find("/Canvas/Background/RegisterUser/Inputs/BackToLoginButton").GetComponent <Button>().interactable = false;
                    GameObject.Find("/Canvas/Background/RegisterUser/InternalServer").SetActive(true);
                    break;

                default:
                    Debug.Log("IDK what happen");
                    Debug.Log(rCode);
                    GameObject.Find("/Canvas/Background/RegisterUser/Inputs/LoginButton").GetComponent <Button>().interactable       = false;
                    GameObject.Find("/Canvas/Background/RegisterUser/Inputs/BackToLoginButton").GetComponent <Button>().interactable = false;
                    GameObject.Find("/Canvas/Background/RegisterUser/DefaultError").SetActive(true);
                    break;
                }
            }
            else
            {
                Debug.Log(www.downloadHandler.text);
                GameControl playerAttributes = GameObject.Find("BattleAttack").GetComponent <GameControl>();
                playerAttributes.userName    = username;
                playerAttributes.health      = 3;
                playerAttributes.level       = 1;
                playerAttributes.attack      = 1;
                playerAttributes.money       = 0;
                playerAttributes.HP          = 100;
                playerAttributes.EnemyKilled = 0;

                playerAttributes.QuestCount      = 0;
                playerAttributes.isQuestComplete = false;
                playerAttributes.inQuest         = false;
                playerAttributes.numComeToStore  = 0;
                Vector3 position;
                position.x = (float)-28;
                position.y = (float)6;
                position.z = 0;
                playerAttributes.position = position;

                SceneManager.LoadScene(sceneName: "StartMenu");
            }
        }
    }
Ejemplo n.º 53
0
 private void Awake()
 {
     spelplan    = GameObject.FindGameObjectWithTag("Spelplan");
     lastmove    = GameObject.Find("PController").GetComponent <LastMove>();
     gameControl = GameObject.Find("PController").GetComponent <GameControl>();
 }
Ejemplo n.º 54
0
        private async Task AdvancePlayer()
        {
            await GameControl.WaitAsync(125);

            Player.X++;
        }
Ejemplo n.º 55
0
 private void Awake()
 {
     PlayerCaught = false;
     GC           = this;
 }
Ejemplo n.º 56
0
 public GameData(GameControl gameData)
 {
     currentLvl = gameData.currentLvl;
     timeList   = gameData.timeList;
 }
Ejemplo n.º 57
0
        public MainGame(GameControl gameControl, Player player, Map map, Cave cave)
        {
            InitializeComponent();

            this.SetStyle(ControlStyles.DoubleBuffer, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, false);
            this.SetStyle(ControlStyles.Opaque, false);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

            this.gameControl           = gameControl;
            this.player                = player;
            this.map                   = map;
            this.cave                  = cave;
            this.shootButtonClicked    = false;
            this.northClicked          = false;
            this.northWestClicked      = false;
            this.northEastClicked      = false;
            this.southClicked          = false;
            this.southWestClicked      = false;
            this.southEastClicked      = false;
            this.northShootClicked     = false;
            this.northWestShootClicked = false;
            this.northEastShootClicked = false;
            this.southShootClicked     = false;
            this.southWestShootClicked = false;
            this.southEastShootClicked = false;
            playAgain.Visible          = false;
            quitButton.Visible         = false;
            viewHighscores.Visible     = false;
            displayCheats.Visible      = false;
            LasersCoins.Visible        = false;
            Victory.Visible            = false;
            Defeat.Visible             = false;
            HazardsLoc.Visible         = false;
            UFOButton.Visible          = false;
            UFOTele.Visible            = false;
            WumpusButton.Visible       = false;
            PlayerReturn.Visible       = false;
            this.image                 = new Image[] { Properties.Resources.planet1, Properties.Resources.planet2, Properties.Resources.planet3,
                                                       Properties.Resources.planet4, Properties.Resources.planet5, Properties.Resources.planet6,
                                                       Properties.Resources.planet7, Properties.Resources.planet8, Properties.Resources.planet9,
                                                       Properties.Resources.planet10, Properties.Resources.planet11, Properties.Resources.planet12,
                                                       Properties.Resources.planet13, Properties.Resources.planet14, Properties.Resources.planet15,
                                                       Properties.Resources.planet16, Properties.Resources.planet17, Properties.Resources.planet18,
                                                       Properties.Resources.planet19, Properties.Resources.planet20, Properties.Resources.planet21,
                                                       Properties.Resources.planet22, Properties.Resources.planet23, Properties.Resources.planet24,
                                                       Properties.Resources.planet25, Properties.Resources.planet26, Properties.Resources.planet27,
                                                       Properties.Resources.planet28, Properties.Resources.planet29, Properties.Resources.planet30,
                                                       Properties.Resources.gameOverWin, Properties.Resources.gameOverLose };
            this.name = new string[] { "Pandora-1", "Aurora-2", "Avalon-3", "Zion-4", "Nova-5",
                                       "Spartan-6", "Artemis-7", "Genesis-8", "Xenon-9", "Orion-10",
                                       "Apollo-11", "Stardust-12", "Hyperion-13", "Divinity-14", "Trinity-15",
                                       "Osiris-16", "Elysium-17", "Nirvana-18", "Styx-19", "Vortex-20",
                                       "Oblivion-21", "Argon-22", "Exodus-23", "Starlight-24", "Equinox-25",
                                       "Nebula-26", "Andromeda-27", "Galactic-28", "Titanium-29", "Sagittarius-30" };
            this.spaceshipX             = 540;
            this.spaceshipY             = 300;
            this.laserY                 = new int [] { 270, 300, 330, 360 };
            this.laserX                 = new int[] { 500, 560, 620 };
            this.arrowAnimationFinished = false;
            this.arrowShot              = false;
        }
Ejemplo n.º 58
0
    private IEnumerator RollTheDice()
    {
        coroutineAllowed = false;
        int randomDiceSide = 0;

        for (int i = 0; i <= 20; i++)
        {
            randomDiceSide = Random.Range(0, 6);
            rend.sprite    = diceSides[randomDiceSide];
            yield return(new WaitForSeconds(0.05f));
        }

        GameControl.diceSideThrown = randomDiceSide + 1;
        if (whosTurn == 1)
        {
            if (GameControl.dogMove == false)
            {
                GameControl.dogMove = true;
            }
            else
            {
                GameControl.MovePlayer(1);
            }
        }
        else if (whosTurn == 2)
        {
            if (GameControl.catMove == false)
            {
                GameControl.catMove = true;
            }
            else
            {
                GameControl.MovePlayer(2);
            }
        }
        else if (whosTurn == 3)
        {
            if (GameControl.lionMove == false)
            {
                GameControl.lionMove = true;
            }
            else
            {
                GameControl.MovePlayer(3);
            }
        }
        else if (whosTurn == 4)
        {
            if (GameControl.squirrelMove == false)
            {
                GameControl.squirrelMove = true;
            }
            else
            {
                GameControl.MovePlayer(4);
            }
        }

        Debug.Log("whosTurn : " + whosTurn);
        Debug.Log("diceside : " + GameControl.diceSideThrown);
        Debug.Log("pv:" + pv.isMine);
        pv.RPC("moveFriend", PhotonTargets.Others, whosTurn, GameControl.diceSideThrown);

        whosTurn++;

        if (whosTurn == 5)
        {
            whosTurn = 1;
        }

        coroutineAllowed = true;
    }
 public GamePlayScreen01()
 {
     gameControl = new GameControl();
 }
Ejemplo n.º 60
0
 void Start()
 {
     _gameControl = GameObject.FindGameObjectWithTag("gamecontrol").GetComponent <GameControl> ();
     health       = _gameControl.BodyList.Find(c => c.transform == gameObject.transform).health; // Circle nin toplam canını gamecontrol de bulunan bodylist den aldık
 }