从暗黑3D火炬之光技能系统说到-Laya非入门教学一~资源管理

我不知道那些喷Laya没有浏览器,嘲笑别人编辑器做不好,是什么水平?

首先目前国内除了WPS和飞书,就没有第三家公司能把编辑器做好。

要是一般的游戏开发者,如我,有一点点引擎代码(某项目),用VsCode或者甚至很多人用.txt+终端命令就能完成一个游戏开发;但我需要游戏“漂亮”一点,除了代码,我还有一点点“素材”,那我首选Unity 作为图片素材的浏览和管理工具,不是很合理的么?

-------- 后面会补充,Unity Editor的各种入门细节操作(为什么是世一编辑器)

《插播一段Unity 代码,实际这个文章是说图片素材的日常管理》

火炬之光操控人物逻辑

操作后发现鼠标左键,是射击;右键,是范围爆炸

全局搜索:mousebutton,找到以下代码

//mainUIControl.cs
//void Update()方法的代码
	//fire
	bool continousFire=player.ContinousFire() & (Input.GetMouseButton(0) || Input.GetButton("Fire1"));
	if(Input.GetMouseButtonDown(0) || Input.GetButtonDown("Fire1") || continousFire) player.FireWeapon();
					
	//alt fire, could fire weapon alt-mode to launch selected ability
	if(Input.GetMouseButtonDown(1) || Input.GetButtonDown("Fire2")) player.FireAbility();
					
	//launch ability
	if(Input.GetMouseButtonDown(2) || Input.GetButtonDown("Fire3")) player.FireAbilityAlt();

攻击(直线):FireAbilityA

我们只需要范围攻击,所以直接看:.FireAbilityA

		public static void LaunchAbility(Ability ability, bool useCostNCD=true){
			bool teleport=ability.type==_AbilityType.Movement & ability.moveType==_MoveType.Teleport;
			if(ability.type==_AbilityType.AOE || ability.type==_AbilityType.Shoot || teleport){
				//get the hit point and activate the ability on that particular spot
				Ray ray = CameraControl.GetMainCamera().ScreenPointToRay(Input.mousePosition);
				RaycastHit hit;
				if(Physics.Raycast(ray, out hit, Mathf.Infinity)) ability.Activate(hit.point);
				else ability.Activate(GameControl.GetPlayer().thisT.position); //use player position if there's no valid position
			}
			else{
				//activate the ability on the player position
				ability.Activate(GameControl.GetPlayer().thisT.position);
			}
		}

逻辑也很简单:就是在一个位置做一些范围的物理处理:

ability.Active(position)

当然实际上,是有一个 if else 的判断(在自身范围附近爆,还是抛出一个火箭筒在敌人阵地附近爆)

攻击(爆炸型):Activate

//Ability.cs

		//launch the ability, at the position given
		public void Activate(Vector3 pos=default(Vector3), bool useCostNCD=true){
               //技能cd
			if(useCostNCD){
			}
			//范围音效
			AudioManager.PlaySound(launchSFX);
			
            //爆炸的实体对象(光圈)
			//instantiate the launch object, if there's any
			if(launchObj!=null){
				GameObject obj=(GameObject)MonoBehaviour.Instantiate(launchObj, pos, Quaternion.identity);
				if(autoDestroyLaunchObj) MonoBehaviour.Destroy(obj, launchObjActiveDuration);
			}
			
            //物理攻击
			//for aoe ability
			if(type==_AbilityType.AOE || type==_AbilityType.AOESelf){
	
				//		unitInstance.ApplyAttack(aInstance);
				
			
				//apply explosion force
//				TDSPhysics.ApplyExplosionForce(pos, aStats);
			}
			//for ability that affects all hostile unit in game
			else if(type==_AbilityType.All){
				//get all hostile unit for unit tracker
				//List<Unit> unitList=new List<Unit>( UnitTracker.GetAllUnitList() );
				//	unitList[i].ApplyAttack(aInstance);
				
			}
			//for ability that meant to be cast on player unit(跟踪??东风导弹)
			else if(type==_AbilityType.Self){
				//apply the attack on player 
				AttackInstance aInstance=new AttackInstance(GameControl.GetPlayer(), GetRuntimeAttackStats());
				GameControl.GetPlayer().ApplyAttack(aInstance);
			}
			//for ability that fires a shoot object(射击)
			else if(type==_AbilityType.Shoot){
			//
			}
			
			else if(type==_AbilityType.Movement){//(强制移动,闪现)
                //
				
			}
		}

技能朝向+旋转问题

(Unity-粒子是不能旋转的)

能医不自医,还是碰到了需要粒子旋转的问题,这个我曾经教了很多人解决

接受伤害

(待补充)

关于Laya资源管理

复习了一下Unity之后,我们很快就进入Laya的环节

在火炬之光3D项目内(或者你选一个空项目亦可),就是创建一个"AnotherCat"目录

把你认为可能是素材的目录,拖到Unity Project面板目录“AnotherCat”内

然后就可以愉快地选择Texture【分类】(搜索输入框右边的下拉按钮),

        -- 当然,也可以如图,只搜索刚才创建的“AnotherCat”目录内的所有Textures

Unity Editor的基础操作

预览大小调整

双击打开图片(外部:windows 图片工具)

多目录浏览

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

avi9111

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值