Exemple #1
0
        public override void Postspawn(EnemyAgent agent)
        {
            var tentacleComps    = agent.GetComponentsInChildren <MovingEnemyTentacleBase>(true);
            var isTypeEnabled    = TentacleTypes.Length > 0;
            var isSettingEnabled = TentacleSettings.Length > 0;

            for (int i = 0; i < tentacleComps.Length; i++)
            {
                var tentacle = tentacleComps[i];

                if (isTypeEnabled)
                {
                    var tenType = TentacleTypes[i % TentacleTypes.Length];
                    tentacle.m_GPUCurvyType = tenType;
                    LogVerbose($" - Applied Tentacle Type!, index: {i} type: {tenType}");
                }

                if (isSettingEnabled)
                {
                    var setting = TentacleSettings[i % TentacleSettings.Length];
                    tentacle.m_easingIn           = setting.GetInEaseFunction();
                    tentacle.m_easingOut          = setting.GetOutEaseFunction();
                    tentacle.m_attackInDuration   = setting.InDuration.GetAbsValue(tentacle.m_attackInDuration);
                    tentacle.m_attackOutDuration  = setting.OutDuration.GetAbsValue(tentacle.m_attackOutDuration);
                    tentacle.m_attackHangDuration = setting.HangDuration.GetAbsValue(tentacle.m_attackHangDuration);
                    LogVerbose($" - Applied Tentacle Setting!, index: {i}");
                }
            }
        }
        private void FindGameObjects()
        {
            var parent = GameObject.Find(ParentName);

            laser = parent.GetComponentInChildren <LaserMovement>(true);
            enemy = parent.GetComponentInChildren <EnemyAgent>();
        }
Exemple #3
0
    void UpdateTarget()
    {
        GameObject[] enemies          = GameObject.FindGameObjectsWithTag(enemytag);
        float        shortestDistance = Mathf.Infinity;
        GameObject   nearestEnemy     = null;

        foreach (GameObject enemy in enemies)
        {
            //Debug.Log(enemy.transform.position);
            float distanceToEnemy = Vector3.Distance(transform.position, enemy.transform.position);
            if (distanceToEnemy < shortestDistance)
            {
                shortestDistance = distanceToEnemy;
                nearestEnemy     = enemy;
            }
        }
        if (nearestEnemy != null && shortestDistance <= range)
        {
            target      = nearestEnemy.transform;
            enemyTarget = target.GetComponent <EnemyAgent>();
        }
        else
        {
            target = null;
        }
    }
Exemple #4
0
        protected override void Awake()
        {
            base.Awake();

            anim = GetComponent <Animator>();
            ea   = GetComponent <EnemyAgent>();
        }
