Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        hazard         = GetComponentInChildren <Collider2D> ();
        hazard.enabled = false;
        PlayerYuni player = GameObject.FindObjectOfType <PlayerYuni>();

        playerAnimator = player.GetComponent <Animator> ();
        hammerAnimator = gameObject.GetComponentInChildren <Animator> ();



        playerTransform = player.transform;
        hammerTransform = GameObject.FindGameObjectWithTag("Hammer Child").transform;

        this.hammerEffect.SetHammerEffect(this.effectHammerSmash);

        this.playerAttack   = player.GetComponent <PlayerAttack> ();
        this.numeratorLabel = playerAttack.getNumeratorLabel();

        this.breakerCollider = GetComponentInChildren <BreakerCollider> ();
        this.isAllowed       = true;
//		#if UNITY_ANDROID
//		mobile = GameObject.Find("Mobile UI").GetComponent<MobileUI> ();
//		#endif
//		this.breakerCollider ;
//		this.audioSmash = GetComponent<AudioSource> ();
    }
Esempio n. 2
0
    /// <summary>
    /// Player avatar carries this block.
    /// </summary>
    /// <param name="parent">Object carrying the block.</param>
    /// <param name="position">Place where the block is held.</param>
    public void Carry(GameObject parent, Vector3 position)
    {
        if (this.IsSolved())
        {
            if (parent.GetComponent <PlayerYuni> () != null)
            {
                this.player = parent.GetComponent <PlayerYuni> ();
            }

            this.isCarried = true;
            //			this.respawnPosition = gameObject.transform;
            this.Unobserve();
            //			this.SetCarried (true);
            //			HideLabel ();
            //			this.hintBubble.HideHint ();
            this.ChangeColor(this.tangibleColor, this.tangibleOutlineColor);
            this.gameObject.layer = LayerMask.NameToLayer(DEFAULT_LAYER);
            //			this.GetStabilityLabel ().Sleep ();
            this.GetRigidBody2D().bodyType        = RigidbodyType2D.Kinematic;
            this.GetRigidBody2D().velocity        = Vector2.zero;
            this.GetRigidBody2D().angularVelocity = 0f;
            gameObject.transform.SetParent(parent.transform);
            gameObject.transform.localPosition = position;
            gameObject.transform.eulerAngles   = new Vector3(0f, 0f, -45f);
            this.boxCollider.isTrigger         = true;
        }
    }
Esempio n. 3
0
    // Use this for initialization
    void Awake()
    {
        playerTransform      = GameObject.FindObjectOfType <PlayerYuni> ().gameObject.transform;   // GameObject.FindGameObjectWithTag ("Player").transform;
        playerAnimator       = playerTransform.gameObject.GetComponent <Animator> ();
        playerSpriteRenderer = playerTransform.gameObject.GetComponent <SpriteRenderer> ();
        this.playerAttack    = playerTransform.gameObject.GetComponent <PlayerAttack> ();

        spriteRenderer   = GetComponent <SpriteRenderer> ();
        needleCollider   = GetComponent <Collider2D> ();
        threadRenderer   = GetComponent <LineRenderer> ();
        needleController = GetComponent <NeedleController> ();

        needleExtendedTransform = needleController.gameObject.GetComponentInChildren <Transform> ().position;

        // NEW @Candy
        this.playerYuni     = GameObject.FindObjectOfType <PlayerYuni>();
        this.playerMovement = playerYuni.GetPlayerMovement();



        needleCollider.enabled = false;
        flying      = false;
        pullTowards = false;

        GameController_v7.Instance.GetPauseController().onContinueGame += NeedleUpdate;
        GameController_v7.Instance.GetPauseController().onPauseGame    += Pause;
        GameController_v7.Instance.GetPauseController().onContinueGame += Continue;
    }
Esempio n. 4
0
 public PlayerYuni GetPlayer()
 {
     if (this.player == null)
     {
         this.player = GetComponentInParent <PlayerYuni> ();
     }
     return(this.player);
 }
Esempio n. 5
0
 private PlayerYuni GetPlayer()
 {
     if (this.player == null)
     {
         this.player = FindObjectOfType <PlayerYuni> ();
     }
     return(this.player);
 }
 public PlayerYuni GetPlayer()
 {
     if (this.player == null)
     {
         this.player = GameObject.FindObjectOfType <PlayerYuni> ();
     }
     return(this.player);
 }
