示例#1
0
    public AutoHumanoidAgentController getDroid(Vector3 position, int health, float skill)
    {
        foreach (var droid in droids)
        {
            if (!droid.isInUse())
            {
                droid.setPosition(position);
                droid.health     = health;
                droid.skillLevel = skill;

                droid.addOnDestroyEvent(OnAgentDestory);
                droid.resetCharacher();
                droid.setInUse(true);

                if (m_mobilePlayer != null)
                {
                    m_mobilePlayer.addTarget(droid.getICyberAgent());
                }

                if ((Random.value + skill > 0.95f) && Random.value > 0.5f)
                {
                    MovingAgent movingAgent = droid.getICyberAgent() as MovingAgent;

                    if (movingAgent.getCurrentWeaponType().Equals(Weapon.WEAPONTYPE.secondary))
                    {
                        movingAgent.togglePrimaryWeapon();
                    }
                }

                return(droid);
            }
        }

        return(null);
    }
示例#2
0
        private void LoadBulletShield(Enums.AgentType castedBy, MovingAgent agent)
        {
            int   bulletSpeed   = 8;
            float angleModifier = 1.0f; // lower numbers for straight line - higher for wide angle - NOTE: values between 0 and 1 work best

            for (int i = 0; i < 100; i++)
            {
                Bullet bullet = new Bullet();
                bullet.LoadEffect(Texture);
                bullet.Position      = agent.Position + Utils.CalculateRotatedMovement(new Vector2(0, -(agent.FrameHeight / 2)), agent.Rotation);
                bullet.Rotation      = (agent.Rotation - (0.5f * angleModifier)) + (float)random.NextDouble() * angleModifier;
                bullet.MaxSpeed      = bulletSpeed;
                bullet.Color         = innerColor;
                bullet.MinDamage     = MinDamage;
                bullet.MaxDamage     = MaxDamage;
                bullet.CastedBy      = castedBy;
                bullet.HitsRemaining = 1;

                PulseGame.Current.effectComponent.AddEffect(bullet);
            }

            //Game1.Current.EffectComponent.SplitBulletsFromPlayer();

            ActiveCoolDown = CoolDown;
        }
示例#3
0
        private void LoadDefaultExplosion(Enums.AgentType castedBy, MovingAgent agent)
        {
            if (castedBy == Enums.AgentType.Player)
            {
                MouseState mouseStateCurrent = Mouse.GetState();

                Explosion explosion = new Explosion();
                explosion.LoadExplosion(Texture, BoundingRect, Frames);
                explosion.Position          = new Vector2(mouseStateCurrent.X, mouseStateCurrent.Y);
                explosion.AnimationInterval = new TimeSpan(1100000);
                explosion.EffectType        = AttackType;
                explosion.CastedBy          = castedBy;
                explosion.EffectSubType     = Enums.AttackSubType.Default;

                PulseGame.Current.effectComponent.AddEffect(explosion);

                ActiveCoolDown = CoolDown;
            }
            else
            {
                Explosion explosion = new Explosion();
                explosion.LoadExplosion(Texture, BoundingRect, Frames);
                explosion.Position          = PulseGame.Current.player.Position;
                explosion.AnimationInterval = new TimeSpan(1100000);
                explosion.EffectSubType     = Enums.AttackSubType.Default;

                PulseGame.Current.effectComponent.AddEffect(explosion);

                ActiveCoolDown = CoolDown;
            }
        }
示例#4
0
    /**
     * Get target position of the current aimed agent
     */
    private Vector3 getTargetPositionFromAgent()
    {
        MovingAgent humanoidAgent = m_currentTarget as MovingAgent;

        if (humanoidAgent == null)
        {
            return(m_currentTarget.getTopPosition());
        }
        else
        {
            if (humanoidAgent.isCrouched())
            {
                if (humanoidAgent.isAimed())
                {
                    return(m_currentTarget.getTopPosition());
                }
                else
                {
                    return(m_currentTarget.getCurrentPosition() + new Vector3(0, 0.6f, 0));
                }
            }
            else
            {
                return(m_currentTarget.getCurrentPosition() + new Vector3(0, 1.05f, 0));
            }
        }
    }