Exemple #5
0
    public void SetupBattle(GameObject playerInBattle, GameObject enemyInBattle)
    {
        player     = playerInBattle;
        enemy      = enemyInBattle;
        playerUnit = player.GetComponent <Unit>();
        enemyUnit  = enemy.GetComponent <Unit>();
        StartCoroutine(infoBarManager.UpdateText("You have entered a battle against " + enemyUnit.unitName));
        playerUnit.SetHUD();
        enemyUnit.SetHUD();
        agent = enemy.GetComponent <EnemyAgent>();
        if (!agent.trainingMode)
        {
            agent.UnfreezeAgent();
            DialoguePanel.SetActive(true);
        }
        else
        {
            enemyUnit.currentHP = enemyUnit.maxHP;
            enemyUnit.SetHP();
            playerUnit.currentHP = playerUnit.maxHP;
            playerUnit.SetHP();
        }
        //agent.BattleSystemSc = this;

        SwitchTurn();
    }
 private void NotifyAgentOfPos(Vector3 lastSeenLocation, EnemyAgent agent, bool pDevice)
 {
     if (!(agent.GetState() is ChaseState))
     {
         agent.LastSeenTargetPosition = lastSeenLocation;
     }
 }
        private void OnMarked(EnemyAgent agent, NavMarker marker)
        {
            marker.m_enemySubObj.SetColor(MarkerColor);
            //marker.SetTitle("wew");
            //marker.SetVisualStates(NavMarkerOption.Enemy | NavMarkerOption.Title, NavMarkerOption.Enemy | NavMarkerOption.Title, NavMarkerOption.Empty, NavMarkerOption.Empty);
            //MINOR: Adding Text for Marker maybe?

            if (_Sprite != null)
            {
                var renderer = marker.m_enemySubObj.GetComponentInChildren <SpriteRenderer>();
                renderer.sprite = _Sprite;
            }

            if (BlinkIn)
            {
                CoroutineManager.BlinkIn(marker.m_enemySubObj.gameObject, 0.0f);
                CoroutineManager.BlinkIn(marker.m_enemySubObj.gameObject, 0.2f);
            }

            if (Blink)
            {
                if (BlinkMinDelay >= 0.0f && BlinkMinDelay < BlinkMaxDelay)
                {
                    float duration = Math.Min(BlinkDuration, agent.EnemyBalancingData.TagTime);
                    float time     = 0.4f + UnityEngine.Random.RandomRange(BlinkMinDelay, BlinkMaxDelay);
                    for (; time <= duration; time += UnityEngine.Random.RandomRange(BlinkMinDelay, BlinkMaxDelay))
                    {
                        CoroutineManager.BlinkIn(marker.m_enemySubObj.gameObject, time);
                    }
                }
            }
        }
        public override void Postspawn(EnemyAgent agent)
        {
            //Those are fine
            agent.MaterialHandler.m_defaultGlowColor                 = DefaultColor;
            agent.Locomotion.ShooterAttack.m_attackGlowColor_End     = ShooterFireColor;
            agent.Locomotion.StrikerAttack.m_attackGlowColor         = TentacleAttackColor;
            agent.Locomotion.TankMultiTargetAttack.m_attackGlowColor = TentacleAttackColor;
            agent.Locomotion.HibernateWakeup.m_selfWakeupColor       = SelfWakeupColor;
            agent.Locomotion.Hibernate.m_heartbeatColorVec           = HeartbeatColor;

            foreach (var pulse in PulseEffects)
            {
                var manager = agent.gameObject.AddComponent <PulseManager>();
                manager.PulseData = pulse;
                if (pulse.RandomizeTime)
                {
                    var interval = Math.Max(0.0f, pulse.Duration);
                    var rand     = (float)_Random.NextDouble() * interval;
                    manager.StartDelay = rand;
                }
            }

            //And this is static LMAO
            //ES_HibernateWakeUp.m_propagatedWakeupColor = PropagateWakeupColor
            //ES_Hibernate.s_closestDistanceDetectionColorVec = HibernateColor
        }
        public override void Postspawn(EnemyAgent agent)
        {
            agent.RequireTagForDetection = RequireTagForDetection;
            agent.MovingCuller.m_disableAnimatorCullingWhenRenderingShadow = true;

            agent.MovingCuller.Culler.Renderers.Clear();
            agent.MovingCuller.Culler.hasShadowsEnabled = true;

            var comps = agent.GetComponentsInChildren <Renderer>(true);

            foreach (var comp in comps)
            {
                if (!IncludeEggSack && comp.gameObject.name.Contains("Egg"))
                {
                    LogVerbose(" - Ignored EggSack Object!");
                    comp.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On;
                    comp.enabled           = true;
                    continue;
                }

                comp.castShadows       = true;
                comp.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.ShadowsOnly;
                comp.enabled           = true;

                var skinmeshrenderer = comp.TryCast <SkinnedMeshRenderer>();
                if (skinmeshrenderer != null)
                {
                    skinmeshrenderer.updateWhenOffscreen = true;
                }
            }
        }
Exemple #10
0
 public ReturnState(EnemyAgent agent, Vector3 originalPoint, Quaternion originalRotation) : base(agent)
 {
     _originalPoint    = originalPoint;
     _originalRotation = originalRotation;
     _targetXZ         = new Vector2(_originalPoint.x, _originalPoint.z);
     _parentXZ         = new Vector2(_agent.Parent.transform.position.x, _agent.Parent.transform.position.z);
 }
