Example #1
0
 private void Awake()
 {
     _scoreZone     = FindObjectOfType <ScoreZone>();
     _deadZone      = FindObjectOfType <DeadZone>();
     _babySpawner   = FindObjectOfType <BabySpawner>();
     _dialogManager = FindObjectOfType <DialogManager>();
 }
Example #2
0
    void SpawnPillar()  //기둥을 일정 위치에 일정 속도로 움직이도록 스폰함
    {
        float   randomIndex = Random.Range(4f, 8.1f);
        Vector2 moveDir     = new Vector2(-2.3f, 0);

        GameObject pillarUp   = om.MakeObj("pillarUp");   //윗 기둥
        GameObject pillarDown = om.MakeObj("pillarDown"); //아랫 기둥
        GameObject scoreZone  = om.MakeObj("scoreZone");  //점수 획득 존

        //기둥 스폰 위치
        pillarUp.transform.position   = new Vector3(3.5f, randomIndex);
        pillarDown.transform.position = new Vector3(3.5f, randomIndex - 9.82f);
        scoreZone.transform.position  = new Vector3(3.5f, randomIndex - 4.9f);

        Rigidbody2D rigidU = pillarUp.GetComponent <Rigidbody2D>();
        Rigidbody2D rigidD = pillarDown.GetComponent <Rigidbody2D>();
        Rigidbody2D rigidS = scoreZone.GetComponent <Rigidbody2D>();

        Pillar    pillarULogic = pillarUp.GetComponent <Pillar>();
        Pillar    pillarDLogic = pillarDown.GetComponent <Pillar>();
        ScoreZone scoreLogic   = scoreZone.GetComponent <ScoreZone>();

        //기둥과 점수획득 존을 왼쪽으로 일정하게 움직이도록 함
        rigidU.velocity = moveDir;
        rigidD.velocity = moveDir;
        rigidS.velocity = moveDir;
    }
Example #3
0
 public void Reset()
 {
     transform.position = initialPosit;
     carrier            = null;
     countdown          = timeLimit;
     GetComponent <Renderer>().enabled = true;
     currentScoreZone = null;
 }
Example #4
0
 void TryPollenating(ScoreZone zone)
 {
     if (zone && carrier && carrier.team == zone.team)
     {
         currentScoreZone = zone;
         StartProgressBar(zone);
         pollenating = true;
     }
 }
Example #5
0
    public void OnTriggerExit2D(Collider2D coll)
    {
        ScoreZone zone = coll.GetComponent <ScoreZone>();

        if (zone)
        {
            pollenating      = false;
            currentScoreZone = null;
        }
    }
Example #6
0
    private void Start()
    {
        // Obtain a reference to the score zone and check that it's good.
        ScoreZone m_scoreZone = transform.Find("Score Zone").gameObject.GetComponent <ScoreZone>();

        Assert.IsNotNull(m_scoreZone, "Error! The SoccerNet does not have a ScoreZone registered!");

        // Set it's reference to the game manager.
        m_scoreZone.m_gameManager = m_gameManager;
    }
Example #7
0
    public void OnTriggerEnter2D(Collider2D coll)
    {
        CheckPickup(coll);
        ScoreZone zone = coll.GetComponent <ScoreZone>();

        if (zone)
        {
            currentScoreZone = zone;
            TryPollenating(zone);
        }
    }
Example #8
0
    void Start()
    {
        moveLeft_Event  = new UnityEvent();
        moveRight_Event = new UnityEvent();
        moveLeft_Event.AddListener(MoveLeftGround);
        moveRight_Event.AddListener(MoveRightGround);

        m_Manager = FindObjectOfType <GameManager>();
        speed     = m_Manager.groundSpeed;

        ScoreZone = FindObjectOfType <ScoreZone>();
    }
Example #9
0
    void StartProgressBar(ScoreZone zone)
    {
        if (!progress)
        {
            GameObject go = (GameObject)Instantiate(Resources.Load("ProgressBar"));
            progress = go.GetComponent <ProgressBar>();
        }

        Vector3 temp = zone.transform.position;

        temp.y += 2f;
        progress.transform.position = temp;
    }
Example #10
0
        public static void BringCardFromDeckToScoreZone(ref Game game, Card card, int scoreZoneIndex)
        {
            DeckHelpers.RemoveCardFromDeck(ref game, card);
            var shit = typeof(ScoreZone).GetMethod("AddCard",
                                                   BindingFlags.NonPublic | BindingFlags.Instance);

            ScoreZone[] zonearray    = game.ScoreZones;
            ScoreZone   zoneToModify = game.ScoreZones[scoreZoneIndex];

            shit.Invoke(zoneToModify, new object[] { card });
            zonearray[scoreZoneIndex] = zoneToModify;
            typeof(Game).GetProperty("ScoreZones").SetValue(game, zonearray);
        }