Esempio n. 1
0
        //初始化属性 获取物体 组件
        protected void InitAttribute()
        {
            _hpSlider  = GameTool.GetComFromObjectsChild <Slider>(_entityGameObject, "Slider");
            _hpTextCom = GameTool.GetComFromObjectsChild <Text>(_entityGameObject, "Text");
            _hpCanvas  = GameTool.FindGameObjectByParent(_entityGameObject, "Canvas");

            _canvasInitScale = _hpCanvas.transform.localScale;
            _maxHp           = _currentHp = 1000;
            _moveSpeed       = 10;
            _isActive        = false;
        }
Esempio n. 2
0
 public LaserTurret() : base("laser_turret", 1)
 {
     _laserObject = GameObject.Instantiate(Singleton <ResourcesFactory> .Instance.GetGameObject("laser"),
                                           GameTool.noUsePosition, Quaternion.identity);
     _laserLineRenderer = _laserObject.GetComponent <LineRenderer>();
     _laserLineRenderer.SetPositions(new Vector3[] { Vector3.zero, Vector3.zero });
     _rotateObject     = GameTool.GetComFromObjectsChild <Transform>(_entityGameObject, "Rotate");
     _attackTransforms = new Transform[4];
     for (int i = 1; i <= 4; i++)
     {
         _attackTransforms[i - 1] = GameTool.GetComFromObjectsChild <Transform>(
             _entityGameObject, "AttackDirection" + i);
     }
     _attackTransform = GameTool.GetComFromObjectsChild <Transform>(_entityGameObject, "AttackDirection1");
 }
 //如果是特定类型的对象所具备的组件则在该类中获取  否则在子类中获取
 public TankTurret() : base("tank_turret", 0)
 {
     _rotateObject    = GameTool.GetComFromObjectsChild <Transform>(_entityGameObject, "Rotate");
     _attackTransform = GameTool.GetComFromObjectsChild <Transform>(_entityGameObject, "AttackDirection");
 }