Example #1
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         if (OrcaManager2.orcamodori == false)
         {
             if (transform.position.y < 11)
             {
                 Debug.Log("10");
                 //HP回復
                 Hpcontroller.CurrentHP(-10);
                 //スコア追加
                 scoreController.AddScore(-10);
                 //餌生成関数を呼び出し
                 feedGenerator.GetComponent <FeedGenerator>().Revival();
             }
             else
             {
                 Debug.Log("20");
                 //HP回復
                 Hpcontroller.CurrentHP(-10);
                 //スコア追加
                 scoreController.AddScore(-10);
                 //餌生成関数を呼び出し
                 feedGenerator.GetComponent <FeedGenerator>().Revival();
             }
         }
         Destroy(gameObject);
     }
 }
Example #2
0
    void OnTriggerEnter(Collider col)
    {
        if (col.tag == "Enemy")
        {
            this.isHit = true;
            this.health.ModifyHealth(-2);
            gameManager.DestroyAll = true;
            this.soundManager.touchball();
            Debug.Log("Enemy");
        }

        else if (col.tag == "Cube")
        {
            this.SavePos = this.gameObject.transform.position;
            // QbertFunction.SavePosition(nameP, col.transform);
            this.isFallP = false;
            this.isDeadP = false;
        }

        else if (col.tag == "Invincible")
        {
            StartCoroutine(DesactivateCollider());
            soundManager.bonus();
            score.AddScore(250);
        }
        else if (col.tag == "Upgrade(1)")
        {
            soundManager.bonus();
            score.AddScore(250);
        }
    }
Example #3
0
    void knockDown()
    {
        if (this.GetComponent <EnemyWeaponController> ().enabled == true)
        {
            sc.AddScore(500, this.transform.position);
            this.GetComponent <EnemyWeaponController>().dropWeapon();
            sr.sprite = knockedDown;
            this.GetComponent <CircleCollider2D>().enabled = false;
            sr.sortingOrder = 2;
            this.GetComponent <EnemyAI>().enabled                = false;
            this.GetComponent <EnemyAnimate>().enabled           = false;
            this.GetComponent <EnemyWeaponController> ().enabled = false;
        }

        knockDownTimer -= Time.deltaTime;

        if (knockDownTimer <= 0)
        {
            EnemyKnockedDown = false;
            sr.sprite        = backUp;
            this.GetComponent <CircleCollider2D>().enabled      = true;
            this.GetComponent <EnemyAI> ().enabled              = true;
            this.GetComponent <EnemyWeaponController>().enabled = true;
            this.GetComponent <EnemyAnimate>().enabled          = true;
            sr.sortingOrder = 5;
            knockDownTimer  = 3.0f;
        }
    }
Example #4
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         if (transform.position.y < 11)
         {
             Debug.Log("10");
             //HP回復
             Hpcontroller.CurrentHP(5);
             //スコア追加
             scoreController.AddScore(10);
             //餌生成関数を呼び出し
             randoms.Generate();
         }
         else
         {
             Debug.Log("20");
             //HP回復
             Hpcontroller.CurrentHP(10);
             //スコア追加
             scoreController.AddScore(20);
             //餌生成関数を呼び出し
             randoms.Generate();
         }
         Destroy(gameObject);
     }
 }
    public void QuestionAnswer(int answer)
    {
        // Assume question is incorrect, as correct answer will overwrite it
        if (answer >= 0)
        {
            // and avoid iob exceptions!
            _QButtons[answer].GetComponent <Image>().color = new Color(255, 0, 0, 255);
        }
        _QButtons[_CorrectBtn].GetComponent <Image>().color = new Color(0, 255, 0, 255);

        // right/wrong answer
        if (answer == _CorrectBtn)
        {
            // correct
            _QAContainer.DelQuestion(_QIndex);
            if (_QAContainer.CountQuestions() < 2)
            {
                _Gen.GenerateCoins = false;
            }

            TimeLeft += COINTIME;
            _Scr.AddScore(COINSCORE);
        }
        else
        {
            //incorrect
            TimeLeft -= COINTIME;
        }

        _CorrectBtn = -1;
        SetGamestate(STATE.ANSWER);
    }
