Пример #1
0
    void setupScenario()
    {
        GameObject agent;
        Vector3    pos;

        for (int i = 0; i < 5; ++i)
        {
            for (int j = 0; j < 5; ++j)
            {
                pos   = new Vector3(55.0f + i * 10.0f, 0, 55.0f + j * 10.0f);
                agent = (GameObject)GameObject.Instantiate(agentPrefab, pos, Quaternion.identity);
                AgentComponent agentComponent = agent.GetComponent <AgentComponent>();
                agentComponent.target = new Vector3(-75.0f, 0, -75.0f);

                pos                   = new Vector3(-55.0f - i * 10.0f, 0, 55.0f + j * 10.0f);
                agent                 = (GameObject)GameObject.Instantiate(agentPrefab, pos, Quaternion.identity);
                agentComponent        = agent.GetComponent <AgentComponent>();
                agentComponent.target = new Vector3(75.0f, 0, -75.0f);

                pos                   = new Vector3(55.0f + i * 10.0f, 0, -55.0f - j * 10.0f);
                agent                 = (GameObject)GameObject.Instantiate(agentPrefab, pos, Quaternion.identity);
                agentComponent        = agent.GetComponent <AgentComponent>();
                agentComponent.target = new Vector3(-75.0f, 0, 75.0f);

                pos                        = new Vector3(-55.0f - i * 10.0f, 0, -55.0f - j * 10.0f);
                agent                      = (GameObject)GameObject.Instantiate(agentPrefab, pos, Quaternion.identity);
                agentComponent             = agent.GetComponent <AgentComponent>();
                agentComponent.target      = new Vector3(75.0f, 0, 75.0f);
                agentComponent.isKinematic = true;
            }
        }
    }
        private void SetupConversionTasksForAgentService(AgentComponent agentComponent, DatabaseComponent databaseComponent)
        {
            XmlDocument conversionConfig = agentComponent.TargetFileSystem.XmlHelper.OpenDocument(agentComponent.PathToConversionConfig);

            foreach (XmlNode cycleNode in conversionConfig.SelectNodes("/configuration/Innovator/Conversion/ProcessingCycles/cycle"))
            {
                XmlNode dbAttribute       = cycleNode.SelectSingleNode("@DB");
                XmlNode userAttribute     = cycleNode.SelectSingleNode("@User");
                XmlNode passwordAttribute = cycleNode.SelectSingleNode("@Password");

                Logger.Instance.Log(LogLevel.Info, "\tSetting the '{0}' value for @DB attribute for cycle element.", databaseComponent.DatabaseName);

                dbAttribute.InnerText = databaseComponent.DatabaseName;
                if (string.Equals(userAttribute.InnerText, "{user}", StringComparison.OrdinalIgnoreCase))
                {
                    Logger.Instance.Log(LogLevel.Info, "\tSetting the '{0}' value for @User attribute for cycle element.", agentComponent.ConversionManagerUser);

                    userAttribute.InnerText = agentComponent.ConversionManagerUser;
                }
                if (passwordAttribute != null && string.Equals(passwordAttribute.InnerText, "{password}", StringComparison.OrdinalIgnoreCase))
                {
                    Logger.Instance.Log(LogLevel.Info, "\tSetting the '{0}' value for @Password attribute for cycle element.", agentComponent.ConversionManagerPassword);

                    passwordAttribute.InnerText = agentComponent.ConversionManagerPassword;
                }
            }

            agentComponent.TargetFileSystem.XmlHelper.SaveXmlDocument(conversionConfig);
        }
Пример #3
0
 public static void RemoveComponentIfNotNull(this Agent agent, AgentComponent component)
 {
     if (component != null)
     {
         agent.RemoveComponent(component);
     }
 }
Пример #4
0
 public override void ApplyToAgentComponent(AgentComponent agentComponent)
 {
     if (HasSomethingToDeploy(agentComponent))
     {
         RunArasUpdateCmdForComponent(agentComponent);
     }
 }
        public override void Connect(IReadOnlyCollection <Component> instanceComponents)
        {
            Logger.Instance.Log(LogLevel.Info, "\nConfiguring component ({0}) to work with component({1}):\n", AgentComponentId, InnovatorComponentId);

            AgentComponent     agentComponent     = instanceComponents.Single(c => c.Id == AgentComponentId) as AgentComponent;
            InnovatorComponent innovatorComponent = instanceComponents.Single(c => c.Id == InnovatorComponentId) as InnovatorComponent;

            innovatorComponent.TargetFileSystem.XmlHelper.XmlPoke(innovatorComponent.PathToConfig, "/Innovator/AgentService/@InnovatorToServiceAddress", agentComponent.Url);
        }
