public static SushiSpec Provide(SushiType sushiType)
 {
     switch (sushiType) {
     case SushiType.Amaebi:
         return new SushiSpec(3, 3, 3);
     case SushiType.Ebi:
         return new SushiSpec(3, 3, 4);
     case SushiType.Hamachi:
         return new SushiSpec(1, 5, 1);
     case SushiType.Hokki:
         return new SushiSpec(2, 4, 3);
     case SushiType.Ika:
         return new SushiSpec(3, 3, 1);
     case SushiType.Ikura:
         return new SushiSpec(1, 5, 5);
     case SushiType.Kohada:
         return new SushiSpec(3, 3, 2);
     case SushiType.Maguro:
         return new SushiSpec(4, 2, 3);
     case SushiType.Sulmon:
         return new SushiSpec(3, 5, 1);
     case SushiType.Tako:
         return new SushiSpec(3, 3, 5);
     case SushiType.Tamago:
         return new SushiSpec(4, 3, 5);
     case SushiType.Toro:
         return new SushiSpec(5, 1, 3);
     case SushiType.Uni:
         return new SushiSpec(2, 4, 4);
     default:
         return null;
     }
 }
Beispiel #2
0
    //스코어 추가.
    public void PushScore(SushiType sushiType) {
        Vector3 pos = MakePosition(m_userType, m_scoreSushi.Count);
        
        //스코어용 초밥을 표시합니다.
        GameObject obj = Instantiate(
            m_scoreSushiPrefabs[(int)sushiType],
            pos, Quaternion.identity * Quaternion.Euler(0,0,15)
        ) as GameObject;

        obj.transform.parent = transform;
        m_scoreSushi.Add(obj);
    }
Beispiel #3
0
    //스코어 추가.
    public void PushScore(SushiType sushiType)
    {
        Vector3 pos = MakePosition(m_userType, m_scoreSushi.Count);

        //스코어용 초밥을 표시합니다.
        GameObject obj = Instantiate(
            m_scoreSushiPrefabs[(int)sushiType],
            pos, Quaternion.identity * Quaternion.Euler(0, 0, 15)
            ) as GameObject;

        obj.transform.parent = transform;
        m_scoreSushi.Add(obj);
    }
Beispiel #4
0
    public void OnStateChange(GameState oldState, GameState newState)
    {
        Transform spawnA = gameData.currentMap.hordeSpawnA;
        Transform spawnB = gameData.currentMap.hordeSpawnB;

        if (newState == GameState.PREP)
        {
            // Kill off all old zombies
            foreach (Transform child in transform)
            {
                child.gameObject.GetComponent <ZombieScript>().Kill();
            }

            if (crosshairA.showing)
            {
                crosshairA.Hide();
            }
            if (crosshairB.showing)
            {
                crosshairB.Hide();
            }

            // Reset crosshair positions
            crosshairA.transform.position = new Vector3(spawnA.position.x, crosshairA.transform.position.y, spawnA.position.z);
            crosshairB.transform.position = new Vector3(spawnB.position.x, crosshairB.transform.position.y, spawnB.position.z);
        }

        if (newState == GameState.PLAY)
        {
            zombiesAttachedToCrosshairA.Clear();
            zombiesAttachedToCrosshairB.Clear();

            // Show the crosshairs
            crosshairA.Show();
            crosshairB.Show();

            // Grab the relevant data for this map and wave
            SushiType sushiType         = gameData.currentMap.waves[gameData.wave].sushiType;
            int       count             = gameData.currentMap.waves[gameData.wave].sushiCount;
            int       hitpoints         = gameData.currentMap.waves[gameData.wave].hitpoints;
            float     timeBetweenSpawns = gameData.currentMap.waves[gameData.wave].timeBetweenSpawns;
            zombiesTotal = count;

            // Start spawning
            StartCoroutine(Spawn(sushiType, count, hitpoints, timeBetweenSpawns, spawnA, spawnB));
        }
    }