Example #6
0
    void Update()
    {
        Movement();
        //当たり判定
        Vector2 p1  = transform.position;
        Vector2 p2  = this.player.transform.position;
        Vector2 dir = p1 - p2;
        float   d   = dir.magnitude;
        float   r1  = 0.5f;
        float   r2  = 1.0f;

        if (d < r1 + r2)
        {
            if (transform.position.y < 4)
            {
                scoreController.AddScore(10);
                Hpcontroller.CurrentHP(10);
            }
            else
            {
                scoreController.AddScore(20);
                Hpcontroller.CurrentHP(20);
            }
            //feedGenerator.Count(1);
            Destroy(gameObject);
        }
    }
Example #7
0
    void knockDown()
    {
        //Debug.Log("El enemigo nockeado es " + nombreEnemigo);
        int level;

        if (sceneName == "Tutorial")
        {
            level = 0;
        }
        else
        {
            level = Utils.LevelFromSceneName(sceneName);
        }

        // aqui se sabe que enemigo esta noqueado

        this.GetComponent <EnemyWeaponController> ().dropWeapon();
        if (this.GetComponent <EnemyWeaponController> ().enabled == true)
        {
            sc.AddScore(500, this.transform.position);
            this.GetComponent <EnemyWeaponController> ().enabled = false;
        }

        knockDownTimer -= Time.deltaTime;
        sr.sprite       = knockedDown;
        this.GetComponent <CircleCollider2D>().isTrigger = true;
        this.GetComponent <CircleCollider2D> ().radius   = 1;
        sr.sortingOrder = 2;
        this.GetComponent <EnemyAI>().enabled = false;
        this.GetComponent <EnemyAnimate> ().disableLegs();
        this.GetComponent <EnemyAnimate> ().enabled = false;
        if (this.GetComponent <AIPathFind> () == null)
        {
        }
        else
        {
            this.GetComponent <AIPathFind> ().enabled = false;
        }


        if (knockDownTimer <= 0)
        {
            EnemyKnockedDown = false;
            sr.sprite        = backUp;

            this.GetComponent <CircleCollider2D>().isTrigger     = false;
            this.GetComponent <CircleCollider2D> ().radius       = 0.4f;
            this.GetComponent <EnemyAI> ().enabled               = true;
            this.GetComponent <EnemyWeaponController> ().enabled = true;
            this.GetComponent <EnemyAnimate> ().enabled          = true;  //new for animate
            this.GetComponent <EnemyAnimate> ().enableLegs();

            sr.sortingOrder = 5;
            knockDownTimer  = 3.0f;
        }
    }
Example #8
0
    public void OnAnimalAction(LogicArg arg)
    {
        AnimalActionArg aaArg = (AnimalActionArg)arg;

        foreach (var data in actionScoreList)
        {
            if (aaArg.animalAction == data.action)
            {
                scoreController.AddScore(data.score);
                PlayScoreEffectOn(aaArg.trans, data.score);
            }
        }
    }
Example #9
0
    public void Delete()
    {
        Destroy(gameObject);
        scoreController.AddScore();

        GameObject.FindWithTag("Player").GetComponent <Player>().myStats.MeteorsKilled += 1;
    }
Example #10
0
    void Update()
    {
        if (changeVictoryNumber == true)
        {
            RandomNumberVictory();
        }
        player1Objectif.text = "Qbert : " + victoryP1;
        player2Objectif.text = "PacMan : " + victoryP2;

        foreach (Transform child in transform)
        {
            colorCube = child.GetComponent <ColorCube>();
            if ((int)colorCube.whosColor == 1)
            {
                countP1++;
            }
            else if ((int)colorCube.whosColor == 2)
            {
                countP2++;
            }
        }
        if (countP1 == victoryP1 && countP2 == victoryP2)
        {
            stageint           += 1;
            changeVictoryNumber = true;
            score.AddScore(1000);
            stage.text = "Stage " + stageint;
        }
        countP1 = 0;
        countP2 = 0;
    }