Пример #6
0
    void Start()
    {
        shield     = (GameObject)Instantiate(UnityEngine.Resources.Load("shield"));
        nightStick = (GameObject)Instantiate(UnityEngine.Resources.Load("nightStick"));

        agentComponent = GetComponent <AgentComponent>();
        post           = transform.position;
        protestCenter  = GameObject.Find("ProtestCenter");
    }
Пример #7
0
    void Start()
    {
        shield = (GameObject)Instantiate(UnityEngine.Resources.Load("shield"));
        nightStick = (GameObject)Instantiate(UnityEngine.Resources.Load("nightStick"));

        agentComponent = GetComponent<AgentComponent>();
        post = transform.position;
        protestCenter = GameObject.Find("ProtestCenter");
    }
        public override void Connect(IReadOnlyCollection <Component> instanceComponents)
        {
            Logger.Instance.Log(LogLevel.Info, "\nConfiguring component ({0}) to work with component({1}):\n", DatabaseComponentId, AgentComponentId);

            DatabaseComponent databaseComponent = instanceComponents.Single(c => c.Id == DatabaseComponentId) as DatabaseComponent;
            AgentComponent    agentComponent    = instanceComponents.Single(c => c.Id == AgentComponentId) as AgentComponent;

            SetupConversionTasksForAgentService(agentComponent, databaseComponent);
            agentComponent.TargetFileSystem.XmlHelper.XmlPoke(agentComponent.PathToConfig, "/configuration/appSettings/add[@key='InnovatorServer']/@value", databaseComponent.InnovatorServerAspxUrl);
        }
Пример #9
0
        protected override void Awake()
        {
            base.Awake();
            m_skillType   = SkillTypes.Hold;
            m_canCancel   = true;
            m_multiJump   = AgentComponent.GetComponent <MultiJump> ();
            m_defaultJump = m_multiJump.JumpPower;

            m_audioSource = GetComponent <AudioSource> ();
            m_animator    = GetComponent <Animator> ();
        }
Пример #10
0
 public override bool Activate()
 {
     if (AgentComponent.ActivateAgentSkill(this))
     {
         AgentComponent.AttackerComponent.AttackDamage = AttackDamage;
         m_isActive = true;
         AgentComponent.SetVelocity(0, -Speed);
         return(true);
     }
     return(false);
 }
Пример #11
0
        public override bool Activate()
        {
            if (AgentComponent.ActivateAgentSkill(this))
            {
                AgentComponent.SetVelocityY(JumpPower);
                AgentComponent.DeactivateAgentSkill(this);
                return(true);
            }

            return(false);
        }
Пример #12
0
        /// <summary>
        /// Activate the skill and begin any sort of animations or movements.
        /// </summary>
        public override bool Activate()
        {
            Debug.Log("transform Titan");
            if (AgentComponent.ActivateAgentSkill(this))
            {
                StartCoroutine(growCoroutine());

                return(true);
            }

            return(false);
        }
Пример #13
0
    public void Init(GameObject o)
    {
        appraisal = GetComponent<Appraisal>();
        agentComponent = GetComponent<AgentComponent>();
        beginTime = Time.time;
        InitAppraisalStatus();

        opponent = o;
        oAgentComponent = opponent.GetComponent<AgentComponent>();

        GetComponent<SteeringController>().orientationBehavior = OrientationBehavior.LookAtTarget; //rotation is updated according to opponent's direction
    }
Пример #14
0
    public void Init(GameObject o)
    {
        appraisal      = GetComponent <Appraisal>();
        agentComponent = GetComponent <AgentComponent>();
        beginTime      = Time.time;
        InitAppraisalStatus();

        opponent        = o;
        oAgentComponent = opponent.GetComponent <AgentComponent>();

        GetComponent <SteeringController>().orientationBehavior = OrientationBehavior.LookAtTarget; //rotation is updated according to opponent's direction
    }
