public void WithScoreOf(int score, Vector3 positionOfItem) { theScore = FindObjectOfType <ScoreControl>(); theScore.AddScore(score); MyScore = score; tester = true; Score.transform.position = positionOfItem; }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("Player")) { Destroy(gameObject); } scoreControl.AddScore(scoreValue); }
public void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("BulletPlayer")) { Score.AddScore(100); GameObject NewExplosion = (GameObject)Instantiate(Explosion, transform.position, Quaternion.identity); Destroy(collision.gameObject); Destroy(gameObject); } }
/*------------------------------------------- * DestroyEnemy * * summary:敵の消滅 * param :消滅したい敵の最初(int),終わり(int) * return :なし(void) * -------------------------------------------*/ void DestroyEnemy(int first, int end) { int enemy_num = end - first + 1; // 倒した敵の数 EnemyControl ec; COLOR target_color; // はさんで消した色 /* スコア加算(※敵消滅より先に処理すること!!) */ ec = m_Enemy_list[first].GetComponent <EnemyControl>(); // 適当に最初 target_color = ec.GetEnemyColor(); switch (target_color) { case COLOR.RED: ScoreControl red_score = GameObject.FindGameObjectWithTag("RedScore").GetComponent <ScoreControl>(); red_score.AddScore(enemy_num); break; case COLOR.GREEN: ScoreControl green_score = GameObject.FindGameObjectWithTag("GreenScore").GetComponent <ScoreControl>(); green_score.AddScore(enemy_num); break; case COLOR.BLUE: ScoreControl blue_score = GameObject.FindGameObjectWithTag("BlueScore").GetComponent <ScoreControl>(); blue_score.AddScore(enemy_num); break; } /* 敵の消滅処理 */ for (int i = first; i <= end; ++i) { /* 消滅風(実際には消してない) */ ec = m_Enemy_list[i].GetComponent <EnemyControl>(); ec.SetEnemyAttribute(null, COLOR.NONE); /* エフェクト生成 */ ec.CreateEffect(target_color); /* 物理計算は行わない */ PolygonCollider2D bc = m_Enemy_list[i].GetComponent <PolygonCollider2D>(); bc.isTrigger = true; } }
//追加被击倒的怪物数量 public void AddDefeatNum(int num) { this.oni_group_defeat_num++; this.oni_group_complite++; this.result.oni_defeat_num += num; this.attack_time = this.player.GetComponent <PlayerControl>().GetAttackTimer(); if (this.evaluation == EVALUATION.MISS) { this.evaluation = EVALUATION.OKEY; } else { if (this.attack_time < ATTACK_TIME_GREAT) { this.evaluation = EVALUATION.GREAT; } else if (this.attack_time < ATTACK_TIME_GOOD) { this.evaluation = EVALUATION.GOOD; } else { this.evaluation = EVALUATION.OKEY; } } //计算得分 //togo //float[] score_list = { this.eval_rate_okey, this.eval_rate_good, this.eval_rate_great, 0 }; //this.result.score_max += num * this.eval_rate_great; //this.result.score += num * score_list[(int)this.evaluation]; scoreControl.AddScore(num); }