示例#5
0
        private void LoadNuke(Enums.AgentType castedBy, MovingAgent agent)//, Color color)
        {
            int   bulletSpeed   = 8;
            float angleModifier = 0.25f; // lower numbers for straight line - higher for wide angle - NOTE: values between 0 and 1 work best

            for (int i = 0; i < 1; i++)
            {
                Random rand  = new Random();
                Color  color = (i % 2 == 0) ? new Color(rand.Next(180, 255), rand.Next(180, 255), rand.Next(180, 255), 255) : new Color(rand.Next(0, 100), rand.Next(0, 100), rand.Next(0, 100), 255);

                Bullet bullet = new Bullet();
                bullet.LoadEffect(Texture);
                bullet.Position      = agent.Position + Utils.CalculateRotatedMovement(new Vector2(0, -(agent.FrameHeight / 2)), agent.Rotation);
                bullet.Rotation      = (agent.Rotation - (0.5f * angleModifier)) + (float)random.NextDouble() * angleModifier;
                bullet.MaxSpeed      = bulletSpeed;
                bullet.Color         = color;
                bullet.MinDamage     = MinDamage;
                bullet.MaxDamage     = MaxDamage;
                bullet.CastedBy      = castedBy;
                bullet.HitsRemaining = 3;
                bullet.EffectSubType = Enums.AttackSubType.Nuke;

                PulseGame.Current.effectComponent.AddEffect(bullet);
            }

            PulseGame.Current.effectComponent.NukeSplit();

            ActiveCoolDown = CoolDown;
        }
示例#6
0
    private void findTargetLocationToFire()
    {
        MovingAgent humanoidOpponent = opponent as MovingAgent;

        if (humanoidOpponent != null && humanoidOpponent.isCrouched() && humanoidOpponent.isAimed())
        {
            targetLocation = humanoidOpponent.getHeadTransfrom();
        }
        else
        {
            int randomIndex = Random.Range(0, targetLocations.Length - 1);
            targetLocation = targetLocations[randomIndex].transform;
        }



        if (Random.value > m_selfAgent.getSkill())
        {
            randomOffset = Random.insideUnitSphere * 2;
        }
        else if (m_navMeshAgent.remainingDistance > 9)
        {
            randomOffset = Random.insideUnitSphere * 0.7f;
        }
        else
        {
            randomOffset = Vector3.zero;
        }
    }
        private SteeringOut Evade(MovingAgent targetAgent)
        {
            Vector2 toAgent = targetAgent.Position - _owner.Position;

            float lookAheadTime = toAgent.magnitude /
                                  (_owner.Velocity + targetAgent.Velocity);

            return(Flee(targetAgent.FuturePosition(lookAheadTime)));
        }
示例#8
0
        protected virtual void Awake()
        {
            m_Sight  = GetComponentInChildren <Sight> ();
            m_Entity = GetComponent <MovingAgent> ();

            if (m_Entity == null && LOGGING_ENABLED)
            {
                Debug.LogError(SCRIPT_NAME + ": Entity Script on object not found");
            }
        }
示例#9
0
        public void Remove(MovingAgent agent)
        {
            var tag = agent.transform.gameObject.tag;

            if (!m_AgentsInSimulation.ContainsKey(tag))
            {
                return;
            }

            m_AgentsInSimulation [tag].Remove(agent);
        }
示例#10
0
        public void Add(MovingAgent agent)
        {
            var tag = agent.transform.gameObject.tag;

            if (!m_AgentsInSimulation.ContainsKey(tag))
            {
                m_AgentsInSimulation.Add(tag, new HashSet <MovingAgent> ());
            }

            m_AgentsInSimulation [tag].Add(agent);
        }
