• 大小: 9.66MB
    文件类型: .zip
    金币: 2
    下载: 0 次
    发布日期: 2024-02-05
  • 语言: C#
  • 标签: 切水果  

资源简介

切水果源码,曲线水果刀,分数统计,炸弹发射,掉落统计,随即发射水果等功能实现

资源截图

代码片段和文件信息

using UnityEngine;
using System.Collections;

public class AnimalHit : MonoBehaviour {

// Use this for initialization
public Gameobject Animal01;
public Gameobject Animal02;
//保证水果只被击中一次
private bool hasHit = false;
AudioSource audioSource;
float time;
void Start () {
time = Time.time;
audioSource = GetComponent ();

}

// Update is called once per frame
void Update () {


}
void isHit(){
Debug.Log (“Screen.width = “ + Screen.width + “Screen.height = “ + Screen.height);

Gameobject game = Gameobject.Find (“Main Camera“);
SceneController cout = game.GetComponent();
cout.hitAnimals();


float angle01 = (float)(Random.Range ((float)50.0 (float)180.0) * 180 / 3.14);
float angle02 = (float)(Random.Range ((float)30.0 (float)150.0) * 180 / 3.14);
Gameobject firstGameobject = (Gameobject)Instantiate (Animal01 transform.position Quaternion.AngleAxis (angle01 Vector3.forward));
Gameobject secondGameobject = (Gameobject)Instantiate (Animal02 transform.position Quaternion.AngleAxis (angle02 Vector3.forward));

firstGameobject.GetComponent ().velocity = new Vector2 (-510);
secondGameobject.GetComponent ().velocity = new Vector2 (8-10);
Physics.gravity = new Vector3 (0 -20 0);
Destroy (gameobject);

Destroy (firstGameobject 2.5f);
Destroy (secondGameobject 2.5f);
}

void OnCollisionEnter(Collision collisionInfo)
{
Debug.Log (“is hit“);
if (collisionInfo.gameobject.name.Equals (“knifePoint(Clone)“)) {
if (!hasHit) {
this.isHit ();
}
hasHit = true;
}

}
void OnTriggerEnter(Collider other) {
// Debug.Log (“is hit“);
if (other.gameobject.name.Equals (“knifePoint(Clone)“)) {
if (!hasHit) {
this.isHit ();
}
hasHit = true;
}
}
void OnBecameInvisible() {
Debug.Log (“fall“);
}


}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-10-12 11:17  New Unity Project\
     文件        8196  2015-09-07 12:56  New Unity Project\.DS_Store
     目录           0  2015-10-12 11:50  __MACOSX\
     目录           0  2015-10-12 11:50  __MACOSX\New Unity Project\
     文件         120  2015-09-07 12:56  __MACOSX\New Unity Project\._.DS_Store
     文件        4674  2015-09-09 10:54  New Unity Project\Assembly-CSharp-vs.csproj
     文件        4674  2015-09-09 10:54  New Unity Project\Assembly-CSharp.csproj
     文件        3682  2015-08-17 20:56  New Unity Project\Assembly-Unityscript-vs.unityproj
     文件        3682  2015-08-17 20:56  New Unity Project\Assembly-Unityscript.unityproj
     目录           0  2015-10-12 11:47  New Unity Project\Assets\
     文件        6148  2015-09-07 12:56  New Unity Project\Assets\.DS_Store
     目录           0  2015-10-12 11:50  __MACOSX\New Unity Project\Assets\
     文件         120  2015-09-07 12:56  __MACOSX\New Unity Project\Assets\._.DS_Store
     目录           0  2015-09-09 10:42  New Unity Project\Assets\FX_Kandol_Pack\
     目录           0  2015-09-09 10:42  New Unity Project\Assets\FX_Kandol_Pack\FX_effect_sprite_image01\
     目录           0  2015-09-09 10:42  New Unity Project\Assets\FX_Kandol_Pack\FX_effect_sprite_image01\FX_fire_effects_free\
     目录           0  2015-09-09 10:42  New Unity Project\Assets\FX_Kandol_Pack\FX_effect_sprite_image01\FX_fire_effects_free\Prefabs\
     文件       46512  2015-03-10 09:17  New Unity Project\Assets\FX_Kandol_Pack\FX_effect_sprite_image01\FX_fire_effects_free\Prefabs\fx_fire_a.prefab
     文件         138  2015-09-09 10:42  New Unity Project\Assets\FX_Kandol_Pack\FX_effect_sprite_image01\FX_fire_effects_free\Prefabs\fx_fire_a.prefab.meta
     目录           0  2015-10-12 11:50  __MACOSX\New Unity Project\Assets\FX_Kandol_Pack\
     目录           0  2015-10-12 11:50  __MACOSX\New Unity Project\Assets\FX_Kandol_Pack\FX_effect_sprite_image01\
     目录           0  2015-10-12 11:50  __MACOSX\New Unity Project\Assets\FX_Kandol_Pack\FX_effect_sprite_image01\FX_fire_effects_free\
     目录           0  2015-10-12 11:50  __MACOSX\New Unity Project\Assets\FX_Kandol_Pack\FX_effect_sprite_image01\FX_fire_effects_free\Prefabs\
     文件         120  2015-09-09 10:42  __MACOSX\New Unity Project\Assets\FX_Kandol_Pack\FX_effect_sprite_image01\FX_fire_effects_free\Prefabs\._fx_fire_a.prefab.meta
     文件       46520  2015-03-10 09:17  New Unity Project\Assets\FX_Kandol_Pack\FX_effect_sprite_image01\FX_fire_effects_free\Prefabs\fx_fire_ball_b.prefab
     文件         138  2015-09-09 10:42  New Unity Project\Assets\FX_Kandol_Pack\FX_effect_sprite_image01\FX_fire_effects_free\Prefabs\fx_fire_ball_b.prefab.meta
     文件         120  2015-09-09 10:42  __MACOSX\New Unity Project\Assets\FX_Kandol_Pack\FX_effect_sprite_image01\FX_fire_effects_free\Prefabs\._fx_fire_ball_b.prefab.meta
     文件       46520  2015-03-10 09:16  New Unity Project\Assets\FX_Kandol_Pack\FX_effect_sprite_image01\FX_fire_effects_free\Prefabs\fx_fire_ball_bb.prefab
     文件         138  2015-09-09 10:42  New Unity Project\Assets\FX_Kandol_Pack\FX_effect_sprite_image01\FX_fire_effects_free\Prefabs\fx_fire_ball_bb.prefab.meta
     文件         120  2015-09-09 10:42  __MACOSX\New Unity Project\Assets\FX_Kandol_Pack\FX_effect_sprite_image01\FX_fire_effects_free\Prefabs\._fx_fire_ball_bb.prefab.meta
     文件       46520  2015-03-10 09:16  New Unity Project\Assets\FX_Kandol_Pack\FX_effect_sprite_image01\FX_fire_effects_free\Prefabs\fx_fire_ball_bbb.prefab
............此处省略1757个文件信息

评论

共有 条评论

相关资源