// Update is called once per frame void Update() { scoreTimer += Time.deltaTime; if (scoreTimer >= 3) { scoreTimer = 0; float tmpScore = data.GetScore(); if (tmpScore > 10) { data.SetScore(-10); } } if (data.GetScore() >= 100.0f) { pooping(); data.SetScore(-10); } Moving(); if (data.GetPlayerState() == playerData.PlayerState.monster) { timeCount += Time.deltaTime; if (timeCount >= 10) { timeCount -= 10.0f; TurnHuman(); } } }
private void OnTriggerEnter2D(Collider2D col) { // score-- playerData col_data = col.gameObject.GetComponent <playerData>(); if (col_data.GetPlayerState() == playerData.PlayerState.human) { col_data.SetScore(-1); col.gameObject.GetComponent <player>().stepPoop(); // pic } else { Destroy(gameObject); } }
void autoShoot() { autoShootTimer += Time.deltaTime; if (data.GetPlayerState() == playerData.PlayerState.monster) { if (autoShootTimer > data.autoShootTime) { autoShootTimer = 0; body.AddForce(data.GetOppositePlayerPos() * shootStrength, ForceMode2D.Impulse); data.SetPlayerPos(playerData.Pos.none); data.SetAnimation("fly"); music.playMusic("shoot"); } } }