Esempio n. 7
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.GetComponent <PlayerYuni> ())
     {
         player = other.gameObject.GetComponent <PlayerYuni> ();
         PlayScenes();
     }
 }
Esempio n. 8
0
    protected virtual void Start()
    {
        Debug.Log("INIT");
        player = GameObject.FindObjectOfType <PlayerYuni>();

        this.enemyHealth   = GetComponent <EnemyHealth> ();
        this.enemyAttack   = GetComponent <EnemyAttack> ();
        this.enemyMovement = GetComponent <EnemyMovement> ();
        Debug.Log("<color=red>INIT" + this.enemyHealth + "</color>");
    }
Esempio n. 9
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.GetComponent <PlayerYuni>() != null)
     {
         player           = other.gameObject.GetComponent <PlayerYuni> ();
         playerAttack     = player.GetPlayerAttack();
         playerController = player.GetPlayerMovement();
         PlayScenes();
     }
 }
Esempio n. 10
0
    /// <summary>
    /// Starts this instance.
    /// </summary>
    void Start()
    {
        needle           = Instantiate(needlePrefab, transform.position, Quaternion.identity);
        needleThrowing   = needle.GetComponent <NeedleThrowing> ();
        needleController = needle.GetComponent <NeedleController> ();


//		if (PlayerPrefs.HasKey ("Player_" + GameController_v7.Instance.GetObjectStateManager().currentPlayerName)) {
//			string playerJSON = PlayerPrefs.GetString ("Player_" + GameController_v7.Instance.GetObjectStateManager().currentPlayerName);
//			PlayerJSONParams playerStats = JsonUtility.FromJson<PlayerJSONParams> (playerJSON);
//			this.hasNeedle = playerStats.hasNeedle;
//			this.hasHammer = playerStats.hasHammer;
//			this.hasThread = playerStats.hasThread;
//			this.equippedDenominator = playerStats.equppedDenominator;
//		}

        this.player = GameObject.FindObjectOfType <PlayerYuni>().GetComponent <PlayerYuni>();


        playerAnimator   = player.GetPlayerAnimator();
        playerController = player.GetPlayerMovement();

        this.fractionNumeratorLabelObject = this.fractionNumeratorLabel.gameObject;
        this.fractionLabelObject.SetActive(false);
        this.numeratorLabelObject.SetActive(false);


        this.listTextMesh = new List <TextMesh> ();
        listTextMesh.Add(numeratorLabel);
        listTextMesh.Add(fractionNumeratorLabel);
        listTextMesh.Add(fractionDenominatorLabel);

        EventBroadcaster.Instance.AddObserver(EventNames.ON_LCD_UNPAUSE, this.IsLCDHit);

        this.hammerAttack.SyncWithEquippedDenominator(this.equippedDenominator);
        Debug.Log("<color=green>Equipped is " + equippedDenominator + "</color>");
        this.needleController.SyncWireSliceCountWithEquippedDenominator(this.equippedDenominator);
        this.hammerAttack.DisableBreaker();


        if (!this.HasHammer())
        {
                        #if UNITY_ANDROID
            GameController_v7.Instance.GetMobileUIManager().ToggleMobileControls(false);
            GameController_v7.Instance.GetMobileUIManager().ToggleBaseWithPickupControls(true);
                        #endif
        }
        if (this.HasNeedle())
        {
            EventBroadcaster.Instance.PostEvent(EventNames.YUNI_ACQUIRED_NEEDLE);
        }

//		EventBroadcaster.Instance.AddObserver (EventNames.ON_LCD_DONE, this.IsLCDDonePlaying);
    }
Esempio n. 11
0
//	private void ToggleMobileUI(bool flag) {
//		#if UNITY_ANDROID
////		EventManager.Instance.ToggleMobileControls(flag);
//
////		GameController_v7.Instance.GetEventManager().ToggleMobileControls(flag);
//		Parameters parameters = new Parameters ();
//		parameters.PutExtra ("FLAG", flag);
//		EventBroadcaster.Instance.PostEvent (EventNames.TOGGLE_MOBILE_UI, parameters);
//		#endif
//	}

    void OnTriggerEnter2D(Collider2D other)
    {
        Debug.Log("Tutorial Trigger : Tag is " + other.tag);
        if (other.gameObject.GetComponent <PlayerYuni>() != null)
        {
            player = other.gameObject;
            PlayerYuni playerStats = player.GetComponent <PlayerYuni> ();
            playerAttack     = playerStats.GetPlayerAttack();
            playerController = playerStats.GetPlayerMovement();
            PlayScenes();
        }
    }