示例#11
0
    // Use this for initialization
    void Start()
    {
        enemyAudioSource = GetComponent <AudioSource>(); //initializes the enemy's audio source
        this._agent      = new MovingAgent(this, SteeringBehaviors.PathFollow, this._homeLoc);
        this.Location    = this._homeLoc;
        enemyCollider    = this.GetComponent <BoxCollider2D>(); //initalizes the collider

        FindRandomPath();
        GrabNodes();
        this._behaviors = SteeringBehaviors.PathFollow;
    }
示例#12
0
        private void UseTeleport(Enums.AgentType castedBy, MovingAgent agent)
        {
            PulseGame game = PulseGame.Current;

            Vector2 targetPos = new Vector2(game.mouseStateCurrent.X, game.mouseStateCurrent.Y);

            Rectangle targetBounds = new Rectangle
                                     (
                (int)(targetPos.X - (agent.Bounds.Width / 2)),
                (int)(targetPos.Y - (agent.Bounds.Height / 2)),
                agent.Bounds.Width,
                agent.Bounds.Height
                                     );

            if (castedBy == Enums.AgentType.Player)
            {
                List <GameAgent> intersectingAgentList = game.levelInfo.AgentList.Where(ga => ga.Type == (int)Enums.AgentType.Enemy && ga.Bounds.Intersects(targetBounds) && ((Enemy)ga).Health < agent.Health).ToList();

                foreach (GameAgent intersectingAgent in intersectingAgentList)
                {
                    Enemy enemyObj = ((Enemy)intersectingAgent);

                    enemyObj.TakeDamage(enemyObj.Health);
                }
            }

            agent.Position = targetPos;
            agent.Color    = Color.White;

            int   bulletSpeed   = 10;
            float angleModifier = 6.0f; // lower numbers for straight line - higher for wide angle - NOTE: values between 0 and 1 work best

            for (int i = 0; i < 200; i++)
            {
                Bullet bullet = new Bullet();
                bullet.LoadEffect(Texture);
                bullet.Position      = agent.Position + Utils.CalculateRotatedMovement(new Vector2(0, -(agent.FrameHeight / 2)), agent.Rotation);
                bullet.Rotation      = (agent.Rotation - (0.5f * angleModifier)) + (float)random.NextDouble() * angleModifier;
                bullet.MaxSpeed      = bulletSpeed;
                bullet.Color         = Color.Yellow;
                bullet.MinDamage     = MinDamage;
                bullet.MaxDamage     = MaxDamage;
                bullet.CastedBy      = castedBy;
                bullet.HitsRemaining = 1;

                PulseGame.Current.effectComponent.AddEffect(bullet);
            }

            ActiveCoolDown = CoolDown;
        }
示例#13
0
    // Use this for initialization
    void Start()
    {
        _homeLocation = (Random.insideUnitCircle * 3) - new Vector2(1, 2);
        _agent        = new MovingAgent(this, _behaviors, _homeLocation);
        this.Location = this.transform.position;

        //Setting the AI to start in Wander when loaded
        UpdateAIBehavior(SteeringBehaviors.Wander);

        //Gets components for the AI
        this._agent.RunOnStart();

        player = GameObject.FindGameObjectWithTag("Player");
        source = gameObject.AddComponent <AudioSource>();
    }
