Beispiel #1
0
    public void damageHealth()
    {
        --health;

        hpVisual.updateVisual(health);

        frames = 0;

        inHitstun = true;

        if (health == 0)
        {
            markedForDeath = true;
        }
    }
Beispiel #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;
    }