Exemple #11
0
        private async void Start()
        {
            Platform.ImportCurrentStage();
            await UniTask.Yield();

            foreach (var color in humanPlayerColors)
            {
                Gamepad.GetInstance(color).Add(gamepadListeners[color] = new GamepadListener(color));
            }


            // spawn enemy
            EnemyTank.lifes[EnemyTank.Type.Big] = 1;
            EnemyAgent.SpawnTank().Forget();



            // spawn player
            PlayerTank.lifes[Tank.Color.Yellow] = 1;            // Test
            PlayerTank.lifes[Tank.Color.Green]  = 1;            // Test

            if (aiPlayerColors.Length != 0)
            {
                "Player Agent".Instantiate(transform);
            }
            foreach (var color in humanPlayerColors)
            {
                PlayerTank.Spawn(color, false).Forget();
            }
            foreach (var color in aiPlayerColors)
            {
                PlayerTank.Spawn(color, false).Forget();
            }
        }
        public override void Postspawn(EnemyAgent agent)
        {
            var projectileSetting = agent.GetComponentInChildren <EAB_ProjectileShooter>(true);

            if (projectileSetting != null)
            {
                if (FireSettings.Length > 1)
                {
                    var clone = new EAB_ProjectileShooter()
                    {
                        m_burstCount       = projectileSetting.m_burstCount,
                        m_burstDelay       = projectileSetting.m_burstDelay,
                        m_shotDelayMin     = projectileSetting.m_shotDelayMin,
                        m_shotDelayMax     = projectileSetting.m_shotDelayMax,
                        m_initialFireDelay = projectileSetting.m_initialFireDelay,
                        m_shotSpreadX      = projectileSetting.m_shotSpreadX,
                        m_shotSpreadY      = projectileSetting.m_shotSpreadY
                    };

                    var ability = agent.gameObject.AddComponent <ShooterDistSettingManager>();
                    ability.DefaultValue = clone;
                    ability.EAB_Shooter  = projectileSetting;
                    ability.FireSettings = FireSettings;
                }
                else if (FireSettings.Length == 1)
                {
                    FireSettings[0].ApplyToEAB(projectileSetting);
                }
            }
        }
        public override void Postspawn(EnemyAgent agent)
        {
            var onDetectionSpawn = new Action <EnemyAgent, ScoutAntennaDetection>((EnemyAgent eventAgent, ScoutAntennaDetection detection) =>
            {
                if (eventAgent.GlobalID == agent.GlobalID)
                {
                    OnDetectionSpawn(eventAgent, detection);
                }
            });

            var onAntennaSpawn = new Action <EnemyAgent, ScoutAntennaDetection, ScoutAntenna>((EnemyAgent eventAgent, ScoutAntennaDetection detection, ScoutAntenna ant) =>
            {
                if (eventAgent.GlobalID == agent.GlobalID)
                {
                    OnAntennaSpawn(eventAgent, detection, ant);
                }
            });

            ScoutAntennaSpawnEvent.OnDetectionSpawn += onDetectionSpawn;
            ScoutAntennaSpawnEvent.OnAntennaSpawn   += onAntennaSpawn;
            agent.add_OnDeadCallback(new Action(() =>
            {
                ScoutAntennaSpawnEvent.OnDetectionSpawn -= onDetectionSpawn;
                ScoutAntennaSpawnEvent.OnAntennaSpawn   -= onAntennaSpawn;
            }));
        }
        public override void Prespawn(EnemyAgent agent)
        {
            var charMats = agent.GetComponentInChildren <CharacterMaterialHandler>().m_materialRefs;

            foreach (var mat in charMats)
            {
                var matName = mat.m_material.name;
                LogVerbose($" - Debug Info, Material Found: {matName}");

                var swapSet = MaterialSets.SingleOrDefault(x => x.From.Equals(matName));
                if (swapSet == null)
                {
                    continue;
                }

                if (!_MatDict.TryGetValue(swapSet.To, out var newMat))
                {
                    Logger.Error($"MATERIAL IS NOT CACHED!: {swapSet.To}");
                    continue;
                }

                LogDev($" - Trying to Replace Material, Before: {matName} After: {newMat.name}");
                mat.m_material = newMat;
                LogVerbose(" - Replaced!");
            }
        }
Exemple #15
0
 public override void Enter(EnemyAgent agent)
 {
     agent.SetAnimation(true);
     agent.GetNavMeshAgent().isStopped = true;
     agent.ResetAttack();
     //start attack animation
     agent.Attack();
 }
Exemple #16
0
 public void SetFirstEnemy()
 {
     if (_enemies.Count > 0)
     {
         _currentEnemyIterator = 0;
         _currentEnemy         = _enemies[0];
     }
 }
 private static void Postfix(EnemyAgent __instance)
 {
     if (__instance.name.EndsWith(")")) //No Replicator Number = Fake call
     {
         return;
     }
     ConfigManager.Current.Customize_Postspawn(__instance);
 }
Exemple #18
0
    void Damage(Transform enemy)
    {
        EnemyAgent e = enemy.GetComponent <EnemyAgent>();

        if (e != null)
        {
            e.TakeDamage(damage);
        }
    }
 private void OnDetectionSpawn(EnemyAgent agent, ScoutAntennaDetection detection)
 {
     detection.m_tendrilCount     = TendrilCount.GetAbsValue(detection.m_tendrilCount);
     detection.m_dirAngOffset     = TendrilAngleOffset;
     detection.m_dirAngStep       = TendrilStepAngle.GetAbsValue(detection.m_dirAngStep);
     detection.m_dirAngSpread_Min = TendrilMinYSpread.GetAbsValue(detection.m_dirAngSpread_Min);
     detection.m_dirAngSpread_Max = TendrilMaxYSpread.GetAbsValue(detection.m_dirAngSpread_Max);
     detection.m_timerWaitOut     = TendrilOutTimer.GetAbsValue(detection.m_timerWaitOut);
 }