示例#14
0
    private void Start()
    {
        m_movingAgent = this.GetComponent <MovingAgent>();
        m_movingAgent.setFaction(m_agentFaction);
        enemyHitLayerMask = LayerMask.GetMask("Enemy");
        floorHitLayerMask = LayerMask.GetMask("Target");
        m_healthBar       = this.GetComponentInChildren <HealthBar>();

        createTargetPlane();
        m_movingAgent.setHealth(health);
        m_movingAgent.enableTranslateMovment(true);
        m_movingAgent.setSkill(1);
        intializeAgentCallbacks(m_movingAgent);

        //m_movingAgent.setOnDestoryCallback(OnAgentDestroy);
        //m_movingAgent.setOnDisableCallback(onAgentDisable);
    }
    void Start()
    {
        switch (m_uiType)
        {
        case UIType.PC:
            m_controller = FindObjectOfType <PlayerController>();
            break;

        case UIType.Mobile:
            m_controller = FindObjectOfType <PlayerControllerMobile>();
            break;

        default:
            break;
        }
        m_movingAgent = m_controller.GetComponent <MovingAgent>();
    }
    private void hitOnEnemy(Collider other)
    {
        AgentController agentController = other.transform.GetComponentInParent <AgentController>();

        if (agentController != null && !m_hit)
        {
            ICyberAgent cyberAgent = agentController.getICyberAgent();
            if (cyberAgent != null && !m_fireFrom.Equals(cyberAgent.getFaction()))
            {
                m_hit = true;
                cyberAgent.reactOnHit(other, (this.transform.forward) * 3f, other.transform.position);
                cyberAgent.damageAgent(1);

                speed = 0;
                this.gameObject.SetActive(false);
                GameObject basicHitParticle = ProjectilePool.getInstance().getPoolObject(ProjectilePool.POOL_OBJECT_TYPE.HitBasicParticle);
                basicHitParticle.SetActive(true);
                basicHitParticle.transform.position = this.transform.position;
                basicHitParticle.transform.LookAt(Vector3.up);

                if (!cyberAgent.IsFunctional())
                {
                    MovingAgent movingAgent = cyberAgent as MovingAgent;
                    if (movingAgent != null)
                    {
                        Rigidbody rb = other.transform.GetComponent <Rigidbody>();

                        if (rb != null)
                        {
                            rb.isKinematic = false;
                            rb.AddForce((this.transform.forward) * 150, ForceMode.Impulse);
                        }

                        Rigidbody hitRb = movingAgent.getChestTransfrom().GetComponent <Rigidbody>();

                        if (hitRb)
                        {
                            hitRb.AddForce((this.transform.forward) * 2 + Random.insideUnitSphere * 2, ForceMode.Impulse);
                        }
                    }
                }
            }
        }
    }
示例#17
0
        private void AddAttackToActiveEffects(Enums.AgentType castedBy, MovingAgent agent)
        {
            switch (AttackType)
            {
            case Enums.AttackType.Bullet:

                switch (AttackSubType)
                {
                case Enums.AttackSubType.Default:         LoadDefaultBullet(castedBy, agent);    break;

                case Enums.AttackSubType.TriBullet:       LoadTriBullet(castedBy, agent);        break;

                case Enums.AttackSubType.SplitBullets:    LoadSplitBullets(castedBy, agent);     break;

                case Enums.AttackSubType.Nuke:            LoadNuke(castedBy, agent);             break;

                case Enums.AttackSubType.BulletShield:    LoadBulletShield(castedBy, agent);     break;

                case Enums.AttackSubType.DoubleTriBullet: LoadDoubleTriBullet(castedBy, agent);  break;
                }

                break;

            case Enums.AttackType.Explosion:

                switch (AttackSubType)
                {
                case Enums.AttackSubType.Default:         LoadDefaultExplosion(castedBy, agent); break;

                case Enums.AttackSubType.ReflectingStar:  LoadReflectingStar(castedBy, agent);   break;
                }

                break;

            case Enums.AttackType.MovementEffect:

                switch (AttackSubType)
                {
                case Enums.AttackSubType.Teleport:      UseTeleport(castedBy, agent);          break;
                }

                break;
            }
        }
示例#18
0
        private void LoadReflectingStar(Enums.AgentType castedBy, MovingAgent agent)
        {
            Random rand = new Random();

            int       padding   = 100;
            LevelInfo levelInfo = PulseGame.Current.levelInfo;

            Explosion explosion = new Explosion();

            explosion.LoadExplosion(Texture, BoundingRect, Frames);
            explosion.Position          = new Vector2(rand.Next(padding, 3 * padding), rand.Next(padding, levelInfo.Height - padding));
            explosion.AnimationInterval = new TimeSpan(1100000);
            explosion.EffectSubType     = Enums.AttackSubType.ReflectingStar;
            explosion.CastedBy          = castedBy;

            PulseGame.Current.effectComponent.AddEffect(explosion);

            ActiveCoolDown = CoolDown;
        }