Beispiel #5
0
    // 스코어 표시 중.
    void UpdateScoreWait()
    {
        if (m_resultAnimationIndex >= m_playerIcons.Length)
        {
            return;
        }
        if (m_resultAnimationIndex == 0)
        {
            // 표시 시작.
            int pCount = m_playerScore.GetComponent <UserScore>().GetCount(SushiType.tamago);
            int oCount = m_opponentScore.GetComponent <UserScore>().GetCount(SushiType.tamago);
            m_playerIcons[0].GetComponent <ResultScore>().FadeIn(pCount, pCount * 8);
            m_opponentIcons[0].GetComponent <ResultScore>().FadeIn(oCount, oCount * 8);
            m_resultAnimationIndex = 1;

            return;
        }


        //스코어를 표시합니다.
        ResultScore prs = m_playerIcons[m_resultAnimationIndex - 1].GetComponent <ResultScore>();
        ResultScore ors = m_opponentIcons[m_resultAnimationIndex - 1].GetComponent <ResultScore>();

        //애니메이션이 끝나면 다음 애니메이션을 재생합니다.
        if (prs.IsEnd() && ors.IsEnd())
        {
            if (m_resultAnimationIndex >= m_playerIcons.Length)
            {
                return;
            }

            SushiType[] typeList  = { SushiType.tamago, SushiType.ebi, SushiType.ikura, SushiType.toro };
            int[]       pointList = { 8, 10, 12, 15 }; // 초밥 타입별 득점 정의.

            SushiType type   = typeList[m_resultAnimationIndex];
            int       point  = pointList[m_resultAnimationIndex];
            int       pCount = m_playerScore.GetComponent <UserScore>().GetCount(type);
            int       oCount = m_opponentScore.GetComponent <UserScore>().GetCount(type);

            //득점 표시 시작.
            m_playerIcons[m_resultAnimationIndex].GetComponent <ResultScore>().FadeIn(pCount, pCount * point);
            m_opponentIcons[m_resultAnimationIndex].GetComponent <ResultScore>().FadeIn(oCount, oCount * point);

            m_resultAnimationIndex++;
        }
    }
Beispiel #6
0
    //스코어 획득.
    public int GetCount(SushiType sushiType)
    {
        //획득 완료되지 않은 것(표시분)을 카운트.
        int count = 0;

        foreach (GameObject obj in m_scoreSushi)
        {
            ScoreSushi sushi = obj.GetComponent <ScoreSushi>();
            SushiType  type  = sushi.m_sushiType;
            if (type == sushiType)
            {
                count++;
            }
        }

        //획득된 것과 더해서 반환합니다.
        return(m_fixedScore[sushiType] + count);
    }
Beispiel #7
0
    //합계 득점 계산.
    int GetResultScore(GameObject userScore)
    {
        SushiType[] typeList  = { SushiType.tamago, SushiType.ebi, SushiType.ikura, SushiType.toro };
        int[]       pointList = { 8, 10, 12, 15 }; //초밥 타입별 득점 정의.

        int result = 0;

        for (int i = 0; i < 4; ++i)
        {
            SushiType type  = typeList[i];
            int       point = pointList[i];
            int       count = userScore.GetComponent <UserScore>().GetCount(type);

            result += count * point;
        }

        return(result);
    }
    void Update()
    {
        updateScreenSize ();
        if (keyConfig.IsPushed (ConfigurableKeyType.M)) {
            soundManager.IsMute = !soundManager.IsMute;
        }
        if (frame >= 60 && !isSelected) {
            if (keyConfig.IsPushed (ConfigurableKeyType.Right)) {
                if ((int)currentSushi + 1 < maxSushi) {
                    currentSushi++;
                } else {
                    currentSushi = (SushiType)0;
                }
                onSushiChanged ();
            }
            if (keyConfig.IsPushed (ConfigurableKeyType.Left)) {
                if (0 < (int)currentSushi) {
                    currentSushi--;
                } else {
                    currentSushi = (SushiType)maxSushi - 1;
                }
                onSushiChanged ();
            }
            if (keyConfig.IsPushed(ConfigurableKeyType.Enter) || keyConfig.IsPushed(ConfigurableKeyType.Space)) {
                Global.CurrentSushiType = currentSushi;
                isSelected = true;
                soundManager.ClickAudioSource.Play ();
                curtain.FadeOut ();
            }
            if (keyConfig.IsPushed(ConfigurableKeyType.Esc)) {
                isSelected = true;
                isReturn = true;
                soundManager.BackAudio.Play ();
                curtain.FadeOut ();
            }
            RectTransform fudaRect = fuda.GetComponent<RectTransform> ();
            fudaRect.anchoredPosition = Vector2.Lerp (fudaRect.anchoredPosition, preferedFudaPositon, 0.2f);
        }

        if (isSelected && curtain.IsFinished) {
            if (!isReturn) {
                Application.LoadLevel ("StageSelect");
            } else {
                Application.LoadLevel ("Title");
            }
        }

        orbitAngle = (orbitAngle + orbitSpeed) % (2f * Mathf.PI);
        Vector3 preferedPosition = new Vector3 (Mathf.Cos (orbitAngle) * orbitRadius, 3, Mathf.Sin (orbitAngle) * orbitRadius - 10f);
        transform.position = Vector3.Lerp (transform.position, preferedPosition, 0.1f);
        Vector3 forward = switchableSushi.transform.position - transform.position;
        Quaternion nextRotation = Quaternion.LookRotation (forward);
        transform.rotation = nextRotation;
        if (frame < 60) {
            frame++;
        } else if (frame == 60) {
            showSprites ();
            updateSpecs ();
            showSpecs ();
        }
    }
 void Start()
 {
     curtain = GameObject.Find ("Curtain").GetComponent<Curtain> ();
     maxSpeedText = GameObject.Find ("MaxSpeedText").GetComponent<Text> ();
     accelerationText = GameObject.Find ("AccelerationText").GetComponent<Text> ();
     weightText = GameObject.Find ("WeightText").GetComponent<Text> ();
     maxSpeedMeterText = GameObject.Find ("MaxSpeedMeter").GetComponent<Text> ();
     accelerationMeterText = GameObject.Find ("AccelerationMeter").GetComponent<Text> ();
     weightMeterText = GameObject.Find ("WeightMeter").GetComponent<Text> ();
     hideSpecs ();
     soundManager = GameObject.Find ("Sounds").GetComponent<SoundManager> ();
     keyConfig = KeyConfig.Current;
     switchableSushi = GameObject.Find("SwitchableSushi").GetComponent<SwitchableSushi>();
     maxSushi = Enum.GetValues (typeof(SushiType)).Length;
     currentSushi = SushiType.Amaebi;
     switchableSushi.InitializeRenderer ();
     switchableSushi.SwitchSushi (currentSushi);
     message = GameObject.Find ("Message");
     fuda = GameObject.Find ("Fuda");
     fudaSprites = new Sprite[] {
         AmaebiSprite,
         EbiSprite,
         HamachiSprite,
         HokkiSprite,
         IkaSprite,
         IkuraSprite,
         KohadaSprite,
         OotoroSprite,
         MaguroSprite,
         SulmonSprite,
         TakoSprite,
         TamagoSprite,
         UniSprite
     };
     frame = 0;
     hideSprites ();
     initFudaPosition ();
     isSelected = false;
     isReturn = false;
 }
