Example #1
0
 // Use this for initialization
 public void Start()
 {
     this.Player = (GameObject)GameObject.Instantiate( this.Player, new Vector3( 4.5f, 0, 4.5f ), Quaternion.identity );
     PlayerScript = this.Player.GetComponent<playerScript>();
     PlayerScript.player = true;
     playerScript.dead = false;
 }
Example #2
0
 // Start is called before the first frame update
 void Start()
 {
     god  = GameObject.Find("GOD").GetComponent <godScript>();
     pS   = GameObject.Find("Player").GetComponent <playerScript>();
     anim = GetComponent <Animator>();
     postProcessObject.profile.TryGetSettings(out vig);
 }
//===========================//==========================//======================//===================//

    void Start()
    {
        pickupPoint                 = gameObject.GetComponent <BoxCollider2D>();
        topPosition                 = highPoint + (Vector2)transform.position;
        botttomPosition             = lowPoint + (Vector2)transform.position;
        transform.position          = botttomPosition;
        moveTimer                   = 0f;
        ascending                   = true;
        playerOnboard               = false;
        player                      = GameObject.Find("Player").gameObject;
        holder                      = gameObject.transform.parent.gameObject.transform.Find("ElevatorHolder").gameObject;
        elevatorPlatform            = gameObject.transform.Find("ElevatorSolid").gameObject;
        holder.transform.position   = Vector3.zero;
        holder.transform.localScale = new Vector3(1f, 1f, 1f);
        holder.transform.rotation   = Quaternion.Euler(0f, 0f, 0f);
        playerScript                = player.GetComponent <playerScript>();
        if (playerScript.spaceForJump)
        {
            spaceForJump = true;
        }
        slamDirection       = topPosition - botttomPosition; // get the direction of the slam movement and normalize it
        slamDirection       = slamDirection.normalized;      // note that the player can only have a vertical force applied
        pickupInitialOffset = pickupPoint.offset.y;
        pickupInitialHeight = pickupPoint.size.y;
        horizontal          = (Mathf.Abs(slamDirection.x) > Mathf.Abs(slamDirection.y))? true : false;
    }
 // Use this for initialization
 private void Start()
 {
     player       = GameObject.Find("player");
     playerScript = player.GetComponent <playerScript>();
     healthSlider = this.gameObject.GetComponentInChildren <Slider>();
     playerHealth = GameObject.Find("playerHealth").GetComponent <Text>();
 }
Example #5
0
 void Start()
 {
     player = (playerScript)FindObjectOfType(typeof(playerScript));
     orderCount++;
     order          = orderCount;
     gameObject.tag = "door";
 }
Example #6
0
 // Use this for initialization
 void Start()
 {
     player = GameObject.FindWithTag("Player").GetComponent <playerScript>();
     self   = player.playerSkills.Find(x => x.skillName.Contains("Nuke"));
     power  = self.power;
     size   = self.size;
 }
    public void glowPlayer(playerScript p)
    {
        //int index = players.FindIndex(x=>x.Equals(p.gameObject));
        int index = players.IndexOf(p.gameObject);

        playerAvatars[index].GetComponent <raiseAndLowerScript>().beginRise();
    }
Example #8
0
    void Update()
    {
        if (player == null)
        {
            player = (playerScript)FindObjectOfType(typeof(playerScript));
        }

        if (clickedOnSomething)
        {
            onMouseMiss();
        }

        if (!wall)
        {
            if (player.canWalk == true && clickedOnSomething)
            {
                if (pDist.isCloseEnough(player.transform.position))
                {
                    startDialogue();
                }
            }
        }
        else if (wall && clickedOnSomething)
        {
            player.stopMove();

            clickedOnSomething = false;
        }
    }
Example #9
0
    public playerScript getPlayer(int id)
    {
        playerScript returnVal = null;

        Debug.Assert(_idToPlayer.TryGetValue(id, out returnVal));
        return(returnVal);
    }