Пример #15
0
 // Use this for initialization
 void Start()
 {
     appraisal = GetComponent<Appraisal>();
     agentComponent = GetComponent<AgentComponent>();
     InitAppraisalStatus();
     if (explosion) {
         escapePos = transform.position * 2f - explosion.transform.position;
         escapePos.y = transform.position.y;
     }
     else
         Debug.Log("No Explosion gameobject");
 }
        private void giveVampireComponentsToAgent(Agent agent)
        {
            // Remove default retreat component
            AgentComponent defaultRetreatComponent = agent.GetComponent <RetreatAgentComponent>();

            agent.RemoveComponentIfNotNull(defaultRetreatComponent);

            // Replace default morale component with vamp component
            AgentComponent moraleComponent = agent.GetComponent <MoraleAgentComponent>();

            agent.RemoveComponentIfNotNull(moraleComponent);
            agent.AddComponent(new VampireMoraleAgentComponent(agent));
        }
Пример #17
0
 public override bool ActivateAxis(float axis)
 {
     if (AgentComponent.ActiveSkill == null || AgentComponent.ActiveSkill.AllowMovement == true)
     {
         if ((axis > 0 && AgentComponent.SurfaceDetectorComponent.IsOnSurface(Surface.RightWall) == false) ||
             (axis < 0 && AgentComponent.SurfaceDetectorComponent.IsOnSurface(Surface.LeftWall) == false))
         {
             AgentComponent.SetVelocityX(axis * Speed);
             return(true);
         }
     }
     return(false);
 }
Пример #18
0
    public Agent(Agent agentToCopy)
    {
        componentsList = new ArrayList();
        for(int i = 0; i < numOfComponets; i++)
        {
            AgentComponent agentComponent = new AgentComponent( agentToCopy.GetComponet(i));

            componentsList.Add(agentComponent);

            population = agentToCopy.population;
            generation = agentToCopy.generation;

        }
    }
Пример #19
0
        /// <summary>
        /// Activate the skill and begin any sort of animations or movements.
        /// </summary>
        public override bool Activate()
        {
            if (m_colliedWall && AgentComponent.ActivateAgentSkill(this))
            {
                m_rigidbody2D.drag = 1f;
                AgentComponent.SetVelocityY(JumpPower);
                AgentComponent.DeactivateAgentSkill(this);
                m_colliedWall = false;

                return(true);
            }

            return(base.Activate());
        }
Пример #20
0
        /// <summary>
        /// The grow coroutine in which transform the sphere
        /// into titan form.
        /// </summary>
        ///
        /// <returns>The coroutine.</returns>
        private IEnumerator growCoroutine()
        {
            // Get the offset of y in the titan form
            float   yOffset           = (Size / 4f) - 0.25f;
            Vector2 titanFormPosition = transform.position + new Vector3(0f, yOffset, 0f);

            // Create a circle to detect if the are any object that would prevent the sphere from transforming
            // If the colliders array is NOT empty, it means the sphere might not be able to transform
            Collider2D[] colliders = Physics2D.OverlapCircleAll(titanFormPosition, Size / 4f, Layers);

            if (colliders.Length > 0)
            {
                // Get the "ground" object by raycasting directly down
                RaycastHit2D raycast = Physics2D.Raycast(titanFormPosition, Vector2.down, Mathf.Infinity, Layers);

                foreach (Collider2D collider in colliders)
                {
                    // Do not transform if the collider is not a "ground" collider or if the normal
                    // vector is not pointing up
                    if (collider != raycast.collider || raycast.normal != Vector2.up)
                    {
                        if (!m_errorCoroutineRunning)
                        {
                            StartCoroutine(displayErrorCoroutine());
                        }

                        AgentComponent.DeactivateAgentSkill(this);
                        yield break;
                    }
                }
            }

            AgentComponent.Invicible = true;
            m_isActive = true;
            AgentComponent.AttackerComponent.AttackDamage = AttackDamage;
            m_particleSystem.Emit(ParticleCount);

            transform.localScale *= Size;
            transform.position    = titanFormPosition;
            m_rigidbody2D.mass    = Mass;

            // Play the titan form audio clip
            m_audioSource.clip = TitanAudioClip;
            m_audioSource.Play();

            yield return(new WaitForSeconds(2.0f));

            Cancel();
        }
Пример #21
0
 // Use this for initialization
 void Start()
 {
     appraisal      = GetComponent <Appraisal>();
     agentComponent = GetComponent <AgentComponent>();
     InitAppraisalStatus();
     if (explosion)
     {
         escapePos   = transform.position * 2f - explosion.transform.position;
         escapePos.y = transform.position.y;
     }
     else
     {
         Debug.Log("No Explosion gameobject");
     }
 }
