示例#1
0
    public void MovePlayer(Vector2 moveDir, int fameSliderValue)
    {
        if (dancePartner && Vector2.Distance(moveDir, expectedDir) == 0f)
        {
            Vector3 tempPos = transform.position;
            transform.position = dancePartner.transform.position;
            dancePartner.transform.position = tempPos;
            dancePartner.IncreaseSatisfaction();
            if (!dancePartner.IsDanceable)
            {
                dancePartner = null;
            }
            return;
        }

        Vector3 pos = transform.position;

        moveDir *= 0.5f;

        if (pos.x + moveDir.x < zone.GetMinX() ||
            (pos.x + moveDir.x > zone.GetMaxX() && !canProgress) ||
            pos.y + moveDir.y > 2.5f ||
            pos.y + moveDir.y < -0.5f)
        {
            return;
        }

        pos += new Vector3(moveDir.x, moveDir.y, 0f);
        transform.position = pos;
        Mathf.Clamp(fameBonusSlider.value += fameSliderValue, 0, 100);
    }
示例#2
0
 public void TryRemoveDancePartner(DancePartner inDancePartner)
 {
     if (dancePartner && dancePartner == inDancePartner)
     {
         dancePartner = null;
     }
 }
示例#3
0
    public void TryGiveDancePartner(DancePartner inDancePartner, DancePartnerDetector.DetectorSide side)
    {
        if (!dancePartner && inDancePartner.IsDanceable)
        {
            dancePartner = inDancePartner;

            if (side == DancePartnerDetector.DetectorSide.Right)
            {
                expectedDir = Vector2.right;
            }
            else
            {
                expectedDir = Vector2.left;
            }
        }
    }
示例#4
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (!player)
        {
            player = other.GetComponent <Player>();
            if (player)
            {
                player.SetPlayerZone(this);
                if (name.Contains("Boss"))
                {
                    player.fightingBoss = true;
                    Debug.Log("New beat tempo: " + (150.0f / 60.0f));
                    BeatManager.Instance.SongTempo = 150.0f / 60.0f;
                    BeatManager.Instance.SetSong(bossSong);
                }
            }
        }
        DancePartner dancePartner = other.GetComponent <DancePartner>();

        if (dancePartner)
        {
            dancePartners.Add(dancePartner);
        }
    }
示例#5
0
 void CheckAllDancersSatisfied()
 {
     if (player)
     {
         bool         allSatisfied = true;
         DancePartner satisfied    = null;
         foreach (DancePartner dancePartner in dancePartners)
         {
             if (dancePartner.IsSatisfied)
             {
                 satisfied = dancePartner;
             }
             else if (allSatisfied)
             {
                 allSatisfied = false;
             }
         }
         dancePartners.Remove(satisfied);
         if (allSatisfied)
         {
             player.CanProgress(true);
         }
     }
 }