Example #10
0
	// Use this for initialization
	void Start () {
		_player = this;
		position = new UOFacetManager.Position(1400, 1500);
		float realx = (-position.y * 0.5f + position.x * 0.5f) / 1.6525f;
		float realy = (-position.y * 0.5f - position.x * 0.5f) / 1.6525f;
		this.transform.Translate(new Vector3(realx, realy));
	}
    // Start is called before the first frame update
    public void ChangeScene(int i)
    {
        switch (i)
        {
        case 0:

            if (GameObject.FindGameObjectWithTag("Player").GetComponent <playerScript>())
            {
                playerScript test = GameObject.FindGameObjectWithTag("Player").GetComponent <playerScript>();
                if (test.health > 0)
                {
                    player.clip = clips[1];
                    StartCoroutine(playAudio(i));
                    save = true;
                }

                else
                {
                }
            }

            break;

        case 1:

            StartCoroutine(transition(i));
            break;

        case 2:
            player.clip = clips[0];
            StartCoroutine(playAudio(i));
            break;
        }
    }
Example #12
0
    internal void setGameEnd()
    {
        playerScript        winner = null;
        List <playerScript> lst    = new List <playerScript>();

        for (int i = 0; i < lstPlayer.Length; i++)
        {
            if (lstPlayer[i] != null)
            {
                lst.Add(lstPlayer[i]);
            }
        }

        lst.Sort();

        for (int i = 0; i < lst.Count; i++)
        {
            lst[i].scoreGlob += lst.Count - i - 1;
        }
        winner = lst[0];

        if (winner != null)
        {
            txtFinalText.text = String.Format(Lng.Win, winner.playerName, winner.score);
        }
        else
        {
            txtFinalText.text = Lng.Lose;
        }

        setGameState(enGameState.End);
    }
Example #13
0
	void LateUpdate() {
		// Can't put this in start because start is run before player instantiated
		if (player == null) {
			player = (playerScript)FindObjectOfType(typeof(playerScript));
		}

		Vector3 playerPos = new Vector3 (0, 0, -10);
			if (player != null)
				playerPos = player.transform.position;
		Vector3 nudgeVal = transform.position;
		// negative
		if (playerPos.x < 0 && Mathf.Abs(playerPos.x) > quarterX * bounds) {
			//nudgeVal.x += -0.05f;
			nudgeVal.x = Mathf.Clamp(nudgeVal.x - 0.1f, -quarterX, quarterX);
			transform.position = nudgeVal;
		}
		else if (playerPos.x > 0 && Mathf.Abs (playerPos.x) > quarterX * bounds) {
			//nudgeVal.x += 0.05f;
			nudgeVal.x = Mathf.Clamp (nudgeVal.x + 0.1f, -quarterX, quarterX);
			transform.position = nudgeVal;
		}
	
		// Prevents camera from going through map bounds
		Vector3 v3 = transform.position;
		v3.x = Mathf.Clamp (v3.x, minX, maxX);
		v3.y = Mathf.Clamp (v3.y, minY, maxY);
		transform.position = v3;
		SoundManager.Instance.MoveSpeaker(Camera.main);
	}
Example #14
0
    // Use this for initialization
    void Start()
    {
        skills     = new GameObject[5];
        spawnTimes = new double[enemies.Length];
        for (int x = 0; x < enemies.Length; x++)
        {
            spawnTimes[x] = enemies[x].GetComponent <enemyBase>().spawnTimer;
        }
        //spawnTimes[0] = enemies[0].GetComponent<enemyBase>().spawnTimer;
        globalData.theLevelMaster = gameObject.GetComponent <levelMaster>();
        player = GameObject.FindWithTag("Player").GetComponent <playerScript>();
        globalData.theSerializer.LoadLevelData();
        globalData.leftEdge  = GameObject.FindWithTag("leftEdge").transform.position.x + (GameObject.FindWithTag("leftEdge").transform.localScale.x / 2) + .5f;
        globalData.rightEdge = GameObject.FindWithTag("rightEdge").transform.position.x - (GameObject.FindWithTag("rightEdge").transform.localScale.x / 2) - .5f;

        globalData.topEdge    = GameObject.FindWithTag("top").transform.position.z - (GameObject.FindWithTag("top").transform.localScale.z / 2) - 22.5f;
        globalData.bottomEdge = GameObject.FindWithTag("bottom").transform.position.z + (GameObject.FindWithTag("bottom").transform.localScale.z / 2) + 12.5f;
        UpdateUI();
        //createSkills();

        Debug.Log(globalData.topEdge);
        Debug.Log(globalData.bottomEdge);
        Debug.Log(globalData.leftEdge);
        Debug.Log(globalData.rightEdge);
    }