Example #11
0
    void OnTriggerEnter(Collider other)
    {
        if (other.name.StartsWith("Alien") && other.tag != "AlienArea")
        {
            Vector3 alienTransform = new Vector3(other.gameObject.transform.position.x, other.gameObject.transform.position.y, other.gameObject.transform.position.z);
            Destroy(other.gameObject);
            InstantiateExplosion(alienTransform);
            Destroy(gameObject);
            switch (other.tag)
            {
            case "Alien1":
                scoreToAdd = alien1Value;
                break;

            case "Alien2":
                scoreToAdd = alien2Value;
                break;

            case "Alien3":
                scoreToAdd = alien3Value;
                break;
            }
            scoreController.AddScore(scoreToAdd);
            incrementHitCounter();
        }
        else if (other.tag == "Brick")
        {
            consecutiveHitController.ResetConsecutiveHits();
        }
    }
Example #12
0
	void AddScore(string s){
		for (int i=1; i<5; i++) {
			if (s.Contains (i.ToString())) {	
				controller.AddScore(i-1,pot);
			}
		}
	}
Example #13
0
    /// <summary>
    /// ダメージ適応処理
    /// </summary>
    public virtual void ApplyDamage(int damage)
    {
        // ダメージ適応
        hp -= damage;

        // hpチェック
        if (hp <= 0)
        {
            // 0以下の場合

            // 破壊SEの再生
            audioManager.PlaySE(audioManager.DestroySE.name);

            // スコア加算
            ScoreController.AddScore(EnemyData.Score);

            // 撃破数を加算
            ResultPanelController.TempEnemyKillCount++;

            // 破棄する
            Destroy(gameObject);
        }
        else
        {
            // 1以上の場合

            // ダメージSEを再生
            audioManager.PlaySE(audioManager.DamageSE.name);
        }
    }
    IEnumerator constantCheckShape(float time, int i, int j, bool[,] visited)
    {
        bool  shapeHolding = true;
        float timer        = 0;

        while (timer < time && shapeHolding)
        {
            timer          += Time.deltaTime;
            percentComplete = timer / time;
            shapeHolding    = CheckShape(i, j, shape);
            yield return(null);
        }
        resetCurrentTiles();
        if (timer >= time)
        {
            for (int x = 0; x < visited.GetLength(0); x++)
            {
                for (int y = 0; y < visited.GetLength(1); y++)
                {
                    if (visited[x, y] == true)
                    {
                        tileArray[x, y].myState = Tile.States.SET;
                    }
                }
            }
            visualShape.selfDestruct();
            ScoreController.AddScore(100);
            Destroy(this.gameObject);
            //tetrominoReset();
        }

        percentComplete         = 0;
        checkingShapeInProgress = false;
        yield return(null);
    }
Example #15
0
    // Collision with fish
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "BigFish")
        {
            ScoreController.AddScore(3);
            audiosource.PlayOneShot(crunch, 100f);
        }
        else if (other.tag == "SlowFish")
        {
            velocity = 0.1f;
            PlayerScript.timeleft2 = 5.0f;
            ScoreController.RemoveScore(2);
            audiosource.PlayOneShot(argh, 1f);
        }
        else if (other.tag == "InvertFish")
        {
            inversion             = -1;
            PlayerScript.timeleft = 5.0f;
            ScoreController.RemoveScore(2);
            audiosource.PlayOneShot(argh, 1f);
        }
        else if (other.tag == "Fish")
        {
            ScoreController.AddScore(1);
            audiosource.PlayOneShot(crunch, 100f);
        }

        other.gameObject.SetActive(false);
        //	ViewController.Update();
    }
Example #16
0
    void OnCollisionEnter(Collision c)
    {
        if (c.transform.tag.Equals("Bee") || c.transform.tag.Equals("Wall"))
        {
            Bounce(c.relativeVelocity.magnitude);
            Bee b = c.gameObject.GetComponent <Bee>();

            if (b != null)
            {
                if (b.lastBeeHit == this)
                {
                    return;
                }

                int   p          = Mathf.FloorToInt((float)baseScore * multiplier * b.multiplier);              /// SCORE
                Score scoreSpawn = Instantiate(scorePrefab);
                scoreSpawn.transform.position = c.GetContact(0).point;
                //scoreSpawn.transform.position = transform.position;
                scoreSpawn.SetPoints(p);
                ScoreController.AddScore(p);
                AddMultiplier();

                lastBeeHit   = b;
                b.lastBeeHit = this;
            }
        }
    }
