Exemplo n.º 1
0
    private void Start()
    {
        UnityEngine.Profiling.Profiler.BeginSample("AI Start");
        slot1 = null;
        slot2 = null;

        // Caching Components
        m_pointTrackerReference = GetComponent <PointTracker>();
        m_competitor            = GetComponent <Competitor>();
        m_rigidbody             = GetComponent <Rigidbody>();
        m_goalTransform         = GameObject.FindGameObjectWithTag("Goal").transform;
        target              = m_goalTransform;
        allCrownBoxes       = GameObject.FindGameObjectsWithTag("CrownBox");
        allPowerUpBoxes     = FindObjectsOfType <PowerUpBox>();
        allOtherCompetitors = FindObjectsOfType <Competitor>();


        ChangeState(EAIState.FINDING_OBJECTIVE);

        if (m_pointTrackerReference == null)
        {
            Debug.LogError($"AI {gameObject.name} doesn't have a point tracker");
        }
        UnityEngine.Profiling.Profiler.EndSample();
    }
Exemplo n.º 2
0
 void Start()
 {
     pointTracker   = GetComponent <PointTracker>();
     roundTracker   = GetComponent <RoundTracker>();
     remainingLives = startingLives;
     Debug.Log("setting remaining lives in start");
 }
Exemplo n.º 3
0
    private void OnTriggerEnter(Collider other)
    {
        var _competitor = other.gameObject.GetComponent <Competitor>();

        if (other.tag == "Player")
        {
            goal = true;
        }
        if (other.tag == "Enemy")
        {
            goalName = other.GetComponent <Competitor>().name;
        }

        if (_competitor)
        {
            pointTracker           = _competitor.GetComponentInParent <PointTracker>();
            point                  = pointTracker.PointVal();
            _competitor.ScoredGoal = true;
            _competitor.GetComponentInParent <Crown>().resetCrown();
            pointTracker.ResetMult();
            pointTracker.ResetBasePoints();
            scoreManager.UpdateScore(_competitor.Name, (int)point);
            StartCoroutine(spawnPointManager.RespawnTimer(_competitor.Name));
            StartCoroutine(spawnPointManager.PauseRigidBodyControl(_competitor, 2f));
            StartCoroutine(spawnPointManager.PauseCamera(_competitor));
            Explosion();
        }
    }
 // Use this for initialization
 void Start()
 {
     pointTracker = GameObject.Find("GameManager").GetComponent <PointTracker>();
     rb2d         = boulder.GetComponent <Rigidbody2D>();
     timeToWait   = boulder.GetComponent <HoleMaker>().timeToChisel;
     Invoke("StartGameFinishedCheck", timeToWait + 1);
 }
Exemplo n.º 5
0
 void Start()
 {
     pointTracker = GetComponent <PointTracker>();
     leftFlipper.setUses(currentRound);
     rightFlipper.setUses(currentRound);
     Invoke("PlayMusicLoop", initialMusicLength);
 }
Exemplo n.º 6
0
 // Start is called before the first frame update
 void Start()
 {
     rigidbody            = GetComponent <Rigidbody>();
     pointTracker         = GetComponent <PointTracker>();
     destructionSound     = GameObject.Find("DestructionSound").GetComponent <AudioSource>();
     warningSound         = GameObject.Find("WarningSound").GetComponent <AudioSource>();
     balloonExplodedSound = GameObject.Find("BalloonExplodedSound").GetComponent <AudioSource>();
     balloonModel         = GameObject.Find("balloon");
 }
Exemplo n.º 7
0
 // Start is called before the first frame update
 void Start()
 {
     balloon        = GameObject.Find("BirdTarget");
     particleSystem = GetComponent <ParticleSystem>();
     renderers      = GetComponentsInChildren <MeshRenderer>();
     rigidbody      = GetComponent <Rigidbody>();
     flightSystem   = GameObject.FindWithTag("Balloon").GetComponent <BalloonFlightSystem>();
     audioSource    = GameObject.Find("balloon").GetComponent <AudioSource>();
     pointTracker   = GameObject.FindWithTag("Balloon").GetComponent <PointTracker>();
 }
