Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothy-Liuxf authored Apr 21, 2022
1 parent 7598653 commit 7aa4c19
Show file tree
Hide file tree
Showing 58 changed files with 4,250 additions and 0 deletions.
24 changes: 24 additions & 0 deletions 源代码/fumo/enter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using UnityEngine;

public class enter : MonoBehaviour
{
// Start is called before the first frame update
public GameObject Fumo;
public GameObject Fumo_button;
void Start()
{
Fumo.SetActive(false);
}
public void Setactive()
{
Fumo.SetActive(true);
Fumo_button.SetActive(false);
}
public void Setsleep()
{
Fumo.SetActive(false);
Fumo_button.SetActive(true);
}
// Update is called once per frame

}
75 changes: 75 additions & 0 deletions 源代码/fumo/material.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class material : MonoBehaviour
{

public Slider Material_slider;
public Text Material_text;
public GameObject success_picture;
public GameObject fail_picture;
public GameObject success_button;
public GameObject fail_button;
void Start()
{
success_picture.SetActive(false);
fail_picture.SetActive(false);
success_button.SetActive(false);
fail_button.SetActive(false);
}

void Update()
{
int Material = (int)(Material_slider.value * 80);
Material_text.text = Material.ToString();
}
public void close_success()
{
success_picture.SetActive(false);
success_button.SetActive(false);
}
public void close_fail()
{
fail_picture.SetActive(false);
fail_button.SetActive(false);
}
public void Fumo()
{
int Material = (int)(Material_slider.value * 80);
if (Material <= numerical.material)
{
numerical.material -= Material;
//写一下材料值=材料值减去Material;
Material_slider.value = 0;
int success = Random.Range(1, 81);
if (Material >= success)
{
int p = Random.Range(1, 100);
if (p % 3 == 1)
{
numerical.force_ability += 15;
//武力值上升15;
}
else if (p % 3 == 2)
{
numerical.force_ability += 30;
//武力值上升30;
}
else if (p % 3 == 0)
{
numerical.force_ability += 45;
//武力值上升45;
}
success_picture.SetActive(true);
success_button.SetActive(true);
}
else
{
fail_picture.SetActive(true);
fail_button.SetActive(true);
}
}
}
}
19 changes: 19 additions & 0 deletions 源代码/scrips/Choose_destroy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Choose_destroy : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void Update()
{
if (numerical.destroy)
Destroy(this.gameObject);
}
}
11 changes: 11 additions & 0 deletions 源代码/scrips/Exit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Exit : MonoBehaviour
{
public void click()
{
Application.Quit();
}
}
28 changes: 28 additions & 0 deletions 源代码/scrips/develop/Choice_button.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Choice_button : MonoBehaviour
{
bool happen;
private void Start()
{
happen = false;
}
public void Choice1()
{
if (!happen)
{
numerical.choice = 1;
happen = !happen;
}
}
public void Choice2()
{
if (!happen)
{
numerical.choice = 2;
happen = !happen;
}
}
}
44 changes: 44 additions & 0 deletions 源代码/scrips/develop/Choice_develop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Choice_develop : MonoBehaviour
{
bool happen;
private void Start()
{
happen = false;
}
public void construct()
{
if (!happen)
{
numerical.material += 6 + numerical.random(0, 4);
numerical.hungry += 10 + numerical.random(0, 10);
if (numerical.force > 0)
numerical.force -= numerical.random(0,10);
if (numerical.random(1, 10) <= 2 && numerical.a != 2)
numerical.monster = 1;
numerical.choice = 0;
numerical.win = 0;
numerical.succeed = 0;
happen = !happen;
}
}
public void explore()
{
if (!happen)
{
if (numerical.hungry >= 3)
numerical.hungry -= 3;
else
numerical.hungry = 0;
if (numerical.random(1, 10) <= 2 && numerical.a != 2)
numerical.monster = 1;
numerical.choice = 0;
numerical.win = 0;
numerical.succeed = 0;
happen = !happen;
}
}
}
52 changes: 52 additions & 0 deletions 源代码/scrips/develop/Scene_window_dev_construct.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class Scene_window_dev_construct : MonoBehaviour
{
//public GameObject eventObj;
//public GameObject eventObj2;
public Animator animator;
// Start is called before the first frame update
void Start()
{
numerical.scene_happen = false;
GameObject.DontDestroyOnLoad(this.gameObject);
//GameObject.DontDestroyOnLoad(this.eventObj);
//GameObject.DontDestroyOnLoad(this.eventObj2);//切换场景时使组件不被破坏
}

public void LoadSceneA()
{
if (!numerical.scene_happen)
{
if (numerical.hungry <= 0)
StartCoroutine(LoadScene(7));
else if(numerical.a==3)
StartCoroutine(LoadScene(10));
else
StartCoroutine(LoadScene(9));//在bulidSettings中设置(unity)
numerical.scene_happen = true;
}
}


// Update is called once per frame
IEnumerator LoadScene(int index)
{
animator.SetBool("fadeout", true);
animator.SetBool("fadein", false);//设置bool参数
yield return new WaitForSeconds(1);//等待一秒空白期
AsyncOperation async = SceneManager.LoadSceneAsync(index);
async.completed += OnLoadedScene;
yield return new WaitForSeconds(1);
Destroy(this.gameObject);
}

private void OnLoadedScene(AsyncOperation obj)
{
animator.SetBool("fadeout", false);
animator.SetBool("fadein", true);
}
}
87 changes: 87 additions & 0 deletions 源代码/scrips/develop/Scene_window_dev_explore.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class Scene_window_dev_explore : MonoBehaviour
{
//public GameObject eventObj;
//public GameObject eventObj2;
public Animator animator;
// Start is called before the first frame update
void Start()
{
numerical.scene_happen = false;
GameObject.DontDestroyOnLoad(this.gameObject);
//GameObject.DontDestroyOnLoad(this.eventObj);
//GameObject.DontDestroyOnLoad(this.eventObj2);//切换场景时使组件不被破坏
}

public void LoadSceneA()
{
if (!numerical.scene_happen)
{
int change_to = 0;
if (numerical.hungry <= 0)
change_to = 7;
else if (numerical.random(1, 100) > 30)
{
if (numerical.a == 3)
{
if (numerical.random(1, 100) <= 20 && numerical.b4 == 0 && numerical.b1 != 0)
{
change_to = 14;
numerical.b4++;
}
else if (numerical.b_sort % 10 == 1)
change_to = 12;
else if (numerical.b_sort % 10 == 2)
change_to = 15;
else if (numerical.b_sort % 10 == 3)
change_to = 16;
else if (numerical.b_sort % 10 == 4)
change_to = 17;
else
change_to = 13;
}
else
{
if (numerical.b_sort % 10 == 1)
change_to = 12;
else if (numerical.b_sort % 10 == 2)
change_to = 15;
else if (numerical.b_sort % 10 == 3)
change_to = 17;
else if (numerical.b_sort % 10 == 4)
change_to = 18;
else
change_to = 13;
}
numerical.b_sort /= 10;
}
else
change_to = 11;
StartCoroutine(LoadScene(change_to));//在bulidSettings中设置(unity)
numerical.scene_happen = true;
}
}


// Update is called once per frame
IEnumerator LoadScene(int index)
{
animator.SetBool("fadeout", true);
animator.SetBool("fadein", false);//设置bool参数
yield return new WaitForSeconds(1);//等待一秒空白期
AsyncOperation async = SceneManager.LoadSceneAsync(index);
async.completed += OnLoadedScene;
yield return new WaitForSeconds(1);
Destroy(this.gameObject);
}

private void OnLoadedScene(AsyncOperation obj)
{
animator.SetBool("fadeout", false);
animator.SetBool("fadein", true);
}
}
Loading

0 comments on commit 7aa4c19

Please sign in to comment.