Example #15
0
	//public Vector2 textAdjusts = new Vector2(157, 30);

	// Use this for initialization
	void Start(){

		if (font != null)
			font = Resources.Load ("Fonts/KoushikiSans") as Font;

		if (ClickRevealer == null)
			ClickRevealer = Resources.Load ("Textures/IndicatorRing") as Texture2D;

		if (scale.x == 0f) {
			scale.x = transform.localScale.x;
			scale.y = transform.localScale.y;
		}

		if (player == null)
			player = FindObjectOfType (typeof(playerScript)) as playerScript;

		doorscript = GetComponent<DoorScript>();

		//iconMod.x *= transform.localScale.x;
		//iconMod.x *= transform.localScale.y;

		guiStyleFore = new GUIStyle();
		guiStyleFore.normal.textColor = Color.white;  
		guiStyleFore.alignment = TextAnchor.UpperCenter ;
		guiStyleFore.wordWrap = true;
		guiStyleFore.fontSize = sizeOfFont;
		guiStyleFore.font = font;
		guiStyleBack = new GUIStyle();
		guiStyleBack.normal.textColor = Color.black;  
		guiStyleBack.alignment = TextAnchor.UpperCenter ;
		guiStyleBack.wordWrap = true;
		guiStyleBack.font = font;
		guiStyleBack.fontSize = sizeOfFont;
	}
 public void SeekTarget()     // call this when instantiating a new player, so that the camera correctly locks to them
 {
     target             = GameObject.Find("Player").GetComponent <Transform>();
     playerScript       = target.gameObject.GetComponent <playerScript>();
     playerSound        = target.gameObject.GetComponent <playerSound>();
     transform.position = new Vector3(target.position.x, target.position.y, transform.position.z);
 }
Example #17
0
 void Update()
 {
     if (player == null)
     {
         player = (playerScript)FindObjectOfType(typeof(playerScript));
     }
 }
Example #18
0
 private void Start()
 {
     count     = 0;
     enemygoal = 0;
     sc        = GameObject.FindGameObjectWithTag("SC").GetComponent <SceneController>();
     test      = GameObject.FindGameObjectWithTag("Player").GetComponent <playerScript>();
 }
Example #19
0
    // Use this for initialization
    void Start()
    {
        player = (playerScript)FindObjectOfType(typeof(playerScript));

        sceneInit();

        if (loadNewXML || !Dialoguer.isInitialized())
        {
            Dialoguer.Initialize(dialoguer);
            GameManager.offset = 0;

            if (GameManager.offset == 0)
            {
                GameManager.offset = setOffset;
            }

            setOffset = 0;
        }

        GameManager.dialogueJustFinished = false;

        if (autoPlay)
        {
            playDialogue();
        }
    }
Example #20
0
    public void sceneInit()
    {
        if (FindObjectOfType(typeof(AstarPath)) != null)
        {
            AstarPath.active.Scan();
        }
        backEffect = (GameObject)Instantiate(Resources.Load("effect"));
        if (GameManager.Instance.playerInScene)
        {
            string  temp    = (string)GameManager.Instance.GetMainCharacter();
            var     Player  = (GameObject)Instantiate(Resources.Load((temp)));
            Vector2 tempVec = transform.position;
            tempVec.x = GameManager.Instance.GetNextX();
            tempVec.y = GameManager.Instance.GetNextY();

            Player.transform.position = tempVec;
            player          = Player.GetComponent <playerScript>();
            player.canScale = true;
            player.GetComponent <playerScript> ().scaleInfo = new float[4] {
                minScale, maxScale, minY, maxY
            };
            player.GetComponent <playerScript> ().baseSpeed = baseSpeed;
        }

        GameManager.Instance.updateMouseIcon("Walk_Icon");
    }
Example #21
0
 // Start is called before the first frame update
 void Start()
 {
     source       = GetComponent <AudioSource>();
     anim         = GetComponent <Animator>();
     moveDir      = new Vector2(spawnPoint.position.x, spawnPoint.position.y);
     spawned      = false;
     PlayerScript = gameObject.GetComponent <playerScript>();
 }
 void Start()
 {
     isUsed           = false;
     cursorInsideSlot = false;
     player           = GameObject.Find("Player");
     playerScript     = player.GetComponent <playerScript>();
     Debug.Log(inventory);
 }
