function OnTriggerEnter(hit : Collider)
 {
     if (hit.name == "PacMan" || hit.gameObject.tag == "PacMan")
     {
         audio.Play();
     }
 }
Example #2
0
 void Awake()
 {
     if (hit.Hit == null)
     {
         hit.Hit = this;
     }
 }
Example #3
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         pickupSound = GameObject.Find("pickupSound").GetComponent <AudioSource> ();
         pickupSound.Play();
         //this.transform.parent.gameObject.SetActive (false);
         hitScript = other.gameObject.GetComponentInChildren <hit>();
         hitScript.setHammers();
         Destroy(this.transform.parent.gameObject);
     }
 }
Example #4
0
    // Use this for initialization
    void Start()
    {
        hit = gameObject.GetComponent <hit>();
        ClearFailure();

        raycast = gameObject.GetComponent <RayCast>();

        //neuralnet.CreateNet(2, raycast.rayCount, 12, 2);

        leftForce  = 0.0f;
        rightForce = 0.0f;
        leftTheta  = 0.0f;
        rightTheta = 0.0f;
    }
Example #5
0
    // Use this for initialization
    void Start()
    {
        hasFailed = false;

        neuralnet = new NNet();
        neuralnet.CreateNet(1, 5, 8, 2);
        raycast = gameObject.GetComponent <RayCast> ();
        l       = raycast.dis_l;
        fl      = raycast.dis_fl;
        f       = raycast.dis_f;
        fr      = raycast.dis_fr;
        r       = raycast.dis_fr;

        leftForce  = 0.0f;
        rightForce = 0.0f;
        leftTheta  = 0.0f;
        rightTheta = 0.0f;

        hit = gameObject.GetComponent <hit> ();
    }
Example #6
0
    // Use this for initialization
    void Start()
    {
        genAlg = new GA();
        int totalWeights = 5 * 8 + 8 * 2 + 8 + 2;

        genAlg.GenerateNewPopulation(15, totalWeights);
        currentAgentFitness = 0.0f;
        bestFitness         = 0.0f;

        neuralNet = new NNet();
        neuralNet.CreateNet(1, 5, 8, 2);
        Genome genome = genAlg.GetNextGenome();

        neuralNet.FromGenome(genome, 5, 8, 2);

        testAgent = gameObject.GetComponent <Agent>();
        testAgent.Attach(neuralNet);

        hit         = gameObject.GetComponent <hit>();
        checkpoints = hit.checkpoints;
        defaultpos  = transform.position;
        defaultrot  = transform.rotation;
    }
Example #7
0
    void Start()
    {
        controller = MainController.Instance;

        hasFailed = false;

        neuralnet = new NNet();
        neuralnet.CreateNet(1, controller.inputCount, controller.hiddenNeuronsCount, controller.outputCount);
        raycast = gameObject.GetComponent <RayCast> ();

        l  = raycast.dis_l;
        fl = raycast.dis_fl;
        f  = raycast.dis_f;
        fr = raycast.dis_fr;
        r  = raycast.dis_fr;

        leftForce  = 0.0f;
        rightForce = 0.0f;
        leftTheta  = 0.0f;
        rightTheta = 0.0f;

        hit = gameObject.GetComponent <hit> ();
    }
Example #8
0
    void Start()
    {
        controller = MainController.Instance;

        genAlg = new GA();
        int totalWeights = (controller.hiddenNeuronsCount + 1) * (controller.inputCount + controller.outputCount);

        genAlg.GenerateNewPopulation(controller.genomeCount, totalWeights);
        currentAgentFitness = 0.0f;
        bestFitness         = 0.0f;

        neuralNet = new NNet();
        neuralNet.CreateNet(1, controller.inputCount, controller.hiddenNeuronsCount, controller.outputCount);
        Genome genome = genAlg.GetNextGenome();

        neuralNet.FromGenome(genome, controller.inputCount, controller.hiddenNeuronsCount, controller.outputCount);

        testAgent = gameObject.GetComponent <Agent>();
        testAgent.Attach(neuralNet);

        hit         = gameObject.GetComponent <hit> ();
        checkpoints = hit.checkpoints;
        defaultpos  = transform.position;
    }
        public ActionResult IncrementRedirect(Result result)
        {
            int      count      = 0;
            bool     exists     = false;
            analytic dbAnalytic = null;
            hit      dbhit      = null;

            //Find out if it exists
            using (var db = new iTunesSearchEntities())
            {
                count = db.analytics.Count();

                //if the value exists, update
                if (db.hits.Any(a => a.url == result.ViewURL))
                {
                    exists     = true;
                    dbAnalytic = db.analytics.Where(a => a.hit.url == result.ViewURL).FirstOrDefault <analytic>();
                }
                else  //otherwise add new hit to database
                {
                    exists = false;

                    dbhit = new hit
                    {
                        trackId    = ++count,
                        url        = result.ViewURL,
                        title      = result.TrackName,
                        artist     = result.ArtistName,
                        artworkurl = result.ArtworkURL100,
                    };

                    db.hits.Add(dbhit);
                    db.SaveChanges();
                }
            }

            //change without DBContext or create
            if (exists && dbAnalytic != null)
            {
                dbAnalytic.hitCount++;
            }
            else
            {
                dbAnalytic = new analytic
                {
                    trackId  = count,
                    hitCount = 1,
                    //hit = dbhit,
                };
            }

            using (var db = new iTunesSearchEntities())
            {
                if (exists)
                {
                    db.Entry(dbAnalytic).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    db.analytics.Add(dbAnalytic);
                }

                db.SaveChanges();
            }

            return(Redirect(result.ViewURL));
        }