Skip to content

Commit

Permalink
Merge branch 'slua-1.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
yaukeywang committed Mar 20, 2016
2 parents 4e32322 + 3859d9a commit a03d284
Show file tree
Hide file tree
Showing 1,445 changed files with 12,132 additions and 85,315 deletions.
Binary file modified Assets/Game/Prefabs/Characters/enemy1.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/Characters/enemy2.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/Characters/hero.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/Environment/backgroundAnimation.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/Environment/backgrounds.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/FX/part_splash.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/FX/splash.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/Props/bomb.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/Props/bombCrate.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/Props/explosionCircle.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/Props/explosionParticle.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/Props/healthCrate.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/Props/rocket.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/Props/rocketExplosion.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/Props/swan.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/UI/ui_healthDisplay.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/killTrigger.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/mainCamera.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/pickupManager.prefab
Binary file not shown.
Binary file modified Assets/Game/Prefabs/spawner.prefab
Binary file not shown.
Binary file modified Assets/Game/Scenes/Level.unity
Binary file not shown.
2 changes: 0 additions & 2 deletions Assets/Game/Scripts/Base/YwDebug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
using System;
using UnityEngine;
using System.Collections.Generic;
using SLua;

// The extend debug library.
[CustomLuaClass]
public class YwDebug
{
/**
Expand Down
22 changes: 22 additions & 0 deletions Assets/Game/Scripts/Base/YwDontDestroyOnLoad.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* The do not destroy on load script.
*
* @filename YwDontDestroyOnLoad.cs
* @copyright Copyright (c) 2015 Yaukey/yaukeywang/WangYaoqi ([email protected]) all rights reserved.
* @license The MIT License (MIT)
* @author Yaukey
* @date 2016-01-24
*/

using UnityEngine;
using System.Collections;

// The do not destroy on load script.
public class YwDontDestroyOnLoad : MonoBehaviour
{
// Use this for initialization
void Awake()
{
DontDestroyOnLoad(gameObject);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 69 additions & 2 deletions Assets/Game/Scripts/Base/YwGlobal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
// The global object that not be destroyed.
public class YwGlobal : MonoBehaviour
{
// The lite update fps.
public int m_liteUpdateFps = 10;

// The lite upate flag.
private bool m_bLiteUpdate = true;

// The lite update timer.
private WaitForSeconds m_cLiteUpdateTimer = null;

// The instance.
private static YwGlobal m_cInstance = null;

Expand Down Expand Up @@ -44,19 +53,77 @@ void Awake()
}

// Start to init.
void Start()
IEnumerator Start()
{
// Wait the script environment init ok.
while (!YwLuaScriptMng.Instance.Initialized)
{
yield return null;
}

// Init lite update settings.
m_cLiteUpdateTimer = new WaitForSeconds(1.0f / (float)m_liteUpdateFps);
StartCoroutine(LiteUpdateControler());
}

// Update is called once per frame
// Update is called once per frame.
void Update()
{
// Check if init ok.
if (!YwLuaScriptMng.Instance.Initialized)
{
return;
}

// The main update.
YwLuaScriptMng.Instance.Update();

// The lite update.
if (m_bLiteUpdate)
{
m_bLiteUpdate = false;
YwLuaScriptMng.Instance.LiteUpdate();
}
}

// LateUpdate is called every frame.
void LateUpdate()
{
// Check if init ok.
if (!YwLuaScriptMng.Instance.Initialized)
{
return;
}

YwLuaScriptMng.Instance.LateUpdate();
}

// FixedUpdate is called every fixed framerate frame.
void FixedUpdate()
{
// Check if init ok.
if (!YwLuaScriptMng.Instance.Initialized)
{
return;
}

YwLuaScriptMng.Instance.FixedUpdate();
}

// Init the global lua script manager.
private void InitGlobalManager()
{
// The base support.
YwLuaScriptMng.Instance.Initialize();
}

// The coroutine to control lite update.
private IEnumerator LiteUpdateControler()
{
while (true)
{
m_bLiteUpdate = true;
yield return m_cLiteUpdateTimer;
}
}
}
Loading

0 comments on commit a03d284

Please sign in to comment.