示例#1
0
    ///////////////////////////

    //////////////////////////////////////////////////////////////////////////

    public override void InitializeAgent()
    {
        //Debug.LogWarning("INIT CALLED");
        infoScript = InfoScript.instance;

        base.InitializeAgent();

        _rayPercept = GetComponent <RayPerception>();
        agentRB     = GetComponent <Rigidbody>();
        _renderer   = GetComponent <MeshRenderer>();

        _moveSpeed   = infoScript.moveSpeed_playerAgent;
        _turnDegree  = infoScript.turnDegree_playerAgent;
        _rayDistance = infoScript.rayDistacne_agent;
        _shotAngle   = infoScript.shotDegree;
        _shotRange   = infoScript.shotRange;

        _hitDmg = infoScript.dmg_playerAgent;
        //_rayAngle = infoScript.rayAngle_agent;
        _hp = infoScript.fullHp_playerAgent;
        _renderer.material = infoScript.GetHP_Material(false, _hp);

        _shotCoolTime = infoScript.shotCoolTime_playerAgent;
        _curState     = AgentState.shotReady;

        ResetAgentValue();
    }
示例#2
0
    void SetZombieInitValue()
    {
        InfoScript infoScript = InfoScript.instance;

        _moveSpeed         = infoScript.moveSpeed_zombie;
        _turnSpeed         = infoScript.turnDegree_zombie;
        _hitDmg            = infoScript.dmg_zombie;
        _hp                = infoScript.fullHp_zombie;
        _renderer.material = infoScript.GetHP_Material(true, _hp);
        _attackCooltime    = infoScript.coolTime_zombie;
        _prevAttackTime    = 0f;
        _zombieState       = ZombieState.attackReady;

        _isDead = false; // TODO : change set this in mgr (why? episiode reset)
    }
示例#3
0
    void UpdateHp(float inputDmg)
    {
        if (_curState == AgentState.dead)
        {
            return;
        }

        if (_hp > inputDmg)
        {
            _hp -= inputDmg;
            _renderer.material = infoScript.GetHP_Material(true, _hp);
            AddReward(InfoScript.instance.reward_receiveDamage);
        }

        else
        {
            _hp       = 0;
            _curState = AgentState.dead;
            AddReward(InfoScript.instance.reward_agentDeath);

            this.gameObject.SetActive(false);
            zombieGround.instance.AgentDead(this.gameObject);
        }
    }