Exemplo n.º 8
0
 void CreateTrackers(int n)
 {
     for (int i = 0; i < n; ++i)
     {
         GameObject newtracker = Instantiate(m_PointPrefab.gameObject);
         newtracker.transform.SetParent(transform);
         PointTracker newpt = newtracker.GetComponent <PointTracker>();
         m_PointsPool.Add(newpt);
     }
 }
 // Use this for initialization
 void Start()
 {
     _socket = GameObject.Find("SocketIO").GetComponent <SocketIOComponent>();
     _socket.On("open", OnOpen);
     _socket.On("steer", OnSteer);
     _socket.On("manual", onManual);
     _carController = CarRemoteControl.GetComponent <CarController>();
     point_path     = CarRemoteControl.GetComponent <PointTracker>();
     wpt            = new WaypointTracker_mpc();
     polyOrder      = 5;
 }
Exemplo n.º 10
0
    // Use this for initialization
    void Start()
    {
        GameObject pTracker = GameObject.Find("PointTracker");

        if (pTracker == null)
        {
            Debug.Log("Cannot find PointTracker!");
        }
        else
        {
            pointTracker = pTracker.GetComponent <PointTracker>();
        }
    }
Exemplo n.º 11
0
    // Start is called before the first frame update
    void Start()
    {
        axis     = transform.position + (Vector3.up * radius);
        pt       = FindObjectOfType <PointTracker>();
        timeRate = (Mathf.PI * 2) / timeRate;

        //Sin = Opposite (y) / Hypotenuse (radius)
        //y = sin() * radius
        float y = Mathf.Sin(timer) * radius;
        //Cos = adjacent (x) / Hypotenuse (radius)
        //x = cos() * radius
        float x = Mathf.Cos(timer) * radius;

        transform.position = axis + (Vector3.up * y) + (Vector3.right * x);
    }
Exemplo n.º 12
0
 // Start is called before the first frame update
 void Start()
 {
     if (playerMove == null)
     {
         playerMove = FindObjectOfType <Movement>().GetComponent <Movement>();
     }
     if (ptTracker == null)
     {
         ptTracker = FindObjectOfType <PointTracker>().GetComponent <PointTracker>();
     }
     if (energyBar == null)
     {
         energyBar = FindObjectOfType <EnergyBar>().GetComponent <EnergyBar>();
     }
     scored = false;
 }
Exemplo n.º 13
0
        private void MazeSolver()
        {
            while (!IsMazeSolved)
            {
                if (Maze.IsEndPoint(CurrentPoint.X, CurrentPoint.Y))
                {
                    IsMazeSolved = true;
                    Console.WriteLine("The End Point is Col: " + CurrentPoint.X + " Row: " + CurrentPoint.Y);
                    break;
                }

                if (PointTracker.Count != 0)
                {
                    if (CurrentPoint.X != StartPoint.X || CurrentPoint.Y != StartPoint.Y)
                    {
                        Maze.MarkPoint(CurrentPoint.X, CurrentPoint.Y);
                    }

                    CurrentPoint = PointTracker.Pop();
                }

                if (Maze.IsValidPoint(CurrentPoint.X + 1, CurrentPoint.Y))
                {
                    PointTracker.Push(new Coordinate(CurrentPoint.X + 1, CurrentPoint.Y));
                }

                if (Maze.IsValidPoint(CurrentPoint.X - 1, CurrentPoint.Y))
                {
                    PointTracker.Push(new Coordinate(CurrentPoint.X - 1, CurrentPoint.Y));
                }

                if (Maze.IsValidPoint(CurrentPoint.X, CurrentPoint.Y + 1))
                {
                    PointTracker.Push(new Coordinate(CurrentPoint.X, CurrentPoint.Y + 1));
                }

                if (Maze.IsValidPoint(CurrentPoint.X, CurrentPoint.Y - 1))
                {
                    PointTracker.Push(new Coordinate(CurrentPoint.X, CurrentPoint.Y - 1));
                }
            }
        }
Exemplo n.º 14
0
    // Start is called before the first frame update
    void Start()
    {
        downSpeed  = -10f;
        sideSpeed  = 0f;
        speedMod   = 1f;
        rigid      = GetComponent <Rigidbody2D>();
        offset     = transform.position.y - cam.transform.position.y;
        trailIndex = 0;
        mapIndex   = 0;
        time       = 0;

        if (ptTracker == null)
        {
            ptTracker = FindObjectOfType <PointTracker>().GetComponent <PointTracker>();
        }

        if (energyBar == null)
        {
            energyBar = FindObjectOfType <EnergyBar>().GetComponent <EnergyBar>();
        }
    }
