0
点赞
收藏
分享

微信扫一扫

SSM客户管理系统CRM开发mysql数据库web结构java编程计算机网页源码eclipse项目

我不知道那些喷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 条评论