第一人称射击类系统设计项目书.docx

上传人:b****6 文档编号:13683960 上传时间:2023-06-16 格式:DOCX 页数:17 大小:1.31MB
下载 相关 举报
第一人称射击类系统设计项目书.docx_第1页
第1页 / 共17页
第一人称射击类系统设计项目书.docx_第2页
第2页 / 共17页
第一人称射击类系统设计项目书.docx_第3页
第3页 / 共17页
第一人称射击类系统设计项目书.docx_第4页
第4页 / 共17页
第一人称射击类系统设计项目书.docx_第5页
第5页 / 共17页
第一人称射击类系统设计项目书.docx_第6页
第6页 / 共17页
第一人称射击类系统设计项目书.docx_第7页
第7页 / 共17页
第一人称射击类系统设计项目书.docx_第8页
第8页 / 共17页
第一人称射击类系统设计项目书.docx_第9页
第9页 / 共17页
第一人称射击类系统设计项目书.docx_第10页
第10页 / 共17页
第一人称射击类系统设计项目书.docx_第11页
第11页 / 共17页
第一人称射击类系统设计项目书.docx_第12页
第12页 / 共17页
第一人称射击类系统设计项目书.docx_第13页
第13页 / 共17页
第一人称射击类系统设计项目书.docx_第14页
第14页 / 共17页
第一人称射击类系统设计项目书.docx_第15页
第15页 / 共17页
第一人称射击类系统设计项目书.docx_第16页
第16页 / 共17页
第一人称射击类系统设计项目书.docx_第17页
第17页 / 共17页
亲,该文档总共17页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

第一人称射击类系统设计项目书.docx

《第一人称射击类系统设计项目书.docx》由会员分享,可在线阅读,更多相关《第一人称射击类系统设计项目书.docx(17页珍藏版)》请在冰点文库上搜索。

第一人称射击类系统设计项目书.docx

第一人称射击类系统设计项目书

项目说明

设计题目

古堡行动

系统平台:

Android4.0.3以上(Windows7)

开发工具:

Unity、MonoDevelop(VisualStudio2013)

开发语言:

C#

插件:

1.游戏的登录注册,开始界面,以及游戏界面的UI设计

2.游戏地图,主角,敌人等的设计

3.界面简洁,大气,操作流程清晰,无过多错误

4.代码逻辑或思路清晰,有大部分全面的注释

课程设计报告2755字

源程序大概4500行

2018.04.15-04.28根据课程设计的要求,进行需求分析,查找相关资料;

2018.04.29-05.10进行项目概要设计和整理素材;

2018.05.11-06.18详细设计和具体项目实现;

2018.06.19-06.22对游戏进行调试分析,撰写课程设计报告。

[1]金玺曾.Unity3D手机游戏开发.北京:

清华大学出版社,2013

[2]

[3]

[4]

目  录

2.2存储结构设计1

2.3功能模块设计2

3.2游戏界面布局4

3.3功能模块设计实现5

1需求分析

1.1技术需求

此游戏是在Unity2018上开发出来的,Unity2018可以支持2D、3D场景的编辑,本游戏是基于3D场景开发的。

游戏中的脚本语言使用的是C#,Unity2018中的microsoftvisual2017为脚本编辑提供了平台。

1.2功能需求

1.2.1古堡行动游戏玩法介绍:

玩家通过注册登录帐号进入游戏,游戏中设有三个敌人出生点,并且会自动寻路并攻击玩家,玩家通过持枪射击对抗敌人,每击杀一个敌人玩家为加一分,玩家有血条,地图会随机生成血包,供玩家增加血量,当玩家血量值为0时,游戏失败;当玩家击杀敌人个数达到200个后,游戏即为胜

1.2.2古堡行动游戏制作功能的需求:

登录注册、玩家和敌人AI、游戏特效(子弹设计特效,敌人死亡特效)、敌人生成、敌人自动寻路、碰撞检测、UI界面设计.

2概要设计

2.1设计思路

我们选择第一人称射击游戏的设计来源来自经典的cf游戏,但由于能力和时间原因,我们做出来的很简单。

设计思路是要保证游戏拥有最基本的第一人称射击游戏的功能。

2.2存储结构设计

游戏中出现的所有类:

例如:

Player类:

玩家类

Enemy类:

敌人类

AppearEnemy类:

敌人出生点

AddBlood类:

血包

Bullet类:

子弹

ShootAudio类:

射击音效

GameManager类:

游戏状态设计

Xml文档

  

  

2.3功能模块设计

游戏具有六大功能模块,分别为:

游戏开始模块