Example #23
0
 // Use this for initialization
 void Start()
 {
     playerGameObject = GameObject.FindWithTag("Player");
     if (playerGameObject != null)
     {
         player = playerGameObject.GetComponent <playerScript> ();
     }
 }
Example #24
0
 // Use this for initialization
 void Start()
 {
     player   = GameObject.FindWithTag("Player").GetComponent <playerScript>();
     self     = player.playerSkills.Find(x => x.skillName.Contains("SlowField"));
     size     = self.size;
     duration = self.duration;
     power    = self.power;
 }
Example #25
0
    void Start()
    {
        //Here, I'm finding the player object and grabbing the playerScript.
        player = GameObject.Find("Player");
        ps     = player.GetComponent <playerScript> ();

        path = Application.streamingAssetsPath + Path.DirectorySeparatorChar + "File.txt";
    }
Example #26
0
 void Start()
 {
     boxCollider         = gameObject.GetComponent <BoxCollider2D>();
     boxCollider.enabled = false;
     playerScript        = GameObject.Find("Player").gameObject.GetComponent <playerScript>();
     checkpointData      = GameObject.Find("Player").gameObject.GetComponent <checkpointData>();
     gameManager         = GameObject.Find("GameManager").GetComponent <gameManager>();
 }
Example #27
0
	void Start(){

		player = (playerScript) FindObjectOfType(typeof(playerScript));
		orderCount++;
		order = orderCount;
		gameObject.tag = "door";

	}
Example #28
0
	void OnMouseEnter (){

		if (player == null)
			player = FindObjectOfType (typeof(playerScript)) as playerScript;
		else
		if (!player.talking)
			currText = toolText;
	}
Example #29
0
 void Start()
 {
     player = FindObjectOfType <playerScript> ();
     if (isPull)
     {
         meteorForce = -meteorForce;
         playerForce = -playerForce;
     }
 }
Example #30
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        playerScript playerObj = collider.gameObject.GetComponent <playerScript> ();

        if (playerObj != null)
        {
            playerObj.canScale = false;
        }
    }
Example #31
0
    public void sendAllTargets(int requester)
    {
        playerScript requestingPlayer = getPlayer(requester);

        requestingPlayer.PhoneRef.SendCmd("targetDelivery", new listMessageTP(new List <int>(_idToPlayer
                                                                                             .Where(x => { return(x.Value.IsAlive); })
                                                                                             .Select(x => { return(x.Key); })),
                                                                              this));
    }
Example #32
0
    // Use this for initialization
    void Start()
    {
        _player  = this;
        position = new UOFacetManager.Position(1400, 1500);
        float realx = (-position.y * 0.5f + position.x * 0.5f) / 1.6525f;
        float realy = (-position.y * 0.5f - position.x * 0.5f) / 1.6525f;

        this.transform.Translate(new Vector3(realx, realy));
    }
Example #33
0
 private void Awake()
 {
     canFireArrow = false;
     canPlace     = false;
     pScript      = GetComponent <playerScript>();
     gcScript     = GameObject.Find("GameController").GetComponent <gameControllerScriptNew>();
     // aimArrow = GameObject.Find("playerPuck/puckSprite/aimArrow");
     // aimArrowNode = GameObject.Find("playerPuck/puckSprite/aimArrow/spawnNode");
 }
Example #34
0
	protected void Init(){

		player = (playerScript) FindObjectOfType(typeof(playerScript));
		//profileImage = gameObject.GetComponent<SpriteRenderer> ().sprite;
		pDist = gameObject.GetComponent<distanceCheck>();
		if (maxDist < GameManager.Instance.maxDist)
			maxDist = GameManager.Instance.maxDist;

	}
Example #35
0
    // Use this for initialization
    void Start()
    {
        jugadorObject = GameObject.FindWithTag("Player");

        eljugador  = jugadorObject.GetComponent <playerScript>();
        wasPressed = false;
        haPasado   = false;
        hasScored  = false;
    }
Example #36
0
    // Use this for initialization
    void Start()
    {
        if (!SystemInfo.supportsImageEffects)
        {
            enabled = false;
            return;
        }

        playerscript = GameObject.FindGameObjectWithTag("Player").GetComponent <playerScript>();
    }