Exemplo n.º 15
0
    void AlignPoints(ref List <Vector3> points, out List <PointTracker> trackers, bool leftHand)
    {
        trackers = new List <PointTracker>();
        int id = 0;

        foreach (Vector3 point in points)
        {
            Debug.Log("Pool ID " + m_LastActiveIndex + " aligned");
            PointTracker currtracker = m_PointsPool[m_LastActiveIndex];

            //Transform point to local space of player
            Vector3 currpoint = point;
            currtracker.transform.position = currpoint;

            //Setup the tracker
            currtracker.Resize(m_TrackerRadius);
            currtracker.Setup(leftHand, id++);

            trackers.Add(currtracker);
            m_LastActiveIndex++;
        }
    }
Exemplo n.º 16
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            BackgroundRectangle      = GetTemplateChild("BackgroundRectangle") as Rectangle;
            PopupBackgroundRectangle = GetTemplateChild("PopupBackgroundRectangle") as Rectangle;
            ContentGrid        = GetTemplateChild("ContentGrid") as Grid;
            PopupContentGrid   = GetTemplateChild("PopupContentGrid") as Grid;
            DragCanvas         = GetTemplateChild("DragCanvas") as Canvas;
            PathFigure1        = GetTemplateChild("PathFigure1") as PathFigure;
            Bezier1            = GetTemplateChild("Bezier1") as QuadraticBezierSegment;
            Bezier2            = GetTemplateChild("Bezier2") as QuadraticBezierSegment;
            Line1              = GetTemplateChild("Line1") as LineSegment;
            BaseCircleTrans    = GetTemplateChild("BaseCircleTrans") as CompositeTransform;
            ContentGridTrans   = GetTemplateChild("ContentGridTrans") as CompositeTransform;
            TargetTracker      = GetTemplateChild("TargetTracker") as PointTracker;
            SourceTracker      = GetTemplateChild("SourceTracker") as PointTracker;
            ContentPopup       = GetTemplateChild("ContentPopup") as Popup;
            TopMostContentRoot = GetTemplateChild("TopMostContentRoot") as Grid;

            if (BackgroundRectangle != null)
            {
                BackgroundRectangle.SizeChanged += BackgroundRectangle_SizeChanged;
            }
        }
Exemplo n.º 17
0
    public bool TrackerCollisionCheck(PointTracker tracker)
    {
        //No tracking being done
        if (!m_IsTrackingLeft && !m_IsTrackingRight)
        {
            return(false);
        }
        //Wrong hand tracker
        if (m_IsTrackingLeft && !tracker.m_LeftHanded)
        {
            return(false);
        }
        if (m_IsTrackingRight && tracker.m_LeftHanded)
        {
            return(false);
        }

        //Find relevant hand information to check
        List <PointTracker> trackpoints = tracker.m_LeftHanded ? m_PointTrackersLeft : m_PointTrackersRight;
        int   findID     = tracker.m_LeftHanded ? m_IDLeftCurr : m_IDRightCurr;
        float trackerVel = tracker.m_LeftHanded ? GestureInput.instance.GetLeftTrackerVelocityMagnitude() : GestureInput.instance.GetRightTrackerVelocityMagnitude();

        //Not moving fast enough to trigger the point
        if (trackerVel < m_MinVelocityMag)
        {
            return(false);
        }

        //Found the right one, gesture is on track
        if (findID == tracker.m_ID)
        {
            //toggle the tracker
            tracker.SetColor(Color.green);
            tracker.ToggleCollider(false);

            //Check if the path is finished
            if (tracker.m_ID >= trackpoints.Count - 1)
            {
                //Path is complete! Gesture has been performed successfully for this hand!
                if (tracker.m_LeftHanded)
                {
                    m_LeftHandSuccess = true;
                }
                else
                {
                    m_RightHandSuccess = true;
                }

                if (m_RightHandSuccess && m_LeftHandSuccess)
                {
                    CallSuccessEvent();
                }
            }
            //Path is not done, get the next tracker
            else
            {
                //Increment tracker counter
                if (tracker.m_LeftHanded)
                {
                    findID = ++m_IDLeftCurr;
                }
                else
                {
                    findID = ++m_IDRightCurr;
                }

                //Update the next tracker to find
                trackpoints[findID].SetColor(Color.yellow);

                //Update the tracker time limit for the hand
                if (tracker.m_LeftHanded)
                {
                    m_TrackerLeftMax = CalcTimeLimit(tracker, trackpoints[findID]);
                }
                else
                {
                    m_TrackerRightMax = CalcTimeLimit(tracker, trackpoints[findID]);
                }
            }

            return(true);
        }

        return(false);
    }