(1)战斗模块

(2)生存模块

(3)场景切换模块:

包括场景触发器的设计;

(4)分数统计模块:

包括对玩家分数的显示;

(5)游戏结束模块:

包括游戏结束菜单的设计;

其功能模块图如图2-1所示:

古堡行动游戏

战斗

模块

生存模块

场景切换模块

分数统计模块

游戏结束模块

游戏开始模块

 

图2-1功能模块图

 

3详细设计

3.1游戏工程视图

“Audios”文件夹如图3-1所示:

图3-1“Audios”文件夹

“Textures”文件夹如图3-2所示:

图3-2“Textures”文件夹

然后我们需要新建“Materials”:

材质文件夹;“Prefabs”:

预制文件夹;“Scenes”:

游戏场景文件夹;“Scripts”:

脚本文件夹。

总体工程视图如图3-3所示:

图3-3总体工程视图

3.2游戏界面布局

3.2.1.开始界面

图3-4开始界面

 

3.2.2.结束界面

图3-5结束界面

3.3功能模块设计实现

3.3.1游戏开始设计

void Start()

    {

        _zc.gameObject.SetActive(false);

        _xmlPatch = Application.dataPath + "/user.xml";

        if (!

File.Exists(_xmlPatch))

        {

            XmlDocument xmlDoc = new XmlDocument();

            XmlElement root = xmlDoc.CreateElement("Root");

            xmlDoc.AppendChild(root);

            XmlElement user = xmlDoc.CreateElement("User");

            user.SetAttribute("user_name", "Admin");

            user.SetAttribute("user_password", "123");

            user.SetAttribute("qq", "123456");

            root.AppendChild(user);

            xmlDoc.Save(_xmlPatch);

            Debug.Log("xml creat success!

");

        }

    }

    // Update is called once per frame

    public void jingruyouxi()

    {

        if (zhanghaoinput.text == "" || mimainput.text == "")

        {

            tishixx.text = "密码或用户名为空,请重新输入!

";

            zhanghaoinput.text = "";

            mimainput.text = "";

            return;

        }

        Debug.Log(zhanghaoinput.text);

        Debug.Log(mimainput.text);

        XmlDocument xmlDoc = new XmlDocument();

        xmlDoc.Load(_xmlPatch);

        XmlNodeList nodelist = xmlDoc.SelectSingleNode("Root").ChildNodes;

        foreach (XmlElement xe in nodelist)

        {

            Debug.Log(xe.GetAttribute("user_name"));

            if (xe.GetAttribute("user_name") == zhanghaoinput.text)

            {

                if (xe.GetAttribute("user_password") == mimainput.text)

                {

                    tishixx.text = "登录成功!

";

                    SceneManager.LoadScene(4);

                }

                else

                {

                    tishixx.text = "密码输入有误!

";

                }

            }

            else

                tishixx.text = "用户未注册,请注册!

";

        }

    }

    public void zc()

    {

        if (zcyonghuinput.text == "" || zcmimainput1.text == "" || zcmimainput2.text == "")

        {

            tsxx.text = "信息不完整!

";

            return;

        }

        if (zcmimainput1.text !

= zcmimainput2.text)

        {

            tsxx.text = "两次密码输入不一致!

";

            return;

        }

        XmlDocument xmlDoc = new XmlDocument();

        xmlDoc.Load(_xmlPatch);

        XmlNodeList nodelist = xmlDoc.SelectSingleNode("Root").ChildNodes;

        foreach (XmlElement xe in nodelist)

        {

            if (xe.GetAttribute("user_name") == zcyonghuinput.text)

            {

                tsxx.text = "用户名已经被占用!

";

                return;

            }

        }

        //取得根节点

        XmlNode root = xmlDoc.SelectSingleNode("Root");

        //创建User新节点

        XmlElement user = xmlDoc.CreateElement("User");

        //XmlElement user1 = xmlDoc.CreateElement("User_lov");

        //XmlText lov = xmlDoc.CreateTextNode ("158");

        //user1.AppendChild (lov);

        //设置属性

        user.SetAttribute("user_name", zcyonghuinput.text);

        user.SetAttribute("user_password", zcmimainput1.text);

        //将新节点加入根节点

        root.AppendChild(user);

        //root.AppendChild(user1);

        //保存文件

        xmlDoc.Save(_xmlPatch);

        tsxx.text = ("恭喜!

注册成功!

");

        zcyonghuinput.text = "";

        zcmimainput1.text = "";

        zcmimainput2.text = "";

        close_zc();

3.3.2战斗模块设计

void Update () {

        //生成一道射线

        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        //射线碰撞

        RaycastHit hit;

        //点击鼠标左键

        if (Input.GetMouseButtonDown(0) && bullets > 0)

            {

            //剩余子弹个数

            bullets--;

            //通过射线获得目标点

            //Returns a ray going from camera through a screen point.

            //Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            //Returns a point at distance units along the ray.

            Vector3 target = ray.GetPoint(20);

            //修改发射起点的朝向

            //firePoint.transform.LookAt(target);

            //实例化子弹

            Rigidbody clone = (Rigidbody)Instantiate(bullet, firePoint.transform.position, firePoint.transform.rotation);

            //初始化子弹的方向速度

            clone.velocity = (target - firePoint.transform.position) * 3;

            //播放子弹音频

            Gun.SendMessage("shootAudio");

            //如果射线碰到物体的话 1 << 9 打开第九层

            if (Physics.Raycast(ray, out hit, 100, 1 << 9))

            {

                //击中控制台反馈

                Debug.Log(hit.normal);

                //销毁碰撞器

                Destroy(hit.collider);

                //加分

                score++;

                //Destroy(hit.transform.gameObject);

                hit.transform.gameObject.GetComponent().dead();

            }

        }

        //修改发射起点的朝向

        firePoint.transform.LookAt(Camera.main.ScreenPointToRay(Input.mousePosition).GetPoint(20));

        //胜利检测

        if(score >= 50)

        {

            Debug.Log("Game victory!

");

            Application.LoadLevel("Game victory");

        }

        //死亡检测

        if(blood <= 0 || bullets <= 0)

        {

            Debug.Log("Game failure!

");

            Application.LoadLevel("Game failure");

        }

    }

3.3.3生存模块设计

//加血

    public void addBlood()

    {

        if(blood > 50)

        {

            blood = 100;

        }

        else

        {

            blood += 50;

        }

    }

 //掉血

    public void reduceBlood(int attackType)

    {

        switch (attackType)

        {

            case 6:

                blood -= 6;

                break;

            case 8:

                blood -= 8;

                break;

            case 10:

                blood -= 10;

                break;

            default:

                Debug.Log("blood error");

                break;

        }

    }

3.3.4场景切换模块设计

public class StartGAME :

 MonoBehaviour {

    // Use this for initialization

    void Start () {

        

    }

    // Update is called once per frame

    public void sg () {

        SceneManager.LoadScene(0);

    }

    public void Fh()

    {

        SceneManager.LoadScene("START");

    }

}

3.3.5分数统计模块设计

if (Physics.Raycast(ray, out hit, 100, 1 << 9))

            {

                //击中控制台反馈

                Debug.Log(hit.normal);

                //销毁碰撞器

                Destroy(hit.collider);

                //加分

                score++;

                //Destroy(hit.transform.gameObject);

GUI.Label(new Rect(10, Screen.height - 30, 150, 50), "子弹个数 x" + bullets + "   分数"+ score);

3.4其他设计实现

3.4.1摄像机的跟随

privatevoidUpdateCameraPosition(floatspeed)

    {

      Vector3newCameraPosition;//存储跟新位置

      if(!

m_UseHeadBob)//不使用头部摇摆的情况下(默认=true)

      {

        return;

      }

      if(m_CharacterController.velocity.magnitude>0&&m_CharacterController.isGrounded)//速度向量长度大于0,在地面上

      {

        m_Camera.transform.localPosition=

          m_HeadBob.DoHeadBob(m_CharacterController.velocity.magnitude+

                   (speed*(m_IsWalking?

1f:

m_RunstepLenghten)));

        newCameraPosition=m_Camera.transform.localPosition;

        newCameraPosition.y=m_Camera.transform.localPosition.y-m_JumpBob.Offset();

      }

      else

      {

        newCameraPosition=m_Camera.transform.localPosition;

        newCameraPosition.y=m_OriginalCameraPosition.y-m_JumpBob.Offset();

      }

      m_Camera.transform.localPosition=newCameraPosition;

    }

3.4.2游戏音效的添加

public class ShootAudio :

 MonoBehaviour {

    // Use this for initialization

    void Start () {

    }

    // Update is called once per frame

    void Update () {

    }

    public void shootAudio()

    {

        AudioSource audio = GetComponent();

        audio.Play();

    }

}

3.4.3游戏UI的设计

public class RoleBulletController :

 MonoBehaviour {

    //初始子弹个数 

    private int bullets = 150;

    //游戏分数

    static public int score = 0;

    //受重力影响的子弹

 

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 表格模板 > 表格类模板

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2