Beispiel #10
0
    IEnumerator Spawn(SushiType sushiType, int count, int hitpoints, float timeBetweenSpawns, Transform spawnA, Transform spawnB)
    {
        isSpawning = true;

        bool isSpawnA = true;

        for (int x = 0; x < count; x++)
        {
            Vector3 spawnPos = isSpawnA ? spawnA.position : spawnB.position;
            spawnPos.y = this.transform.position.y;
            GameObject zombie = Instantiate(zombiePrefab, transform);
            zombie.transform.position = spawnPos;

            Sprite sushiSprite = eyesSushi;

            switch (sushiType)
            {
            case SushiType.EYES:
                sushiSprite = eyesSushi;
                break;

            case SushiType.TEETH:
                sushiSprite = teethSushi;
                break;

            case SushiType.SQUID:
                sushiSprite = squidSushi;
                break;

            case SushiType.TENTACLES:
                sushiSprite = tentaclesSushi;
                break;

            case SushiType.BOSS:
                sushiSprite = bossSushi;
                break;

            default: break;
            }

            zombie.transform.GetChild(0).GetComponent <SpriteRenderer>().sprite = sushiSprite;

            Vector3 force = new Vector3(UnityEngine.Random.Range(-100, 100), 0, UnityEngine.Random.Range(-100, 100));
            zombie.GetComponent <Rigidbody>().AddForce(force);
            zombie.GetComponent <ZombieScript>().maxHealth = hitpoints;
            zombie.GetComponent <ZombieScript>().health    = hitpoints;

            if (isSpawnA)
            {
                zombiesAttachedToCrosshairA.Add(zombie);
                crosshairA.maxZombies++;
                crosshairA.currentZombies++;
            }

            if (!isSpawnA)
            {
                crosshairB.maxZombies++;
                crosshairB.currentZombies++;
                zombiesAttachedToCrosshairB.Add(zombie);
            }


            isSpawnA = !isSpawnA;
            yield return(new WaitForSeconds(timeBetweenSpawns));
        }

        isSpawning = false;
        OnSpawnComplete();
    }
 public SushiRenderer(SushiType type, string[] names, SwitchableSushi parent)
 {
     this.type = type;
     this.renderers = new MeshRenderer[names.Length];
     for (int i = 0; i < names.Length; i++) {
         this.renderers[i] = parent.findRendererByName (names[i]);
     }
 }
 public void SwitchSushi(SushiType type)
 {
     foreach (SushiRenderer sushiRenderer in sushiRenderers) {
         sushiRenderer.enabled = sushiRenderer.type == type;
     }
 }
Beispiel #13
0
    //스코어 획득.
    public int GetCount(SushiType sushiType) {
        //획득 완료되지 않은 것(표시분)을 카운트.
        int count = 0;
        foreach(GameObject obj in m_scoreSushi){
            ScoreSushi sushi = obj.GetComponent<ScoreSushi>();
            SushiType type = sushi.m_sushiType;
            if(type == sushiType){
                count++;
            }
        }

        //획득된 것과 더해서 반환합니다.
        return m_fixedScore[sushiType] + count;
    }