Exemple #1
0
    public override void OnEpisodeBegin()
    {
        currentLap = 1;
        ResetAgentCheckPoints();
        currentHp = hp;
        healthBar.ChangeHP(hp, currentHp);

        flipCheck = false;
        if (flipCor != null)
        {
            StopCoroutine(flipCor);
        }

        if (training)
        {
            int randomInd = Random.Range(0, startPositions.Length - 1);
            transform.position = startPositions[randomInd].position;
        }
        else
        {
            transform.position = spawnPosition;
        }

        transform.rotation = spawnRotation;
        rb.velocity        = Vector3.zero;
        rb.angularVelocity = Vector3.zero;
    }
Exemple #2
0
 public virtual void Damage(List <AttackType> damageTypeList, float damage)
 {
     foreach (AttackType damageType in damageTypeList)
     {
         healthArray[0] -= damage * ((1f - defenseArray[GameManager.attackTypeDickToArray[damageType]]) / (float)damageTypeList.Count);
     }
     if (healthBar)
     {
         healthBar.ChangeHP(healthArray[0]);
     }
     if (healthArray[0] <= 0)
     {
         Die();
     }
 }