Esempio n. 12
0
 void OnTriggerStay2D(Collider2D other)
 {
     if (other.gameObject.GetComponent <PlayerYuni>() != null)
     {
         playerInVicinity = true;
         player           = other.gameObject.GetComponent <PlayerYuni> ();
         this.GetPlayer().SetPickup(this);
     }
     else
     {
         playerInVicinity = false;
     }
 }
 void OnTriggerStay2D(Collider2D other)
 {
     if (this.isActivated)
     {
         if (other.gameObject.GetComponent <PlayerYuni>() != null)
         {
             Debug.Log("Entered Trampoline");
             PlayerYuni  player      = other.gameObject.GetComponent <PlayerYuni> ();
             PlayerInput playerInput = player.GetPlayerInput();
             PlayerJump(playerInput);
         }
     }
 }
Esempio n. 14
0
    void OnTriggerEnter2D(Collider2D other)
    {
//		if (other.gameObject.CompareTag ("Player")) {
//			playerAttack = other.gameObject.GetComponent<PlayerAttack> ();
//			playerMovement = other.gameObject.GetComponent<PlayerMovement> ();
//
//			PlayScenes ();
//		}
        if (other.gameObject.GetComponent <PlayerYuni> () != null)
        {
            this.player = other.gameObject.GetComponent <PlayerYuni> ();
            PlayScenes();
        }
    }
Esempio n. 15
0
    protected override void Init()
    {
        currentGambit             = null;
        currentRingleaderMovement = null;
        currentRingleaderHealth   = null;
        player = null;
//		playerAttack = null;
//		playerMovement = null;
        foreach (EnemyHealth ringleader in ringleaders)
        {
            ringleader.gameObject.GetComponent <RingleaderAttack> ().enabled   = false;
            ringleader.gameObject.GetComponent <RingleaderMovement> ().canMove = false;
            ringleader.gameObject.GetComponent <EnemyHealth> ().enabled        = false;
        }

        base.Init();
    }
Esempio n. 16
0
//    void Awake () {
//		gameObject.tag = "Player";
    // Setting up references.
//        m_Anim = GetComponent<Animator>();
//        m_Rigidbody2D = GetComponent<Rigidbody2D>();
//		this.playerAttack = GetComponent<PlayerAttack> ();
//    }

    public PlayerMovement(PlayerYuni player)
    {
        this.player        = player;
        this.playerAttack  = player.GetPlayerAttack();
        this.m_Anim        = player.GetPlayerAnimator();
        this.m_Rigidbody2D = player.GetRigidBody2d();

        this.m_GroundCheck = player.GetGroundCheck();
        m_WhatIsGround     = LayerMask.NameToLayer("Ground");

        this.m_AirControl  = true;
        this.m_FacingRight = true;
//		this.m_Anim = playerAnimator;
//		this.m_Rigidbody2D = rigidBody2d;
//		this.playerCollider = playerCollider;
//		this.playerAttack = playerAttack;
    }