Exemple #20
0
 public PatrolState(EnemyAgent agent, Quaternion originalRotation, NavigationPath patrolPath = null) : base(agent)
 {
     if (patrolPath != null)
     {
         _path       = patrolPath.Path;
         _currentPos = new Vector2(_agent.Parent.position.x, _agent.Parent.position.z);
     }
     _originalRotation = originalRotation;
 }
 private void OnAntennaSpawn(EnemyAgent agent, ScoutAntennaDetection detection, ScoutAntenna ant)
 {
     ant.m_colorDefault       = NormalColor;
     ant.m_colorDetection     = DetectColor;
     ant.m_moveInTime         = RetractTime.GetAbsValue(ant.m_moveInTime);
     ant.m_moveInTimeDetected = RetractTimeDetected.GetAbsValue(ant.m_moveInTimeDetected);
     ant.m_maxDistance        = Distance.GetAbsValue(ant.m_maxDistance);
     ant.m_stepDistance       = StepDistance.GetAbsValue(ant.m_stepDistance);
 }
 public override void Enter(EnemyAgent agent)
 {
     agent.GetRigidbody().velocity     = Vector3.zero;
     agent.GetNavMeshAgent().isStopped = true;
     agent.SetAnimation(true);
     agent.ResetAttack();
     //start attack animation
     agent.Attack();
 }
Exemple #23
0
 public AttackState(EnemyAgent agent, GameObject muzzleFlash, GameObject bloodParticles, GameObject impactParticles, GameObject turretPoint) : base(agent)
 {
     random       = new System.Random();
     _muzzleFlash = muzzleFlash;
     //_gun = gun;
     //_bulletPrefab = bulletPrefab;
     _bloodParticles  = bloodParticles;
     _impactParticles = impactParticles;
     _turret          = turretPoint.transform;
     _turretVector    = _turret.position;
 }
Exemple #24
0
    void Spawn()
    {
        GameObject clone = Instantiate(enemyPrefab);
        Vector3    rand  = Random.insideUnitSphere;

        rand.y = 0;
        clone.transform.position = transform.position + rand * spawnRadius;
        EnemyAgent aiAgent = clone.GetComponent <EnemyAgent>();

        aiAgent.target = target;
    }
Exemple #25
0
 public override void Update(EnemyAgent agent)
 {
     if (agent.GetCurrentTimeBtwAttacks() <= 0)
     {
         agent.Attack();
     }
     else
     {
         agent.AdjustAttackTime();
     }
 }
    void SpawnEnemy(int i)
    {
        GameObject enemy = Instantiate(_enemyToSpawn, _chosenSpawnsPoints[i].transform.position, Quaternion.identity);

        enemy.GetComponent <NavMeshAgent>().speed       = _stats.Speed;
        enemy.GetComponent <NavMeshAgent>().destination = Vector3.zero;

        EnemyAgent agent = enemy.GetComponent <EnemyAgent>();

        agent.SetIsWaveEnemy(true);
        agent.enabled = true;
    }
 public override void Postspawn(EnemyAgent agent)
 {
     if (agent.Damage != null)
     {
         foreach (var regenData in RegenDatas)
         {
             var ability = agent.gameObject.AddComponent <HealthRegenManager>();
             ability.DamageBase = agent.Damage;
             ability.RegenData  = regenData;
         }
     }
 }
        public override void BeginState()
        {
            _enemyNode           = Agent.InteractionTarget;
            _enemy               = Agent.InteractionTarget.Occupant as EnemyAgent;
            _targetRotation      = Quaternion.LookRotation(_enemyNode.Position - Agent.Position);
            _enemyTargetRotation = Quaternion.LookRotation(Agent.Position - _enemyNode.Position);
            _rotationAccumulator = 0;

            if (_enemy != null)
            {
                _enemy.CoinFlip._enemyImage.sprite = _enemy.EnemyBattleImage;
            }
        }
Exemple #29
0
        private EnemyAgent GetFirstAliveAgentInColumn(int columnIndex)
        {
            EnemyAgent[] column = _fleetModel[columnIndex];
            for (int i = 0; i < column.Length; i++)
            {
                EnemyAgent agent = column[i];
                if (!agent.ShipDestroyed)
                {
                    return(agent);
                }
            }

            return(null);
        }
        public bool IsMatch(EnemyAgent agent)
        {
            var enemyData = GameDataBlockBase <EnemyDataBlock> .GetBlock(agent.EnemyDataID);

            var comparisonMode = NameIgnoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;

            return(Mode switch
            {
                TargetMode.PersistentID => PersistentIDs.Contains(agent.EnemyDataID),
                TargetMode.NameEquals => enemyData?.name?.Equals(NameParam, comparisonMode) ?? false,
                TargetMode.NameContains => enemyData?.name?.Contains(NameParam, comparisonMode) ?? false,
                TargetMode.Everything => true,
                _ => false,
            });