コード例 #1
0
    void Awake()
    {
        _playerCollisions = player.GetComponent <PlayerCollisionScript>();
        if (_playerCollisions == null)
        {
            Debug.LogError("Player object is broken");
        }
        _playerCollisions.LevelMgr = this;

        _pathFollower = player.GetComponent <PathFollower>();
        if (_pathFollower == null)
        {
            Debug.LogError("Player object is broken");
        }

        _playerSelector = player.GetComponent <PlayerSeletor>();
        if (_playerSelector == null)
        {
            Debug.LogError("Player object is broken");
        }

        if (checkpoints == null || checkpoints.Length == 0)
        {
            Debug.LogError("No checkpoint for level are set");
        }
        currentCheckpoint = checkpoints[0];

        DragController.instance.LevelMgr = this;
    }
コード例 #2
0
 void OnTriggerEnter(Collider other)
 {
     if (HeroMovements.verifyIfAttack() && other.tag == "Enemy" && !invincible)
     {
         combatScript.removeEnemyLife(getDamage(), other.gameObject);
         PlayerCollisionScript.updateEnemyHP(other.gameObject, transform.position);
         invincible = true;
         Invoke("resetEnemyInvulnerability", 1);
     }
 }
コード例 #3
0
 //[SerializeField]
 //internal PlayerAnimation animationScript;
 //[SerializeField]
 //internal PlayerHealthController healthScript;
 // Start is called before the first frame update
 void Start()
 {
     //Initialize things, set necessary variables.
     inputScript     = GetComponent <PlayerInputScript>();
     movementScript  = GetComponent <PlayerMovementScript>();
     climbingScript  = GetComponent <PlayerClimbingScript>();
     collisionScript = GetComponent <PlayerCollisionScript>();
     //animationScript = GetComponent<PlayerAnimation>();
     //healthScript = GetComponent<PlayerHealthController>();
     playerTransform = GetComponent <Transform>();
     GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY;
     GetComponent <MeshCollider>().convex   = true;
 }
コード例 #4
0
    private void sendData()
    {
        AndroidJavaClass  unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject activity    = unityPlayer.GetStatic <AndroidJavaObject>("currentActivity");

        activity.Call("setHighScore", ScrollingScript.getHeight(), PlayerCollisionScript.getKills());
        activity.Call("setPowerups", convertPowerups());
        activity.Call("addCoins", (PlayerCollisionScript.getKills() * 10) + ScrollingScript.getHeight());

        ParseObject scoreObject = new ParseObject("Highscore");

        scoreObject["UserName"]  = name;
        scoreObject["UserScore"] = ScrollingScript.getHeight();
        scoreObject.SaveAsync();
    }
コード例 #5
0
ファイル: ShowSummary.cs プロジェクト: SalomonKoen/Jumpy_New
    void OnGUI()
    {
        GUIStyle textStyle = new GUIStyle("label");

        textStyle.alignment = TextAnchor.MiddleCenter;
        textStyle.fontSize  = 80;
        textStyle.fontStyle = FontStyle.Bold;
        // Make a background box

        GUIStyle buttonStyle = new GUIStyle("button");

        buttonStyle.fontSize = 50;

        GUI.Box(new Rect(10, 10, Screen.width - 20, Screen.height - 20), "");

        GUI.Label(new Rect(Screen.width / 2 - 400, 50, 800, 150), "Summary", textStyle);

        GUIStyle centeredTextStyle = new GUIStyle("label");

        centeredTextStyle.alignment = TextAnchor.MiddleCenter;
        centeredTextStyle.fontSize  = 50;
        centeredTextStyle.fontStyle = FontStyle.Bold;

        GUI.Label(new Rect(Screen.width / 2 - 400, 150, 800, 150), "Height: " + ScrollingScript.getHeight(), centeredTextStyle);
        GUI.Label(new Rect(Screen.width / 2 - 400, 250, 800, 150), "Kills: " + PlayerCollisionScript.getKills(), centeredTextStyle);


        if (!FB.IsLoggedIn)
        {
            //GUI.Label((new Rect(179 , 11, 287, 160)), "Login to Facebook");
            if (GUI.Button(new Rect(Screen.width / 2 - 300, 400, 600, 130), "Login to Facebook", buttonStyle))
            {
                //FB.Login("email,publish_actions", LoginCallback);
            }
        }

        // Make the second button.
        else if (GUI.Button(new Rect(Screen.width / 2 - 200, 400, 400, 130), "Share", buttonStyle))
        {
            if (FB.IsLoggedIn)
            {
                /*FB.Feed(
                 *      linkCaption: "I just reached " + PlayerScript.distance + "! Can you beat it?",
                 *      picture: "http://www.friendsmash.com/images/logo_large.jpg",
                 *      linkName: "Checkout my Jumpy greatness!",
                 *      link: "http://apps.facebook.com/" + FB.AppId + "/?challenge_brag=" + (FB.IsLoggedIn ? FB.UserId : "guest")
                 *      );*/
            }
        }

        // Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
        if (GUI.Button(new Rect(Screen.width / 2 - 200, 550, 400, 130), "Restart", buttonStyle))
        {
            PlayerScript.distance = 0;
            Time.timeScale        = 1;

            Application.LoadLevel(0);
        }



        if (GUI.Button(new Rect(Screen.width / 2 - 200, 700, 400, 130), "Main Menu", buttonStyle))
        {
            Application.Quit();
        }
    }