Esempio n. 17
0
    void Awake()
    {
        player = GameObject.FindObjectOfType <PlayerYuni> ();
//		playerNeedle = GameObject.FindGameObjectWithTag ("Player").GetComponent<PlayerAttack> ();
//		pauseController = GameObject.FindGameObjectWithTag ("GameController").GetComponent<PauseController> ();
        fillController = GameObject.FindGameObjectWithTag("GameController").GetComponent <FillController> ();
        fractionLabel  = gameObject.GetComponent <PartitionableObjectMarker> ();
                #if UNITY_ANDROID
        mobile = GameObject.Find("Mobile UI").GetComponent <MobileUI> ();
                #endif
//		playerController = GameObject.FindGameObjectWithTag ("Player").GetComponent<PlayerMovement> ();

        partitionPointer = -1;
//		gameObject.transform.position = new Vector3 (0, 0, gameObject.transform.position.z);
//		gameObject.transform.SetPositionAndRotation (new Vector3 (0, 0, gameObject.transform.position.z), Quaternion.identity);
//		gameObject.transform.localPosition = new Vector3 (0, 0, gameObject.transform.position.z);
    }
 void OnTriggerStay2D(Collider2D other)
 {
     if (other.gameObject.GetComponent <PlayerYuni> () != null &&
         (!other.gameObject.GetComponent <PlayerYuni> ().GetPlayerAttack().HasNeedle() ||
          !other.gameObject.GetComponent <PlayerYuni> ().GetPlayerAttack().HasHammer() ||
          other.gameObject.GetComponent <PlayerYuni> ().GetPlayerAttack().getEquippedDenominator() != 0) &&
         !isPlaying && !isTriggered)
     {
         player = other.gameObject.GetComponent <PlayerYuni> ();
         PlayScenes();
     }
     else if (!hasSet)
     {
         this.hasSet = true;
         GameController_v7.Instance.GetMobileUIManager().ToggleMobileControls(false);
         GameController_v7.Instance.GetMobileUIManager().ToggleMobileControls(true);
     }
 }
Esempio n. 19
0
    /// <summary>
    /// Spawn the player avatar on this game object's position.
    /// </summary>
    public void SpawnPlayer()
    {
        Debug.Log("Spawning...");
        Debug.Log("Instantiated");
        this.spawnFacingRight = true;         // added
        if (player == null)
        {
            LoadUserData();
            LoadSkin();
            Debug.LogError("Loaded skin" + GameController_v7.Instance.GetPlayerSkin());
            if (spawnFacingRight)
            {
                GameObject playerObject = Instantiate(playerPrefab, this.gameObject.transform.position, Quaternion.identity);
                this.player = playerObject.GetComponent <PlayerYuni> ();
            }

            else
            {
                GameObject playerObject = Instantiate(playerPrefab, this.gameObject.transform.position, Quaternion.identity);
                playerObject.transform.localScale = new Vector3(-playerObject.transform.localScale.x, playerObject.transform.localScale.y, playerObject.transform.localScale.z);
                this.player = playerObject.GetComponent <PlayerYuni> ();
                player.GetPlayerMovement().Flip();
            }
        }

        player.tag = "Player";
        player.gameObject.SetActive(true);
        player.transform.SetPositionAndRotation(this.gameObject.transform.position, Quaternion.identity);
        this.playerMovement = player.GetPlayerMovement();

        Debug.Log("<color=cyan>Spawn Point : Tag is " + player.tag + "</color>");
//		playerMovement.Flip ();

        if (this.doorStateManager != null)
        {
            this.doorStateManager.PlayerSpawnedHere();
        }
    }
Esempio n. 20
0
 public PlayerInput(PlayerYuni player)
 {
     this.player         = player;
     this.playerMovement = player.GetPlayerMovement();
 }
Esempio n. 21
0
 void Start()
 {
     this.player = FindObjectOfType <PlayerYuni>();
 }
Esempio n. 22
0
 public void SetPlayer(PlayerYuni playerInstance)
 {
     this.player = playerInstance;
 }
Esempio n. 23
0
 /// <summary>
 /// Function called on awake.
 /// </summary>
 /// <returns></returns>
 void Awake()
 {
     this.player = GetComponent <PlayerYuni> ();
 }
Esempio n. 24
0
//	void OnTriggerEnter2D(Collider2D other) {
//		if (other.gameObject.layer == LayerMask.NameToLayer (HOLLOW_BLOCK_LAYER) &&
//			other.GetComponent<HollowBlock>() != null){
//			Debug.Log ("Lift ENTER");
//			this.SetOverlappingPiece (other.GetComponent<HollowBlock> ());
//		}
//	}
    public void SetPlayer(PlayerYuni playerYuni)
    {
        this.player = playerYuni;
    }
Esempio n. 25
0
    /// <summary>
    /// Standard Unity Function. Called once in the game object's lifetime to initiate the script once it has been enabled.
    /// </summary>
    void Start()
    {
//		playerCharacter = GameObject.FindGameObjectWithTag ("Player");
        player         = GameObject.FindObjectOfType <PlayerYuni>();
        playerMovement = player.GetPlayerMovement();
    }