当前位置:网站首页>Gameframework making games (I)
Gameframework making games (I)
2022-07-25 14:26:00 【At Tour】
Preface : About how to download the installation framework , I won't teach here , There's too much Internet
This is the download address :https://gameframework.cn/download/
1. Create the first script
When we started doing it , Create a Sence, And then put GameFramework Prefabricated body dragged in , Here's the picture 

Create a script Demo11_ProcedureLaunch, Inherited from procedureBase
using GameFramework.Procedure;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityGameFramework.Runtime;
using ProcedureOwner = GameFramework.Fsm.IFsm<GameFramework.Procedure.IProcedureManager>;
public class Demo11_ProcedureLaunch : ProcedureBase
{
protected override void OnEnter(ProcedureOwner procedureOwner)
{
base.OnEnter(procedureOwner);
Debug.LogError("1111");// Here you can print out what you want , for example sayHelloWorld
}
}
Put your script into the process 
2. Then switch scenes
using GameFramework.Procedure;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityGameFramework.Runtime;
using ProcedureOwner = GameFramework.Fsm.IFsm<GameFramework.Procedure.IProcedureManager>;
public class Demo11_ProcedureLaunch : ProcedureBase
{
protected override void OnEnter(ProcedureOwner procedureOwner) // You can understand Start() Life cycle
{
base.OnEnter(procedureOwner);
Debug.LogError("1111");// Here you can print out what you want , for example sayHelloWorld
SceneComponent Scene
= UnityGameFramework.Runtime.GameEntry.GetComponent<SceneComponent>(); // It is a framework component specially used for processing scenario logic , Look at the picture below
// Switching scenes
Scene.LoadScene("Assets/Demo11/Demo11_Meun.unity", this);// Scene path
// Switch process
ChangeState<Demo11_Meun>(procedureOwner);
Debug.LogError("??/");
}
}

At this time, we need to create a new empty scene Demo11_Meun scene , And a Demo11_Meun Script , Used for jump
The script is simple
using GameFramework.Procedure;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityGameFramework.Runtime;
using ProcedureOwner = GameFramework.Fsm.IFsm<GameFramework.Procedure.IProcedureManager>;
public class Demo11_Meun : ProcedureBase// Inheritance is to write the script into the process
{
protected override void OnEnter(ProcedureOwner procedureOwner)
{
base.OnEnter(procedureOwner);
}
}
Inherit ProcedureBase, After entering the process , Remember to check the process 
Tick the menu script you want to display
Then open the Build Settings Put the scene in 
function 
The scene is loaded .
3. The scene is loaded for the second time , Unload the first loaded scene , The original scene will not be uninstalled
establish Demo11_Game scene , establish Demo11_Game Script 
The script continues to inherit , Remember to check the process
using GameFramework.Procedure;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using ProcedureOwner = GameFramework.Fsm.IFsm<GameFramework.Procedure.IProcedureManager>;
public class Demo11_Game : ProcedureBase
{
protected override void OnEnter(ProcedureOwner procedureOwner)
{
base.OnEnter(procedureOwner);
Debug.Log(" Enter the game flow , You can deal with game logic here , This log will not print , Because I didn't switch to Game technological process ");
}
}
Write a control script Demo11_Controller Inherit Monobehaviour, Create a Button, stay Demo11_Meun scene
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityGameFramework.Runtime;
public class Demo11_Controller : MonoBehaviour
{
public void NextMethod()
{
// Get the framework scene component
SceneComponent Scene
= UnityGameFramework.Runtime.GameEntry.GetComponent<SceneComponent>();
// Uninstall all scenes
string[] loadedSceneAssetNames = Scene.GetLoadedSceneAssetNames();
for (int i = 0; i < loadedSceneAssetNames.Length; i++)
{
Scene.UnloadScene(loadedSceneAssetNames[i]);
}
// Load game scenes
Scene.LoadScene("Assets/Demo11/Demo11_Game.unity", this);
}
}

Remember Demo11_Game Put the scene into BuildSettings Inside ,
function 
Click button , Get into Game scene , uninstall Menu scene , Our initial first scenario will not be uninstalled .
边栏推荐
- 快速搭建Dobbo小Demo
- 机械制造业数字化新“引擎”供应链协同管理系统助力企业精细化管理迈上新台阶
- 牛客多校 E G J L
- ~4.2 CCF 2021-12-1 sequence query
- idea正则表达式替换(idea正则搜索)
- Interpretation of featdepth self-monitoring model for monocular depth estimation (Part 2) -- use of openmmlab framework
- 元器件采购系统的主要功能,数字化采购助力元器件企业飞速发展
- CDA level1 multi topic selection
- OverTheWire-Bandit
- D2. Chopping Carrots (Hard Version) (每日一题)
猜你喜欢

sqli-labs Basic Challenges Less1-10

The main function of component procurement system, digital procurement helps component enterprises develop rapidly

Development of uni app offline ID card identification plug-in based on paddleocr

实现一个家庭安防与环境监测系统(二)

CDA level Ⅰ 2021 new version simulation question 1 (with answers)

MySQL table operation

Okaleido ecological core equity Oka, all in fusion mining mode

Typora无法打开提示安装新版本解决办法

疫情之下,生物医药行业或将迎来突破性发展

手把手教你申请SSL证书
随机推荐
GameFramework制作游戏(二)制作UI界面
Alibaba cloud installs mysql5.7
AI model risk assessment Part 1: motivation
Oka pass rights and interests analysis is the best choice to participate in okaleido ecological construction
Throwing OutOfMemoryError “Could not allocate JNI Env“
Realize a family security and environmental monitoring system (II)
网络安全应急响应技术实战指南(奇安信)
Pytorch uses tensorboard to realize visual summary
Apple failed to synchronize on its mobile terminal, so it exited the login. As a result, it could not log in again
Interpretation of featdepth self-monitoring model for monocular depth estimation (Part I) -- paper understanding and core source code analysis
CDA level Ⅰ 2021 new version simulation question 1 (with answers)
Matplotlib data visualization three minutes entry, half an hour enchanted?
Mlops column introduction
opencv视频跟踪「建议收藏」
Idea error failed to determine a suitable driver class
[eloquence] negotiation persuasion skills and Strategies
swiper 一侧或两侧露出一小部分
实现一个家庭安防与环境监测系统(二)
thymeleaf通过样式控制display是否显示
Interpretation of featdepth self-monitoring model for monocular depth estimation (Part 2) -- use of openmmlab framework