Пример #22
0
        public override bool Cancel()
        {
            Debug.Log("Attempt to cancel Rocket Drill");
            bool result = AgentComponent.DeactivateAgentSkill(this);

            if (result == true)
            {
                m_isActive = false;
                AgentComponent.AttackerComponent.AttackDamage = AgentComponent.AttackerComponent.DefaultAttackDamage;

                // Return to the idle animation
                m_animator.SetInteger("RocketDrill", 0);
            }

            return(result);
        }
Пример #23
0
        /// <summary>
        /// Deactivate the skill and stop the player during the skill executation
        /// or when the skill is done executing.
        /// </summary>
        public override bool Cancel()
        {
            // Prevent accidental shrinking beyond the original size
            if (m_originalScale != transform.localScale)
            {
                AgentComponent.Invicible = false;

                m_isActive = false;
                AgentComponent.SetVelocity(0f, 0f);
                AgentComponent.AttackerComponent.AttackDamage = AgentComponent.AttackerComponent.DefaultAttackDamage;
                transform.localScale /= Size;
                m_rigidbody2D.mass    = m_originalMass;
            }

            return(AgentComponent.DeactivateAgentSkill(this));
        }
Пример #24
0
    // Use this for initialization
    void Start()
    {
        appraisal       = GetComponent <Appraisal>();
        agentComponent  = GetComponent <AgentComponent>();
        affectComponent = GetComponent <AffectComponent>();
        InitAppraisalStatus();

        Leader = this.transform.parent.GetComponent <LeaderComponent>().leader;

        UpdateAttractor();

        if (agentComponent.id % 4 == 0)
        {
            bannerCarrier = true;
            banner        = (GameObject)Instantiate(UnityEngine.Resources.Load("banner"));
        }
    }
Пример #25
0
        /// <summary>
        /// Update physic movement in the titan form.
        /// </summary>
        private void FixedUpdate()
        {
            if (m_isActive)
            {
                switch (AgentComponent.Facing)
                {
                case Direction.Left:
                    AgentComponent.SetVelocity(-Speed, m_rigidbody2D.velocity.y);
                    break;

                case Direction.Right:
                    AgentComponent.SetVelocity(Speed, m_rigidbody2D.velocity.y);
                    break;

                default:
                    break;
                }
            }
        }
Пример #26
0
    // Use this for initialization
    void Start()
    {
        appraisal       = GetComponent <Appraisal>();
        agentComponent  = GetComponent <AgentComponent>();
        affectComponent = GetComponent <AffectComponent>();
        steering        = GetComponent <SteeringController>();

        //   navmeshAgent.radius -= 0.1f; //smaller than regular size
        //navmeshAgent.speed += 0.6f; //faster than regular speed
        agentComponent.walkingSpeed = steering.maxSpeed;

        counterPos    = GameObject.Find("counter").transform.position;
        cashier       = GameObject.Find("cashier");
        storeEntrance = GameObject.Find("storeEntrance");

        acquiredObjCnt = 0;
        desiredObjCnt  = (int)(5f * affectComponent.personality[(int)OCEAN.E] + 6f); //correlated to extroversion [1 11]


        InitAppraisalStatus();
    }
Пример #27
0
        public override bool Activate()
        {
            if (AgentComponent.ActivateAgentSkill(this))
            {
                Debug.Log("GLIDE START");
                m_isActive = true;
                AgentComponent.SetVelocityY(0);

                // Apply the gravity scale and linear drag
                m_rigidbody2D.gravityScale = GravityScale;
                m_rigidbody2D.drag         = LinearDrag;

                // Play the glide audio and animation
                m_audioSource.clip = GlideAudio;
                m_audioSource.loop = true;
                m_audioSource.Play();
                m_animator.SetInteger("Glide", 1);

                return(true);
            }
            return(false);
        }
Пример #28
0
        public override bool Cancel()
        {
            if (m_isActive)
            {
                Debug.Log("GLIDE STOP");
                bool result = AgentComponent.DeactivateAgentSkill(this);
                if (result == true)
                {
                    m_isActive = false;

                    // Revert the gravity scale and linear drag to default values
                    m_rigidbody2D.gravityScale = 1f;
                    m_rigidbody2D.drag         = 0f;
                }

                // Stop playing the Glide animation and stop the audio from looping
                m_animator.SetInteger("Glide", 0);
                m_audioSource.loop = false;

                return(result);
            }
            return(false);
        }