Example #37
0
	void Awake()
	{
		instance = this.gameObject.GetComponent<playerScript>();
		state = State.IDLE;
		_upToDate = true;
		target = null;
		_agent = GetComponent<NavMeshAgent>();
		_animator = GetComponent<Animator>();
		stats = GetComponent<statScript>();
	}
Example #38
0
    public void GivePlayerSkills()
    {
        player = GameObject.Find("Player").GetComponent <playerScript>();

        foreach (skill s in chosenSkills)
        {
            player.playerSkills.Add(s);
            Debug.Log(s.skillName);
        }
    }
Example #39
0
 void Awake()
 {
     // Variables to hold the scripts on other game objects so that we can manipulate them from this script
     mouse 		= pc.GetComponent <MouseLook> ();
     movement 	= pc.GetComponent <CharacterMotor> ();
     cam 		= Camera.main.GetComponent <MouseLook> ();
     talk 		= pc.GetComponent <playerScript> ();
     menu 		= holder.GetComponent <menuScript> ();
     inventory 	= holder.GetComponent <cameraScript> ();
     message 	= text.GetComponent <uiSystem> ();
 }
Example #40
0
	// Use this for initialization
	void Start () {
		if (maxDist < GameManager.Instance.maxDist)
			maxDist = GameManager.Instance.maxDist;
		player = (playerScript) FindObjectOfType(typeof(playerScript));
		pDist = gameObject.GetComponent<distanceCheck>();
        

		if (journal.inventory.Contain (iHoldThis)) {	
			Debug.Log ("inside");
			DestroyObject (gameObject);
		}
	}
Example #41
0
    void Awake()
    {
        player 		= PC.GetComponent <playerScript> ();
        inv		 	= holder.GetComponent <cameraScript> ();
        m			= holder.GetComponent <menuScript> ();
        //badge 		= maria.GetComponent <mariaBehavior> ();

        if (Application.loadedLevel == 1)
        {
            key 		= npc.GetComponent <securityBehavior> ();
            badge 		= picture.GetComponent <pictureScript> ();
        }
    }
Example #42
0
	void Update(){

		if (clickedOnSomething) 
			onMouseMiss ();

		if (player == null)
			player = (playerScript) FindObjectOfType(typeof(playerScript));

		if (player.canWalk == true  && clickedOnSomething)
		if (pDist.isCloseEnough(player.transform.position)) 
			revealItem();

	}
Example #43
0
    //private pictureScript	pic;
    void Awake()
    {
        // Variables to hold the scripts on other game objects so that we can manipulate them from this script
        mouse 		= pc.GetComponent <MouseLook> ();
        //movement 	= pc.GetComponent <CharacterMotor> ();
        cam 		= Camera.main.GetComponent <MouseLook> ();
        inventory 	= this.GetComponent <cameraScript> ();
        message 	= text.GetComponent <uiSystem> ();
        cursor		= gui.GetComponent <guiSystem> ();
        //pic 		= picture.GetComponent <pictureScript> ();

        if (Application.loadedLevel == 3)
        {
            talk 	= SH.GetComponent <playerScript> ();
        }

        else
        {
            talk 	= pc.GetComponent <playerScript> ();
        }
    }
Example #44
0
	// Use this for initialization
	void Start () {
		player = (playerScript) FindObjectOfType(typeof(playerScript));

		sceneInit ();

		if (loadNewXML || !Dialoguer.isInitialized ()) {
						Dialoguer.Initialize (dialoguer);
			GameManager.offset = 0;

			if (GameManager.offset == 0)
				GameManager.offset = setOffset;

			setOffset = 0;
				}

		GameManager.dialogueJustFinished = false;

		if (autoPlay) 
			playDialogue();
			
		
	}
Example #45
0
	void Start () {
		_isActive = false;
		_player = playerScript.instance;	
	}
Example #46
0
	void Start(){
		player = (playerScript) FindObjectOfType(typeof(playerScript));
		orderCount++;
		order = orderCount;
	}
Example #47
0
 void Start() {
     aud = GetComponent<AudioSource>();
     thisPScr = GetComponent<playerScript>();
 }
Example #48
0
	// Use this for initialization
	void Start () {
		player = (playerScript)FindObjectOfType(typeof(playerScript));
	}
