コード例 #1
0
        public void EnemyAwake()
        {
            _transform              = GetComponent <Transform>();
            head                    = _transform.GetChild(0);
            mesh                    = GetComponent <MeshRenderer>();
            headMesh                = head.GetComponent <MeshRenderer>();
            gun                     = _transform.GetChild(1).GetComponent <MeshRenderer>();
            knife                   = _transform.GetChild(3).GetComponent <MeshRenderer>();
            knife.enabled           = false;
            gunBarrelEnd            = _transform.GetChild(2);
            gunShotSound            = gunBarrelEnd.GetComponent <AudioSource>();
            headMesh.material.color = new Color(1, 0.9058824f, 0.6745098f, 1);
            agent                   = GetComponent <NavMeshAgent>();
            rb               = GetComponent <Rigidbody>();
            enemyBorder      = GetComponent <CapsuleCollider>();
            healthBar        = GetComponent <EnemyHealthBarUI>();
            enemyView        = GetComponent <SphereCollider>();
            shootLine        = GetComponentInChildren <LineRenderer>();
            player           = GameObject.FindGameObjectWithTag("Player");
            enemyView.radius = specification.ViewDistance;
            bloodSplash      = this.agent.GetComponent <ParticleSystem>();
            conditions       = new BaseConditions(specification.GetCharacterConditionsList(),
                                                  new CharacterConditionsSpecifications(specification));

            controller = new EnemyController(_transform, agent, mesh, headMesh, gun, knife, gunBarrelEnd, rb,
                                             enemyBorder,
                                             enemyView, shootLine, specification, _transform.position, player, gunShotSound, conditions, healthBar);
            controller.EnemyControllerAwake();
        }
コード例 #2
0
ファイル: Enemy.cs プロジェクト: ONCGM/Projeto-VII
        #pragma warning restore 0649

        // Unity Events.
        protected virtual void Start()
        {
            eventEmitter      = GetComponentInChildren <StudioEventEmitter>();
            attackingCollider = GetComponentInChildren <SphereCollider>();
            hpBarUI           = GetComponentInChildren <EnemyHealthBarUI>();
            GameMaster.OnGameExecutionStateUpdated += GameStateUpdated;
            SetEnemyValues();
            InvokeRepeating(nameof(RecoverStamina), 1f, 1f);
        }
コード例 #3
0
ファイル: EnemyController.cs プロジェクト: ilay00/VanHelsing
        public EnemyController(Transform enemyTransform, NavMeshAgent agent, MeshRenderer mesh, MeshRenderer headMesh,
                               MeshRenderer gun, MeshRenderer knife, Transform gunBarrelEnd, Rigidbody rb, CapsuleCollider enemyBorder,
                               SphereCollider enemyView, LineRenderer shootLine, EnemySpecifications spec, Vector3 homePoint,
                               GameObject player, AudioSource gunShotSound, BaseConditions conditions, EnemyHealthBarUI healthBar)
        {
            this.enemyTransform = enemyTransform;
            this.agent          = agent;
            this.mesh           = mesh;
            this.headMesh       = headMesh;
            this.enemyBorder    = enemyBorder;
            this.enemyView      = enemyView;
            this.rb             = rb;
            this.shootLine      = shootLine;
            this.gun            = gun;
            this.knife          = knife;
            this.gunBarrelEnd   = gunBarrelEnd;
            this.gunShotSound   = gunShotSound;
            this.homePoint      = homePoint;
            this.player         = player;
            this.healthBar      = healthBar;
            #region Mod

            #region Old

            //this.hp = spec.HP;
            //this.speed = spec.Speed;
            //this.runSpeed = spec.RunSpeed;
            //this.chasingTime = spec.ChasingTime;
            //this.patrolDistance = spec.PatrolDistance;
            //this.type = spec.Type;
            //this.rangeDistance = spec.RangeDistance;
            //this.rangeDamage = spec.RangeDamage;
            //this.rangeAccuracy = spec.RangeAccuracy;
            //this.shootSpeed = spec.ShootSpeed;
            //this.meleeDistance = spec.MeleeDistance;
            //this.meleeDamage = spec.MeleeDamage;
            //this.hitSpeed = spec.HitSpeed;

            #endregion

            this.spec = spec;

            MaximumHP = spec.HP;

            this.conditions = conditions;

            CharacterModel = new BaseCharacterModel(spec.HP, spec.Speed, spec.RunSpeed);

            #endregion
        }