示例#19
0
        private void LoadDoubleTriBullet(Enums.AgentType castedBy, MovingAgent agent)
        {
            //innerColor = Color.Red;
            //outerColor = Color.Orange;

            int   bulletSpeed   = 8;
            float angleModifier = 0.25f; // lower numbers for straight line - higher for wide angle - NOTE: values between 0 and 1 work best

            Vector2 playerPos = PulseGame.Current.player.Position;

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    Vector2 pos = new Vector2(agent.Position.X, agent.Position.Y + (i == 0 ? -50 : 50)) + Utils.CalculateRotatedMovement(new Vector2(0, -(agent.FrameHeight / 4)), agent.Rotation);

                    Bullet bullet = new Bullet();
                    bullet.LoadEffect(Texture);
                    bullet.Position      = pos;
                    bullet.Rotation      = (Utils.GetRotationToTarget(playerPos, pos) - (0.5f * angleModifier)) + (float)random.NextDouble() * angleModifier;
                    bullet.MaxSpeed      = bulletSpeed;
                    bullet.Color         = innerColor;
                    bullet.MinDamage     = MinDamage;
                    bullet.MaxDamage     = MaxDamage;
                    bullet.CastedBy      = castedBy;
                    bullet.EffectSubType = Enums.AttackSubType.TriBullet;
                    bullet.EffectType    = Enums.AttackType.Bullet;
                    bullet.Color         = (i % 2 == 0) ? new Color(50, 100, 240) : new Color(245, 50, 55); // light blue / light red
                    bullet.HitsRemaining = 1;

                    PulseGame.Current.effectComponent.AddEffect(bullet);
                }
            }

            currentSequence += AttackCost;

            if (currentSequence > MaxSequence)
            {
                Random rand = new Random();
                ActiveCoolDown  = rand.Next(CoolDown);
                currentSequence = 0;
            }
        }
示例#20
0
        private void LoadDefaultBullet(Enums.AgentType castedBy, MovingAgent agent)
        {
            Bullet bullet = new Bullet();

            bullet.LoadEffect(Texture);
            bullet.Position      = agent.Position + Utils.CalculateRotatedMovement(new Vector2(0, -(agent.FrameHeight / 2)), agent.Rotation);
            bullet.Rotation      = agent.Rotation;
            bullet.MaxSpeed      = castedBy == Enums.AgentType.Player ? 8 : 6;
            bullet.Color         = Color;
            bullet.MinDamage     = MinDamage;
            bullet.MaxDamage     = MaxDamage;
            bullet.EffectType    = AttackType;
            bullet.CastedBy      = castedBy;
            bullet.HitsRemaining = 1;

            PulseGame.Current.effectComponent.AddEffect(bullet);

            ActiveCoolDown = CoolDown;
        }
    void UpdateIndicator(MovingAgent agent, Image indicatorImg)
    {
        Vector2 agent2Camera = agent.Position - (Vector2)mainCamera.transform.position;

        /*Position update*/
        //y = mx + 0
        float m     = Mathf.Abs(agent2Camera.y / agent2Camera.x);
        float halfW = mainGUIRectTransf.rect.width / 2 - indicatorOffset;
        float halfH = mainGUIRectTransf.rect.height / 2 - indicatorOffset;

        //after replace x = halfW, y = halfH
        float X = halfH / m; //y = halfH
        float Y = halfW * m; //x = halfW

        Vector2 indicatorPos = new Vector2(halfW, halfH);

        if (Mathf.Abs(X) > halfW)
        {
            indicatorPos.y = Y;
        }
        else if (Mathf.Abs(Y) > halfH)
        {
            indicatorPos.x = X;
        }

        if (agent2Camera.x < 0)
        {
            indicatorPos.x *= -1;
        }
        if (agent2Camera.y < 0)
        {
            indicatorPos.y *= -1;
        }
        indicatorImg.rectTransform.anchoredPosition = indicatorPos;
        /*End of position update*/

        /*Angle update*/
        float angle = Utils.Vector2Angle(agent2Camera);

        indicatorImg.rectTransform.eulerAngles = new Vector3(0, 0, angle);
        /*End of angle update*/
    }