Exemplo n.º 18
0
	void Awake(){

		sessionManager = SessionManager.Instance;
		sessionManager.psInfo.LevelReset();
		
		playerSpawnVectors = new List<Vector3>();

		foreach(Transform location in spawnPositions){
			playerSpawnVectors.Add(location.position);
		}
		hudTools = GetComponent<HUDTools>();
		playersReady = new List<NetworkPlayer>();
		allTimedSpawns = new HeapPriorityQueue<PowerSpawn>(30);


		powerPrefabs = GetComponent<PowerPrefabs>();
		GameObject placementRoot = Instantiate(placementRootPrefab, 
		                                       placementRootPrefab.transform.position, Quaternion.identity) as GameObject;
		placementUI = placementRoot.GetComponent<PlacementUI>();
		timer = GameObject.Find("timer").GetComponent<Timer>();
		timer.Hide();

		ScoreUI scoreUI = placementRoot.GetComponent<ScoreUI>();
		scoreUI.Initialize(sessionManager.psInfo);

		livesUI = placementRoot.GetComponent<LivesUI>();
		livesUI.Initialize(sessionManager.psInfo, sessionManager.psInfo.livesPerRound);

		pointTracker = GetComponent<PointTracker>();
		pointTracker.Initialize(scoreUI);


	}
    public bool CheckTrackerCollision(PointTracker tracker)
    {
        //Check for tracking
        if (!m_IsTracking)
        {
            return(false);
        }

        //Check for ID
        int expectedID = tracker.m_LeftHanded ? m_CurrIndexLeft : m_CurrIndexRight;

        if (tracker.m_ID != expectedID)
        {
            return(false);
        }

        List <PointTracker> trackers = tracker.m_LeftHanded ? m_TrackersLeftHand : m_TrackersRightHand;
        float currVel = tracker.m_LeftHanded ? GestureInput.instance.GetLeftTrackerVelocityMagnitude() : GestureInput.instance.GetRightTrackerVelocityMagnitude();

        //Too slow to hit the tracker
        if (currVel < m_VelMagMin)
        {
            return(false);
        }

        //Successfully hit an expected tracker, toggle it off
        tracker.SetColor(Color.green);
        tracker.ToggleCollider(false);

        int nextID = tracker.m_ID + 1;

        if (nextID >= trackers.Count)
        {
            //Finished gesture, return success if both hands are complete
            if (tracker.m_LeftHanded)
            {
                m_CurrIndexLeft = 0;
            }
            else
            {
                m_CurrIndexRight = 0;
            }

            if (m_CurrIndexRight == 0 && m_CurrIndexLeft == 0)
            {
                CallSuccessEvent();
            }
        }
        else
        {
            //Update the next tracker
            trackers[nextID].SetColor(Color.yellow);
            if (tracker.m_LeftHanded)
            {
                m_CurrIndexLeft = nextID;
            }
            else
            {
                m_CurrIndexRight = nextID;
            }
        }

        return(true);
    }
Exemplo n.º 20
0
 public float CalcTimeLimit(PointTracker a, PointTracker b)
 {
     return(1.0f + (a.transform.position - b.transform.position).sqrMagnitude);
 }
Exemplo n.º 21
0
    //Barinstorm enemy types!!

    // Start is called before the first frame update
    void Start()
    {
        pt = FindObjectOfType <PointTracker>();
    }
Exemplo n.º 22
0
 private void Start()
 {
     hitSound = GetComponent <AudioSource>();
     pt       = FindObjectOfType <PointTracker>();
 }
Exemplo n.º 23
0
 private void Start()
 {
     pointTracker = GameManager.instance.PointsText.GetComponent <PointTracker>();
 }
Exemplo n.º 24
0
 private void Start()
 {
     pickUpNoise = GetComponent <AudioSource>();
     pt          = FindObjectOfType <PointTracker>();
 }
Exemplo n.º 25
0
    //private const string POINTS_TEXT = "Points: ";

    public void Awake()
    {
        instance = this;
    }