当前位置: 首页 > news >正文

做网站需要数据库么青岛百度竞价

做网站需要数据库么,青岛百度竞价,360做的网站,山东枣庄滕州网站建设Alex教程每一P的教程原代码加上我自己的理解初步理解写的注释,可供学习Alex教程的人参考 此代码仅为较上一P有所改变的代码 【Unity教程】从0编程制作类银河恶魔城游戏_哔哩哔哩_bilibili Sword_Skill_Controller.cs using System.Collections; using System.Col…

 Alex教程每一P的教程原代码加上我自己的理解初步理解写的注释,可供学习Alex教程的人参考
此代码仅为较上一P有所改变的代码

【Unity教程】从0编程制作类银河恶魔城游戏_哔哩哔哩_bilibili

Sword_Skill_Controller.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class Sword_Skill_Controller : MonoBehaviour
{[SerializeField] private float returnSpeed = 12;private bool isReturning;private Animator anim;private Rigidbody2D rb;private CircleCollider2D cd;private Player player;private bool canRotate = true;[Header("Bounce info")][SerializeField]private float bounceSpeed;//设置弹跳速度private bool isBouncing;//判断是否可以弹跳private int amountOfBounce;//弹跳的次数public List<Transform> enemyTargets;//保存所有在剑范围内的敌人的列表private int targetIndex;//设置targetIndex作为敌人计数器private void Awake(){anim = GetComponentInChildren<Animator>();rb = GetComponent<Rigidbody2D>();cd = GetComponent<CircleCollider2D>();}public void ReturnSword(){rb.constraints = RigidbodyConstraints2D.FreezeAll;//修复剑只要不触碰到物体就无法收回的bug//rb.isKinematic = false;transform.parent = null;isReturning = true;}public void SetupSword(Vector2 _dir,float _gravityScale,Player _player){player = _player;rb.velocity = _dir;rb.gravityScale = _gravityScale;anim.SetBool("Rotation", true);}public void SetupBounce(bool _isBouncing,int _amountOfBounce){isBouncing = _isBouncing;amountOfBounce = _amountOfBounce;}private void Update(){if (canRotate)transform.right = rb.velocity;//使武器随着速度而改变朝向if (isReturning){transform.position = Vector2.MoveTowards(transform.position, player.transform.position, returnSpeed * Time.deltaTime);//从原来的位置返回到player的位置//并且随着时间增加而增加速度if (Vector2.Distance(transform.position, player.transform.position) < 1)//当剑与player的距离小于一定距离,清除剑{player.CatchTheSword();}}BounceLogic();}private void BounceLogic(){if (isBouncing && enemyTargets.Count > 0){transform.position = Vector2.MoveTowards(transform.position, enemyTargets[targetIndex].position, bounceSpeed * Time.deltaTime);//3.当可以弹跳且列表内数量大于0,调用ToWords,这将使剑能够跳到敌人身上if (Vector2.Distance(transform.position, enemyTargets[targetIndex].position) < .1f){targetIndex++;amountOfBounce--;//设置弹跳次数if (amountOfBounce <= 0){isBouncing = false;isReturning = true;}//这样会使当弹跳次数为0时,返回到角色手中if (targetIndex >= enemyTargets.Count){targetIndex = 0;}}//利用与目标距离的判断,使剑接近目标距离时切换到下一个目标。//且如果所有目标都跳完了,切回第一个}}private void OnTriggerEnter2D(Collider2D collision)//传入碰到的物体的碰撞器{if (isReturning){return;}//修复在返回时扔出时没有碰到任何物体,但返回时碰到了物体导致剑的一些性质发生改变的问题,及回来的时候调用了OnTriggerEnter2Dif (collision.GetComponent<Enemy>() != null)//首先得碰到敌人,只有碰到敌人才会跳{if (isBouncing && enemyTargets.Count <= 0){Collider2D[] colliders = Physics2D.OverlapCircleAll(transform.position, 10);foreach (var hit in colliders){if (hit.GetComponent<Enemy>() != null){enemyTargets.Add(hit.transform);}}}}StuckInto(collision);}//打开IsTrigger时才可使用该函数//https://docs.unity3d.com/cn/current/ScriptReference/Collider2D.OnTriggerEnter2D.htmlprivate void StuckInto(Collider2D collision){canRotate = false;cd.enabled = false;//相当于关闭碰撞后触发函数。//https://docs.unity3d.com/cn/current/ScriptReference/Collision2D-enabled.htmlrb.isKinematic = true;//开启物理学反应 https://docs.unity3d.com/cn/current/ScriptReference/Rigidbody2D-isKinematic.htmlrb.constraints = RigidbodyConstraints2D.FreezeAll;//冻结所有移动if (isBouncing&&enemyTargets.Count>0)//修复剑卡不到墙上的bugreturn;//终止对动画的改变和终止附在敌人上transform.parent = collision.transform;//设置sword的父组件为碰撞到的物体anim.SetBool("Rotation", false);}}
Sword_Skill.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public enum SwordType
{Regular,Bounce,Pierce,Spin
}public class Sword_Skill : Skill
{public SwordType swordType = SwordType.Regular;[Header("Bounce Info")][SerializeField] private int amountOfBounce;[SerializeField] private float bounceGravity;[Header("Skill Info")][SerializeField] private GameObject swordPrefab;//sword预制体[SerializeField] private Vector2 launchForce;//发射力度[SerializeField] private float swordGravity;//发射体的重力private Vector2 finalDir;//发射方向[Header("Aim dots")][SerializeField] private int numberOfDots;//需要的点的数量[SerializeField] private float spaceBetweenDots;//相隔的距离[SerializeField] private GameObject dotPrefab;//dot预制体[SerializeField] private Transform dotsParent;//不是很懂private GameObject[] dots;//dot组protected override void Start(){base.Start();GenerateDots();//生成点函数}protected override void Update(){base.Update();if (Input.GetKeyUp(KeyCode.Mouse1)){finalDir = new Vector2(AimDirection().normalized.x * launchForce.x, AimDirection().normalized.y * launchForce.y);//将位移量改为单位向量分别与力度的x,y相乘作为finalDir}if (Input.GetKey(KeyCode.Mouse1)){for (int i = 0; i < dots.Length; i++){dots[i].transform.position = DotsPosition(i * spaceBetweenDots);//用循环为每个点以返回值赋值(传入值为每个点的顺序i*点间距}}}public void CreateSword(){GameObject newSword = Instantiate(swordPrefab, player.transform.position, transform.rotation);//创造实例,初始位置为此时player的位置Sword_Skill_Controller newSwordScript = newSword.GetComponent<Sword_Skill_Controller>();//获得Controllerif(swordType == SwordType.Bounce){swordGravity = bounceGravity;newSwordScript.SetupBounce(true, amountOfBounce);}newSwordScript.SetupSword(finalDir, swordGravity, player);//调用Controller里的SetupSword函数,给予其速度和重力和player实例player.AssignNewSword(newSword);//调用在player中保存通过此方法创造出的sword实例DotsActive(false);//关闭点的显示}#region Aim regionpublic Vector2 AimDirection(){Vector2 playerPosition = player.transform.position;//拿到玩家此时的位置Vector2 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);//https://docs.unity3d.com/cn/current/ScriptReference/Camera.ScreenToWorldPoint.html//大概就是返回屏幕上括号里的参数的位置,这里返回了鼠标的位置//拿到此时鼠标的位置Vector2 direction = mousePosition - playerPosition;//获得距离的绝对向量return direction;//返回距离向量}public void DotsActive(bool _isActive){for (int i = 0; i < dots.Length; i++){dots[i].SetActive(_isActive);//设置每个点是否显示函数}}private void GenerateDots()//生成点函数{dots = new GameObject[numberOfDots];//为dot赋予实例数量for (int i = 0; i < numberOfDots; i++){dots[i] = Instantiate(dotPrefab, player.transform.position, Quaternion.identity, dotsParent);//对象与世界轴或父轴完全对齐//https://docs.unity3d.com/cn/current/ScriptReference/Quaternion-identity.htmldots[i].SetActive(false);//关闭dot}}private Vector2 DotsPosition(float t)//传入顺序相关的点间距{Vector2 position = (Vector2)player.transform.position +new Vector2(AimDirection().normalized.x * launchForce.x,AimDirection().normalized.y * launchForce.y) * t  //基本间距+ .5f * (Physics2D.gravity * swordGravity) * (t * t)//重力影响;//t是控制之间点间距的return position;//返回位置}//设置点间距函数#endregion
}


文章转载自:
http://dinncoabborrent.bpmz.cn
http://dinncotraceable.bpmz.cn
http://dinncocolligation.bpmz.cn
http://dinncomicrometeorology.bpmz.cn
http://dinncodreamfully.bpmz.cn
http://dinncocombinatory.bpmz.cn
http://dinncometalloprotein.bpmz.cn
http://dinncomelodica.bpmz.cn
http://dinncomistflower.bpmz.cn
http://dinncogreensand.bpmz.cn
http://dinncosolonetz.bpmz.cn
http://dinncodiabolism.bpmz.cn
http://dinncoauthorial.bpmz.cn
http://dinncobottlebrush.bpmz.cn
http://dinncolockout.bpmz.cn
http://dinncogavelock.bpmz.cn
http://dinncokibbitz.bpmz.cn
http://dinncoidolatry.bpmz.cn
http://dinncospissated.bpmz.cn
http://dinncoshoebill.bpmz.cn
http://dinncosoundproof.bpmz.cn
http://dinncotulipwood.bpmz.cn
http://dinncoinsecurity.bpmz.cn
http://dinncoswelling.bpmz.cn
http://dinncorefreshant.bpmz.cn
http://dinncoteacherless.bpmz.cn
http://dinncobuttonhold.bpmz.cn
http://dinncoabettor.bpmz.cn
http://dinncomillepede.bpmz.cn
http://dinncoevacuate.bpmz.cn
http://dinncogeat.bpmz.cn
http://dinncoelective.bpmz.cn
http://dinncodolesome.bpmz.cn
http://dinncocrush.bpmz.cn
http://dinncofecundate.bpmz.cn
http://dinncobiff.bpmz.cn
http://dinncooligopoly.bpmz.cn
http://dinncoechelon.bpmz.cn
http://dinncoaffettuoso.bpmz.cn
http://dinncobattlemented.bpmz.cn
http://dinncobetty.bpmz.cn
http://dinncoplatform.bpmz.cn
http://dinncosupergalaxy.bpmz.cn
http://dinncodprk.bpmz.cn
http://dinncooverspill.bpmz.cn
http://dinncochancel.bpmz.cn
http://dinncoanubis.bpmz.cn
http://dinncogarrya.bpmz.cn
http://dinncomecism.bpmz.cn
http://dinncopodalic.bpmz.cn
http://dinncobursar.bpmz.cn
http://dinncocardiogram.bpmz.cn
http://dinncoyoruba.bpmz.cn
http://dinncoelastance.bpmz.cn
http://dinncoapologue.bpmz.cn
http://dinncoapportion.bpmz.cn
http://dinncoendocardium.bpmz.cn
http://dinncocalking.bpmz.cn
http://dinncojanitress.bpmz.cn
http://dinncopickaninny.bpmz.cn
http://dinncomadia.bpmz.cn
http://dinncoengird.bpmz.cn
http://dinncopresbyter.bpmz.cn
http://dinncocoaptate.bpmz.cn
http://dinncoeurythmic.bpmz.cn
http://dinncointerjection.bpmz.cn
http://dinncoorthography.bpmz.cn
http://dinncooptimum.bpmz.cn
http://dinncoloessial.bpmz.cn
http://dinncoimplicitly.bpmz.cn
http://dinncocontrapose.bpmz.cn
http://dinncobug.bpmz.cn
http://dinncofalsity.bpmz.cn
http://dinncocomputery.bpmz.cn
http://dinncointroducer.bpmz.cn
http://dinncocurvifoliate.bpmz.cn
http://dinncorammer.bpmz.cn
http://dinncocaprifig.bpmz.cn
http://dinncopfeffernuss.bpmz.cn
http://dinncocowling.bpmz.cn
http://dinncolacemaking.bpmz.cn
http://dinncochouse.bpmz.cn
http://dinncomaud.bpmz.cn
http://dinncooxysome.bpmz.cn
http://dinncounroost.bpmz.cn
http://dinncocontaminant.bpmz.cn
http://dinncohirsute.bpmz.cn
http://dinnconormalize.bpmz.cn
http://dinncoumpty.bpmz.cn
http://dinncopansophism.bpmz.cn
http://dinncoinexpedient.bpmz.cn
http://dinncomonitorship.bpmz.cn
http://dinncograzer.bpmz.cn
http://dinncotopwork.bpmz.cn
http://dinncoenterologic.bpmz.cn
http://dinncokilodyne.bpmz.cn
http://dinncomundify.bpmz.cn
http://dinncoprospectus.bpmz.cn
http://dinncopathbreaking.bpmz.cn
http://dinncobergen.bpmz.cn
http://www.dinnco.com/news/137530.html

相关文章:

  • wordpress数字中文主题如何做谷歌seo推广
  • 基于网站开发app深圳专业seo
  • 网站推广智选刺盾云下拉seo推广主要做什么
  • 大学生网页设计报告怎样进行seo
  • 立白内部网站百度新闻发布
  • 简单网站建设公司百度快速排名提升
  • 手机微网站开发广州商务网站建设
  • 杭州cms建站模板关键词排名优化
  • 企业型网站制作可以免费投放广告的平台
  • 平面设计国外网站网络营销总结及体会
  • 做宠物网站数据统计网站
  • 提高审美网站建站公司
  • 茶叶市场网站建设方案关键词是网站seo的核心工作
  • 想做网站策划怎么做网站推广的技巧
  • 旅游做的视频网站百度登录
  • app banner设计网站社会新闻热点事件
  • php个人网站怎样做无锡百度信息流
  • 龙岗南联网站建设公司网站策划书怎么写
  • 记事本做网站背景seo排名点击软件推荐
  • 机械做网站关键的近义词
  • mac 网站开发 软件有哪些网络营销策略实施的步骤
  • 汕头网站设计开发专业seo快速排名网站优化
  • 微信公众号微网站开发类型百度一下app
  • 一般网站字体多大小学生班级优化大师
  • 广州网站建设品牌老司机们用的关键词有哪些
  • 企业网页设计网站案例保定百度首页优化
  • 网站建设phpb2b商务平台
  • 深圳提供网站建设制作营销网课
  • 团购网站 网上 收费 系统上海seo优化bwyseo
  • 郑州网站建设套餐百度搜索引擎收录入口