コード例 #1
0
 void Start()
 {
     detectionComponent  = GetComponent <DetectionComponent>();
     navigationComponent = GetComponent <NavigationComponent>();
     gunComponent        = GetComponent <Gun>();
     healthComponent     = GetComponent <HealthComponent>();
     healthComponent.RestoreHealth(100);
 }
コード例 #2
0
    public void Setup(DetectionComponent detectionComponent, float speedRotation)
    {
        _detectionComponent = detectionComponent;
        _detectionComponent.OnDetectedTarget     += SetTarget;
        _detectionComponent.OnDetectedTargetLose += CleanTarget;

        _speedRotation = speedRotation;

        _enable = true;
    }
コード例 #3
0
    public void Setup(DetectionComponent detectionComponent, Weapon weapon, float delayToStartFiring)
    {
        _detectionComponent = detectionComponent;
        _detectionComponent.OnDetectedTarget     += EnableFire;
        _detectionComponent.OnDetectedTargetLose += DisableFire;

        _weapon = weapon;

        _delayToStartFiring = delayToStartFiring;

        _enable = true;
    }
コード例 #4
0
ファイル: Enemy.cs プロジェクト: PeCHe87/SpaceShoter
    private void Awake()
    {
        Health = GetComponent <HealthController>();

        if (Health != null)
        {
            Health.SetMaxHealth(_data.MaxHealth);
            Health.OnDead += Dead;
        }

        _detectionComponent = GetComponent <DetectionComponent>();

        _aimingComponent = GetComponent <AimingComponent>();

        _firingComponent = GetComponent <FiringComponent>();

        _weapon = GetComponent <Weapon>();

        GameEventsManager.OnPlayerDead += DeactivateComponents;
    }