Example #49
0
 void Awake()
 {
     // Variables to hold the scripts on other game objects so that we can manipulate them from this script
     cam 		= holder.GetComponent <cameraScript> ();
     //chosen 		= holder.GetComponent <timeChanger> ();
     menu 		= holder.GetComponent <menuScript> ();
     message 	= text.GetComponent <uiSystem> ();
     mouse 		= pc.GetComponent <MouseLook> ();
     look 		= Camera.main.GetComponent <MouseLook> ();
     movement 	= pc.GetComponent <CharacterMotor> ();
     info 		= this.GetComponent <displayInfo> ();
     talk 		= pc.GetComponent <playerScript> ();
     pic 		= picture.GetComponent <pictureScript> ();
     cursor 		= gui.GetComponent <guiSystem> ();
 }
Example #50
0
	public void Start(){
		player = (playerScript) FindObjectOfType(typeof(playerScript));
		offset = GameManager.offset;
		pDist = gameObject.GetComponent<distanceCheck>();
	}
Example #51
0
 void Update()
 {
     if (null == player) {
         playerScript[] players = (playerScript[]) FindObjectsOfType (typeof(playerScript));
         for (int i = 0; i < PhotonNetwork.playerList.Length; i++) {
             if (players [i].gameObject.GetPhotonView ().isMine) {
                 player = players [i];
             }
         }
     } else {
         if (Input.GetMouseButtonDown (0)) {
             TileClicked ();
         }
         CheckProximity ();
     }
 }
Example #52
0
	void Update(){
		
		
		if (player == null)
			player = (playerScript) FindObjectOfType(typeof(playerScript));

		if (clickedOnSomething) 
			onMouseMiss ();

		if (!wall) {
			if (player.canWalk == true && clickedOnSomething) 
				if (pDist.isCloseEnough (player.transform.position))
						startDialogue ();
		} else if (wall && clickedOnSomething){
			player.stopMove();

			clickedOnSomething = false;
		}

	}
Example #53
0
 // Use this for initialization
 void Start()
 {
     player = transform.GetComponentInParent<playerScript>();
     cardSprite = (GameObject) Instantiate(Resources.Load("Prefabs/CardSprite"));
     cardSprite.transform.SetParent(transform, false);
     cardSprite.transform.localPosition = new Vector2(0,0);
     LoadSprite();
     cardSprite.GetComponent<Button>().onClick.AddListener(() => {cardOnClick();});
     topCost = new List<Cost>();
     bottomCost = new List<Cost>();
     switch (cardType) {
     case Toolbox.CardType.Action:
         bottomCost.Add (new Cost(1, ColourToEnergy()));
         break;
     case Toolbox.CardType.DMD:
         topCost.Add (new Cost(1, ColourToEnergy()));
         bottomCost.Add (new Cost(1, ColourToEnergy()));
         bottomCost.Add (new Cost(1, Toolbox.EnergyColour.Dark));
         break;
     case Toolbox.CardType.Artifact:
         bottomCost.Add (new Cost(0, Toolbox.EnergyColour.Dark, true));
         break;
     default:
         break;
     }
 }
Example #54
0
 void Awake()
 {
     // Variables to hold the scripts on other game objects so that we can manipulate them from this script
     cam 		= holder.GetComponent <cameraScript> ();
     //chosen 		= holder.GetComponent <timeChanger> ();
     menu 		= holder.GetComponent <menuScript> ();
     message 	= text.GetComponent <uiSystem> ();
     mouse 		= this.GetComponent <MouseLook> ();
     look 		= Camera.main.GetComponent <MouseLook> ();
     movement 	= this.GetComponent <CharacterMotor> ();
     talk 		= this.GetComponent <playerScript> ();
     core 		= Core.GetComponent <displayInfo> ();
     daphne		= Daphne.GetComponent <displayInfo> ();
     ic			= Core.GetComponent <icScript> ();
     scepter		= scepterBroken.GetComponent <displayInfo> ();
     okScepter	= Scepter.GetComponent <displayInfo> ();
     cursor		= gui.GetComponent <guiSystem> ();
 }
Example #55
0
	void Update(){

		if (player == null)
			player = (playerScript) FindObjectOfType(typeof(playerScript));

	}
