Пример #1
0
    private void ProcessHit(damageenemyLaser damageDealer)
    {
        float aDamage;

        AudioSource.PlayClipAtPoint(bClip, Camera.main.transform.position, aVolume);
        aDamage = damageDealer.GetDamage();
        health -= aDamage;

        damageDealer.Hit();
        if (health <= 00)
        {
            Debug.Log(1.0f / Time.deltaTime);
            // Destroy(gameObject);
            // Debug.Log("destroy player!");

            //GameObject.Find("gameScore").GetComponent<keepScor>().ResetGame();
            //FindObjectOfType<gameManage>().playerShot();
            health = StartHealth;
            aKeepScore.Resetcore();
            /* this will reset score and cause us to wait a couple seconds*/
            if (agent != null)
            {
                agent.IncrementReward(-0.2f);
            }
        }
        else
        {
            if (agent != null)
            {
                // agent.IncrementReward(-aDamage / StartHealth);
                agent.IncrementReward(-0.2f);
            }
        }
    }
Пример #2
0
    public void addScore(int aScore)
    {
        if (player != null && player.activeSelf)
        {
            {
                float xIncrement = 0.09f;
                gameScore += aScore;
                if (agent != null)
                {
                    agent.IncrementReward(xIncrement);
                }

                //Debug.Log(gameScore);
            }
        }
    }