Example #17
0
    void Event_WeHaveToCooperate()
    {
        childS1         = pyramide.transform.GetChild(childRandom2).GetComponent <WeHaveToCoorperate>();
        childS2         = pyramide.transform.GetChild(childRandom1).GetComponent <WeHaveToCoorperate>();
        childS2.enabled = true;
        childS1.enabled = true;

        if (EventFinish == false)
        {
            timerofThisEvent -= Time.deltaTime;
            if (timerofThisEvent < 0 && childS1.playerDetected == false || timerofThisEvent < 0 && childS2.playerDetected == false)
            {
                Debug.Log("FAIL");
                launchEvent = false;
                EventFail   = true;
                EventFinish = true;
                childS2.StopiTween();
                childS1.StopiTween();
                childS2.enabled = false;
                childS1.enabled = false;
            }
            else if (childS1.playerDetected == true && childS2.playerDetected == true)
            {
                EventFail   = false;
                EventFinish = true;
                launchEvent = false;
                childS2.StopiTween();
                childS1.StopiTween();
                childS2.enabled = false;
                childS1.enabled = false;
                score.AddScore(500);
            }
        }
    }
Example #18
0
 void Zero(int r, int c)
 {
     zeroFlag[r, c] = true; //フラグを立てる
     zeroCount++;           //ゼロを増やす
     ec.ZeroEffect(r, c);   //ゼロになった時のエフェクトを出す
     sc.AddScore(100);      //スコアを加算
     if (BitCheck())
     {
         StartCoroutine(SetBitMode());
         Debug.Log("BitMode");
     }
     else
     {
         Debug.Log("NotBitMode");
     }
 }
Example #19
0
    public void GenerateStage()
    {
        roomIndex = Random.Range(0, roomAvalaible.Length);
        //Vector3 starPosition = roomSpawn.transform.position;
        //Vector3 position = starPosition;
        //Quaternion rotation = transform.rotation;
        GameObject clone = Instantiate(roomAvalaible[roomIndex], roomSpawn.position, roomSpawn.rotation);

        //position = clone.transform.Find("exit").position;
        //rotation = clone.transform.Find("exit").rotation;
        totalRoomsSpawned += 1;
        //foreach(int p in pattern){
        //GameObject tile = tiles[p];
        //GameObject clone = Instantiate(tile, position, rotation);
        //selfDestruct = true;
        roomSpawn.position += new Vector3(52, 0, 0);

        GameObject[] dangerobj = GameObject.FindGameObjectsWithTag("danger");
        for (int i = 0; i < dangerobj.Length; i++)
        {
            Destroy(dangerobj [i]);
        }

        GameObject[] trapobj = GameObject.FindGameObjectsWithTag("trap");
        for (int i = 0; i < trapobj.Length; i++)
        {
            Destroy(trapobj [i]);
        }

        sc.AddScore(scoreValue, false);
    }
Example #20
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.CompareTag("PointTrigger"))
     {
         scoreController.AddScore();
     }
 }
    public override void AddScore(List <Block> blocksToRemove, int seqMultiplier = 1)
    {
        var score    = ScoreDomain.GetScore(blocksToRemove);
        var newScore = ScoreController.AddScore(score);

        MathTetrisSpawner spawner = (MathTetrisSpawner)SpawnerController;

        if (newScore >= LevelController.ScoreToNextLevel)
        {
            var newLevel = LevelController.AddLevel();
            if (newLevel == 2)
            {
                spawner.AddNumber(4);
            }
            if (newLevel == 3)
            {
                spawner.AddOperator('=');
            }
            if (newLevel == 4)
            {
                spawner.AddNumber(5);
            }
            //if (newLevel == 5)
            //spawner.MultiplierChances = 0.2m;
        }
    }