Example #56
0
	IEnumerator wait(){
		SoundManager.Instance.Play2DMusic (playMe);
		if (dialogue.Length != 0) {
			if (!GameManager.dialogueJustFinished) {
					player = (playerScript)FindObjectOfType (typeof(playerScript));
					if (player != null) {
							player.stopMove ();
							player.talking = true;
							//Debug.LogWarning("TALKING");
					}
			}

			if (GameManager.dialogueJustFinished && curDia < dialogue.Length - 1) {

					GameManager.dialogueJustFinished = false;
					curDia ++;
					Dialoguer.StartDialogue ((int)dialogue [curDia]);

			} else 
			if ((int)dialogue [curDia] >= 0 && GameManager.dialogueJustFinished && curDia == dialogue.Length - 1) {
					if (waitThisLong != -1) {
					if (player != null)
						player.canWalk = false;
							yield return new WaitForSeconds (waitThisLong);
							done = true;
							GameManager.Instance.playerInScene = isTherePlayer;
	
							if (isTherePlayer) {
							
									//Debug.Log ("Setting nexts to " + spawnHereAfter.x + " and " + spawnHereAfter.y);
									GameManager.Instance.SetMainCharacter (whatCharacter);
									GameManager.Instance.SetNextX (spawnHereAfter.x);
									GameManager.Instance.SetNextY (spawnHereAfter.y);
							}
							GameManager.dialogueJustFinished = false;
							SoundManager.Instance.CantWalk ();
							Application.LoadLevel (nextLevel);
					}
			} else if (dialogue [curDia].Equals (Convo.ch0none)) {
					if (waitThisLong != -1) {
							yield return new WaitForSeconds (waitThisLong);
							GameManager.Instance.playerInScene = isTherePlayer;
							done = true;
							if (isTherePlayer) {
									if (!GameManager.Instance.playerInScene) {
											GameManager.Instance.playerInScene = true;
									}
									Debug.Log ("Setting nexts to " + spawnHereAfter.x + " and " + spawnHereAfter.y);
									GameManager.Instance.SetMainCharacter (whatCharacter);
									GameManager.Instance.SetNextX (spawnHereAfter.x);
									GameManager.Instance.SetNextY (spawnHereAfter.y);
							}
							GameManager.dialogueJustFinished = false;
							SoundManager.Instance.CantWalk ();
							Application.LoadLevel (nextLevel);
					}
			}
		} else if (waitThisLong != -1) {
			yield return new WaitForSeconds (waitThisLong);
			done = true;
			GameManager.Instance.playerInScene = isTherePlayer;
			
			if (isTherePlayer) {
				
				//Debug.Log ("Setting nexts to " + spawnHereAfter.x + " and " + spawnHereAfter.y);
				GameManager.Instance.SetMainCharacter (whatCharacter);
				GameManager.Instance.SetNextX (spawnHereAfter.x);
				GameManager.Instance.SetNextY (spawnHereAfter.y);
			}
			GameManager.dialogueJustFinished = false;
			SoundManager.Instance.CantWalk ();
			Application.LoadLevel (nextLevel);
		}
	}
Example #57
0
    bool OutOfBounds(playerScript player)
    {
        if (player.transform.position.magnitude > 250f)
        {
            return true;
        }

        if (player.transform.position.y < -5f)
        {
            return true;
        }

        return false;
    }
Example #58
0
 // assign the playerscript
 public void SetPlayer( playerScript player )
 {
     this.PlayerScript = player;
 }
Example #59
0
	public void sceneInit(){
		if (FindObjectOfType(typeof(AstarPath)) != null)
			AstarPath.active.Scan ();
		backEffect = (GameObject)Instantiate(Resources.Load("effect"));
		if (GameManager.Instance.playerInScene) {
			string temp = (string)GameManager.Instance.GetMainCharacter ();
			var Player = (GameObject)Instantiate (Resources.Load ((temp)));
			Vector2 tempVec = transform.position;
			tempVec.x = GameManager.Instance.GetNextX ();
			tempVec.y = GameManager.Instance.GetNextY ();

			Player.transform.position = tempVec;
			player = Player.GetComponent<playerScript>();
			player.canScale = true;
			player.GetComponent<playerScript> ().scaleInfo = new float[4]{minScale, maxScale, minY, maxY};
			player.GetComponent<playerScript> ().baseSpeed = baseSpeed;
		}
		
		GameManager.Instance.updateMouseIcon ("Walk_Icon");
	}