Пример #29
0
        public Atom CreatePlayer(string name, GamePosition position)
        {
            var player           = new Atom("Player", '@', position);
            var damagerComponent = new DamagerComponent(player, _eventBus);

            player.AddComponent(damagerComponent);
            var interactionComponent = new PlayerInteractionComponent(player, _levelController, damagerComponent, _random);

            player.AddComponent(interactionComponent);
            var inputActionController = new PlayerInputActionController(player, interactionComponent, _scheduleController);

            player.AddComponent(inputActionController);
            var uniqueComponent = new UniqueAtomComponent(player, name);

            player.AddComponent(uniqueComponent);
            var inventoryComponent = new InventoryComponent(player, _levelController, _eventBus);

            player.AddComponent(inventoryComponent);
            var agentComponent = new AgentComponent(player);

            player.AddComponent(agentComponent);
            return(player);
        }
Пример #30
0
        public override bool Cancel()
        {
            if (m_isActive)
            {
                bool result = AgentComponent.DeactivateAgentSkill(this);
                if (result == true)
                {
                    m_isActive = false;
                    AgentComponent.AttackerComponent.AttackDamage = AgentComponent.AttackerComponent.DefaultAttackDamage;

                    // Set velocity to 0 to reduce the chances of cube
                    // falling through the ground or platforms
                    AgentComponent.SetVelocity(0f, 0f);

                    // Play the stomp audio
                    m_audioSource.clip = StompAudio;
                    m_audioSource.Play();
                }

                return(result);
            }
            return(false);
        }
Пример #31
0
        public override bool Activate()
        {
            m_multiJump.JumpPower = JumpPower;
            bool result = m_multiJump.Activate();

            if (result == true)
            {
                result = AgentComponent.ActivateAgentSkill(this);
                if (result == true)
                {
                    AgentComponent.SetVelocityX(0f);
                    AgentComponent.AttackerComponent.AttackDamage = AttackDamage;
                    m_isActive = true;

                    // Play the drill audio and animation
                    m_audioSource.clip = RocketDrillAudio;
                    m_audioSource.Play();
                    m_animator.SetInteger("RocketDrill", 1);
                }
            }

            m_multiJump.JumpPower = m_defaultJump;
            return(result);
        }
Пример #32
0
 public abstract void ApplyToAgentComponent(AgentComponent agentComponent);
Пример #33
0
    // Use this for initialization
    void Start()
    {
        appraisal = GetComponent<Appraisal>();
        agentComponent = GetComponent<AgentComponent>();
        affectComponent = GetComponent<AffectComponent>();
        InitAppraisalStatus();

        Leader = this.transform.parent.GetComponent<LeaderComponent>().leader;

        UpdateAttractor();

        if(agentComponent.id % 4 == 0) {
            bannerCarrier = true;
            banner = (GameObject)Instantiate(UnityEngine.Resources.Load("banner"));
        }
    }
Пример #34
0
    // Use this for initialization
    void Start()
    {
        appraisal = GetComponent<Appraisal>();
        agentComponent = GetComponent<AgentComponent>();
        affectComponent = GetComponent<AffectComponent>();
        steering = GetComponent<SteeringController>();

         //   navmeshAgent.radius -= 0.1f; //smaller than regular size
        //navmeshAgent.speed += 0.6f; //faster than regular speed
        agentComponent.walkingSpeed = steering.maxSpeed;

        counterPos = GameObject.Find("counter").transform.position;
        cashier = GameObject.Find("cashier");
        storeEntrance = GameObject.Find("storeEntrance");

        acquiredObjCnt = 0;
        desiredObjCnt = (int)(5f * affectComponent.personality[(int)OCEAN.E] + 6f); //correlated to extroversion [1 11]

        InitAppraisalStatus();
    }
 public override void ApplyToAgentComponent(AgentComponent agentComponent)
 {
     ApplyToWindowsServiceComponent(agentComponent);
 }
Пример #36
0
 void CreateRandomComponents()
 {
     UnityEngine.Random.seed = UnityEngine.Random.Range(1, 1000);
     for (int i = 0; i < numOfComponets; i++)
     {
         AgentComponent agentComponent = new AgentComponent();
         componentsList.Add(agentComponent);
     }
 }