public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            if (!EditorApplication.isPlaying)
            {
                return;
            }

            ShovelScript myScript = (ShovelScript)target;

            _shovelAmount = EditorGUILayout.IntField("Shovel Amount", _shovelAmount);

            _shovelUpgrade = EditorGUILayout.IntField("upgrade shovel 0-2", _shovelUpgrade);

            if (GUILayout.Button("change Shovel Amount"))
            {
                myScript.ShovelAmount = _shovelAmount;
            }


            if (GUILayout.Button("Upgrade Shovel"))
            {
                myScript.UpgradeShovel(_shovelUpgrade);;
            }

            if (GUILayout.Button("Downgrade Shovel"))
            {
                myScript.DowngradeShovel(_shovelUpgrade);
            }
        }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        LeftTrigger     = "p" + playerNum + "LeftTrigger";
        RightTrigger    = "p" + playerNum + "RightTrigger";
        LeftBumper      = "p" + playerNum + "LeftBumper";
        RightBumper     = "p" + playerNum + "RightBumper";
        LeftX           = "p" + playerNum + "LeftX";
        LeftY           = "p" + playerNum + "LeftY";
        RightX          = "p" + playerNum + "RightX";
        RightY          = "p" + playerNum + "RightY";
        AButton         = "p" + playerNum + "A";
        RightStickClick = "p" + playerNum + "RightStickClick";

        rend      = GetComponent <SpriteRenderer>();
        rb        = GetComponent <Rigidbody2D>();
        playerCol = GetComponent <BoxCollider2D>();
        lastGrave = null;
        inHitstun = false;
        frames    = 0;

        //get enemy player num once lol this took me years
        enemyPlayerNum = (playerNum == 1) ? 2 : 1;

        dashCount = dashMax;

        playerShovel = GetComponentInChildren <ShovelScript>();

        //   acceleration = Vector2.zero;
        force = Vector2.zero;
        speed = Vector2.zero;

        spawnManager = GameObject.Find("RespawnManager").GetComponent <RespawnScript>();
        scoreManager = GameObject.Find("ScoreManager").GetComponent <ScoreScript>();
        collManager  = GameObject.Find("CollisionManager").GetComponent <CollisionScript>();
        cameraShake  = GameObject.Find("Main Camera").GetComponentInChildren <CameraShakeScript>();

        hpVisual = GameObject.Find("P" + playerNum + "HP").GetComponentInChildren <HPScript>();
        //transform.position = spawnManager.getSpawnpoint(playerNum).position;

        health = maxHealth;
        hpVisual.updateVisual(health);
        hitstunTimer = hitstunMaxTimer;

        slayTimer = 0;

        //position = transform.position;
    }