示例#22
0
    public void Awake()
    {
        m_movingAgent  = this.GetComponent <MovingAgent>();
        m_navMeshAgent = this.GetComponent <NavMeshAgent>();
        GameObject[] playerTaggedObjects = GameObject.FindGameObjectsWithTag(enemyTag);

        foreach (GameObject obj in playerTaggedObjects)
        {
            if (obj != this.gameObject)
            {
                enemy = obj.GetComponent <MovingAgent>();

                if (enemy != null)
                {
                    break;
                }
            }
        }
        tempFloat  = Random.value * 2 + Random.value * 2;
        tempFloat2 = Random.value * 2 + Random.value * 2;
    }
    void Awake()
    {
        gm = this;

        if (player == null)
        {
            player = GameObject.FindGameObjectWithTag("Player");
            if (player == null)
            {
                Debug.LogError("Missing player gameObj");
            }
        }

        playerMovingAgentCpnt = player.GetComponent <MovingAgent> ();
        if (playerMovingAgentCpnt == null)
        {
            Debug.LogError("Missing player moving Agent cpnt");
        }

        enemyList = new List <MovingAgent> ();
    }
        private SteeringOut Pursuit(MovingAgent targetAgent)
        {
            Vector2 toAgent = targetAgent.Position - _owner.Position;

            float deltaHeadingAngle = Utils.AbsDeltaAngle(_owner.DegreeHeading(),
                                                          targetAgent.DegreeHeading());

            float deltaAngle2Agent = Utils.AbsDeltaAngle(_owner.DegreeHeading(),
                                                         Utils.Vector2Angle(toAgent));

            // If owner and the target agent head to each other
            // -> Seek straight to target agent
            if (deltaAngle2Agent < 10 && deltaHeadingAngle < 10)
            {
                return(Seek(targetAgent.Position));
            }

            //Else Seek toward the predicted future position
            float lookAheadTime = toAgent.magnitude /
                                  (_owner.Velocity + targetAgent.Velocity);

            return(Seek(targetAgent.FuturePosition(lookAheadTime)));
        }
示例#25
0
        private void Move(MovingAgent agent, SpeedVector speed)
        {
            if (speed == null)
            {
                return;
            }
            float tick = (float)CompleteWorld.TickTime / 1000; //en secondes


            //Console.WriteLine(" " + tick);
            //Console.WriteLine(speed.X + " " +speed.Y);

            //Console.WriteLine(agent.Location.X + " " +agent.Location.Y);
            float _x = agent.Location.X + speed.X * tick;
            float _y = agent.Location.Y + speed.Y * tick;
            float _z = agent.Location.Z + speed.Z * tick;

            agent.Location.X = _x;
            agent.Location.Y = _y;
            agent.Location.Z = _z;

            //Console.WriteLine(_x + " " +_y);
        }
    //Dequeue for indicator pooling
    void UpdateEnemyIndicators()
    {
        //TODO: update when an enemy destroyed
        LinkedListNode <Image> it = indicatorLList.First;

        for (int i = 0; i < gameManager.enemyList.Count; i++)
        {
            MovingAgent agent = gameManager.enemyList[i];

            //Create new when all available indicators are used
            if (it == null)
            {
                InitiateIndicator();
                it = indicatorLList.Last;
            }


            if (!agent.IsVisible())
            {
                Image indicatorImg = it.Value;
                indicatorImg.enabled = true;
                UpdateIndicator(agent, indicatorImg);
                it = it.Next;
            }

            if (i == gameManager.enemyList.Count - 1)
            {
                while (it != null && it.Value.enabled == true)
                {
                    it.Value.enabled = false;
                    it = it.Next;
                }
            }
        }
        //TODO: update indicators: Update on died enemy, OnVisible, OnInvisible of enemy
    }
示例#27
0
    protected virtual void OnStartAgent(bool isInit)
    {
        m_movement = GetComponent<MovingAgent>();
        m_isWaiting = m_movement.enabled;
        m_gameInstance = Game.Instance;

        if (isInit)
            m_startingNode = m_movement.AtNode ? m_movement.AtNode : m_movement.ClosestNode;
        else
            m_movement.TeleportTo(m_startingNode);
    }