Example #22
0
    public void OnBrickDestroyed()
    {
        int penalty    = _consecutiveBounces * Settings.BouncePenalty;
        int multiplier = Level * Settings.LevelMultiplier;

        ScoreController.AddScore(Settings.DefaultBrickScore, penalty, Settings.MinBrickScore, multiplier);
    }
Example #23
0
    // Start is called before the first frame update
    void Start()
    {
        scoreController.AddScore(0);

        isGamePaused = false;

        entitiesParent = new GameObject("EntitiesParent").transform;
        CreatePool();

        contexts    = Contexts.sharedInstance;
        gameContext = contexts.game;
        systems     = CreateSystems(contexts);
        systems.Initialize();

        SoundManager.Instance.gamestartSound.Play();
    }
Example #24
0
 private void Update()
 {
     if (!fallen && gameObject.GetComponent <Rigidbody>().velocity.magnitude > 1)
     {
         scoreObject.AddScore();
         fallen = true;
     }
 }
Example #25
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Ball"))
     {
         _ps.Play();
         _score.AddScore();
     }
 }
    /// <summary>
    /// ダメージ適応処理
    /// </summary>
    public override void ApplyDamage(int damage)
    {
        // ダメージ適応
        hp -= damage;

        // hpチェック
        if (hp <= 0)
        {
            // 0以下の場合

            // 音楽の停止
            audioManager.StopSound();

            // 破壊SEの再生
            audioManager.PlaySE(audioManager.DestroySE.name);

            // スコア加算
            ScoreController.AddScore(EnemyData.Score);

            // 撃破数を加算
            ResultPanelController.TempEnemyKillCount++;

            // プレイヤーレベル加算
            PlayerListsController.LevelUp();

            // ボスの位置にパーティクルシステムを配置
            DestroyDirection.transform.position = transform.position;

            // パーティクルシステムを再生
            DestroyDirection.Play();

            // nullチェック
            if (EnemyBulletGenerator != null)
            {
                // nullでない場合

                // 全てのジェネレータを無効にする
                for (int i = 0; i > EnemyBulletGenerator.Length; i++)
                {
                    EnemyBulletGenerator[i].GetComponent <EnemyBulletGenerator>().enabled = false;
                }
            }

            // リザルトパネルを表示する
            ResultPanel.SetActive(true);

            // オブジェクトを無効にする
            enabled = false;
            gameObject.SetActive(false);
        }
        else
        {
            // 1以上の場合

            // ダメージSEを再生
            audioManager.PlaySE(audioManager.DamageSE.name);
        }
    }
Example #27
0
    private void Dies()
    {
        GameObject instantiated = Instantiate(diedPrefab);

        instantiated.transform.position = transform.position;
        scoreController.AddScore(score);
        dies.Invoke(this);
        Destroy(gameObject);
    }
    private void AddScore()
    {
        ScoreController scoreController = GameObject.FindGameObjectWithTag("ScoreController").GetComponent <ScoreController>();
        ScoreMultiplier scoreMultiplier = GameObject.FindGameObjectWithTag("ScoreMultiplier").GetComponent <ScoreMultiplier>();

        score = zombie.score * scoreMultiplier.multiplier;
        scoreController.AddScore(score);
        scoreMultiplier.Increment();
    }
Example #29
0
 //Skrevet av oss
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Coin")
     {
         Destroy(other.gameObject);
         //Inspirasjon fra UI youtube-tutorial(se link i eget doc)
         scoreController.AddScore(scoreValue);
     }
 }
Example #30
0
    void knockDown()
    {
        knockDownTimer -= Time.deltaTime;
        sr.sprite       = knockedDown;
        this.GetComponent <CircleCollider2D> ().enabled = false;
        this.GetComponent <EnemyAI> ().enabled          = false;

        if (knockDownTimer <= 0)
        {
            sc.AddScore(500, this.transform.position);
            EnemyKnockedDown = false;
            sr.sprite        = backUp;
            this.GetComponent <EnemyAI> ().enabled          = true;
            this.GetComponent <CircleCollider2D> ().enabled = true;

            knockDownTimer = 3.0f;
        }
    }