Esempio n. 1
0
    private Vector3 CalculateAgentForce()
    {
        if (explosion < 10)
        {
            return(Vector3.zero);
        }

        var force = Vector3.zero;

        /*
         * foreach(var agent in perceivedNeighbors)
         * {
         *  if (!AgentManager.IsAgent(agent))
         *  {
         *      continue;
         *  }
         *      var neighbor = AgentManager.agentsObjs[agent];
         *      var dir = (transform.position - neighbor.transform.position).normalized;
         *      var overlap = (radius + neighbor.radius) - Vector3.Distance(transform.position, agent.transform.position);
         *      var tangent = Vector3.Cross(Vector3.up, dir);
         *
         *      force += Parameters.A * Mathf.Exp(overlap / Parameters.B) * dir; //proximityForce
         *      force += Parameters.k * Mathf.Max(overlap, 0) * dir; //repultionForce
         *      force += Parameters.Kappa * Mathf.Max(overlap, 0) * Vector3.Dot(rb.velocity - neighbor.GetVelocity(), tangent) * tangent; //slidingForce
         * }
         */
        int     g;
        Vector3 n = new Vector3();
        Vector3 t = new Vector3();

        foreach (var agent in perceivedNeighbors)
        {
            if (!PEManager.IsAgent(agent))
            {
                continue;
            }

            n = transform.position - agent.transform.position;
            n.Normalize();
            t = Vector3.Cross(Vector3.up, n);

            if (Vector3.Distance(transform.position, agent.transform.position) <= (nma.radius + agent.GetComponent <NavMeshAgent>().radius))
            {
                g = 1;
            }
            else
            {
                g = 0;
            }
            force += ((Parameters.A * Mathf.Exp(((nma.radius + agent.GetComponent <NavMeshAgent>().radius) - Vector3.Distance(transform.position, agent.transform.position)) / Parameters.B) + (Parameters.k * g)) * n); //proximityForce + repulsionForce
            force += (Parameters.Kappa * g * Vector3.Dot((agent.GetComponent <Rigidbody>().velocity - GetVelocity()), t) * t);                                                                                           //slidingForce
        }

        return(force);
    }
Esempio n. 2
0
 public void OnTriggerEnter(Collider other)
 {
     if (PEManager.IsAgent(other.gameObject))
     {
         perceivedNeighbors.Add(other.gameObject);
     }
     if (WallManager.IsWall(other.gameObject) || other.CompareTag("wall"))
     {
         adjacentWalls.Add(other.gameObject);
     }
 }
Esempio n. 3
0
 // Constructor.
 public XmlDTDParserInput
     (XmlParserInput input,
     XmlNameTable nameTable)
     : base(nameTable, null, input.ErrorHandler)
 {
     this.input             = input;
     this.peValue           = null;
     this.pePosition        = -1;
     this.scanForPE         = true;
     this.parameterEntities = new PEManager
                                  (nameTable, input.ErrorHandler);
                 #if !ECMA_COMPAT
     this.valid   = true;
     this.started = false;
                 #endif
     base.logger = null;
 }
Esempio n. 4
0
        protected override void initializePlugin()
        {
            try
            {
                ResourceManager.getInstance().registerResourceProvider(this);
                this.settingsBranch = (SettingsBranch)PEManager.getInstance().GetBranchByID("Settings");

                var nanoleafNode = new FormSettingsNode(SETTINGS_CATEGORY_ID, "Nanoleaf", "Nanoleaf");
                nanoleafNode.DisplayWhere   = EDisplayCategory.APPLICATION_SETTINGS;
                nanoleafNode.PropertiesForm = typeof(NanoleafSettingsForm);
                settingsBranch.AddRecursive(settingsBranch.ID, nanoleafNode);
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
	// Constructor.
	public XmlDTDParserInput
				(XmlParserInput input,
				 XmlNameTable nameTable)
			: base(nameTable, null, input.ErrorHandler)
			{
				this.input = input;
				this.peValue = null;
				this.pePosition = -1;
				this.scanForPE = true;
				this.parameterEntities = new PEManager
					(nameTable, input.ErrorHandler);
			#if !ECMA_COMPAT
				this.valid = true;
				this.started = false;
			#endif
				base.logger = null;
			}