示例#28
0
 public void UseAttack(Enums.AgentType castedBy, MovingAgent agent)
 {
     AddAttackToActiveEffects(castedBy, agent);
 }
示例#29
0
        private void LoadSplitBullets(Enums.AgentType castedBy, MovingAgent agent)
        {
            PulseGame.Current.effectComponent.SplitBulletsFromPlayer();

            ActiveCoolDown = CoolDown;
        }
示例#30
0
        private void LoadTriBullet(Enums.AgentType castedBy, MovingAgent agent)
        {
            List <Color> colorList = GetBulletColorListByAgentType(castedBy);

            int colorChangeInterval = 100; // 100 seems like a good interval - 20 to demo

            if (bulletCount > colorChangeInterval * colorList.Count / 2)
            {
                bulletCount = 0;
            }

            innerColor = colorList[(2 * (bulletCount / colorChangeInterval)) % colorList.Count];
            outerColor = colorList[(2 * (bulletCount / colorChangeInterval) + 1) % colorList.Count];

            int   bulletSpeed   = 8;
            float angleModifier = 0.25f; // lower numbers for straight line - higher for wide angle - NOTE: values between 0 and 1 work best

            Bullet bullet = new Bullet();

            bullet.LoadEffect(Texture);
            bullet.Position      = agent.Position + Utils.CalculateRotatedMovement(new Vector2(0, -(agent.FrameHeight / 2)), agent.Rotation);
            bullet.Rotation      = (agent.Rotation - (0.5f * angleModifier)) + (float)random.NextDouble() * angleModifier;
            bullet.MaxSpeed      = bulletSpeed;
            bullet.Color         = innerColor;
            bullet.MinDamage     = MinDamage;
            bullet.MaxDamage     = MaxDamage;
            bullet.CastedBy      = castedBy;
            bullet.EffectSubType = Enums.AttackSubType.TriBullet;
            bullet.HitsRemaining = 1;

            PulseGame.Current.effectComponent.AddEffect(bullet);

            Bullet bullet1 = new Bullet();

            bullet1.LoadEffect(Texture);
            bullet1.Position     = agent.Position + Utils.CalculateRotatedMovement(new Vector2(0, -(agent.FrameHeight / 2)), agent.Rotation);
            bullet1.Rotation     = agent.Rotation - ((float)random.NextDouble() * angleModifier);//0.02f;
            bullet1.MaxSpeed     = bulletSpeed;
            bullet1.Color        = outerColor;
            bullet1.MinDamage    = MinDamage;
            bullet1.MaxDamage    = MaxDamage;
            bullet1.CastedBy     = castedBy;
            bullet.EffectSubType = Enums.AttackSubType.TriBullet;
            bullet.HitsRemaining = 1;

            PulseGame.Current.effectComponent.AddEffect(bullet1);

            Bullet bullet2 = new Bullet();

            bullet2.LoadEffect(Texture);
            bullet2.Position     = agent.Position + Utils.CalculateRotatedMovement(new Vector2(0, -(agent.FrameHeight / 2)), agent.Rotation);
            bullet2.Rotation     = agent.Rotation + ((float)random.NextDouble() * angleModifier);
            bullet2.MaxSpeed     = bulletSpeed;
            bullet2.Color        = outerColor;
            bullet2.MinDamage    = MinDamage;
            bullet2.MaxDamage    = MaxDamage;
            bullet2.CastedBy     = castedBy;
            bullet.EffectSubType = Enums.AttackSubType.TriBullet;
            bullet.HitsRemaining = 1;

            PulseGame.Current.effectComponent.AddEffect(bullet2);

            // change the color set of the bullets
            bulletCount++;

            ActiveCoolDown = CoolDown;
        }
示例#31
0
 public override void setMovableAgent(ICyberAgent agent)
 {
     m_movingAgent = (MovingAgent)agent;
 }