Giter Site home page Giter Site logo

bomb_2d_learnu3d's Introduction

Bomb_2D_LearnU3D

项目素材及部份工程文件出自Unity中文课堂 (u3d.cn)

Unity Edition:2019.4.3(LTS)

Play it Online:BombGuy - Unity Play


Package

  1. WebGL Publisher

  2. Advertisement

  3. Joystick Pack

    手机端触屏控制插件

  4. 2D Tilemap Extras

    使用 Rule Tile 按自定规则绘制地图


materials

Pixel Frog - itch.io


项目组成

  1. 五种敌人,行为逻辑相同,技能不同
  2. 五个关卡(最后一关BOSS关)
  3. 玩家角色(移动、跳跃、受击、死亡、跳跃FX、落地FX、跑动FX)
  4. 场景中包含可互动的多种环境物体
  5. 通往下一关卡的门
  6. UI Manager、Game Manager

UI部分

  1. 暂停按钮、暂停菜单
  2. 游戏结束菜单
  3. 开始菜单
  4. 玩家角色Health Bar
  5. BOSS Health Bar
  6. 安卓端触摸按键

UML

image


程序设计

FSM有限状态机,在子类中定义具体逻辑

public abstract class EnemyBasState  //有限状态机
{
    public abstract void EnterState(Enemy enemy);
    public abstract void OnUpdate(Enemy enemy);

}

**Enemy of Animator **

Parameters:

  1. state : int
  2. attack : trigger
  3. hit : trigger
  4. skill : trigger
  5. dead : bool

Layer:

  1. Base Layer
  2. Attack Layer
  3. Dead Layer

使用state切换layer

  1. state=1时敌人正在Move to Targetstate=0时正在等待idle动画结束,从而实现敌人到巡逻点后停滞一个idle动画的长度
  2. state=2时转换到Attack Layer,此Layer权重为1,完全覆盖其他Layer动画

单例模式

public class GameManager : MonoBehaviour
{
    public static GameManager instance;        //单例模式
    public void Awake()
    { 
        if (instance == null)
            instance = this;
        else
            Destroy(gameObject);
    }
    ...
}
//调用单例模式
GameManager.instance.XX;

PlayerPrefs类

记录数据


bomb_2d_learnu3d's People

Contributors

gai-zi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.