实时修改角色阵营,目前还有点小问题
This commit is contained in:
parent
c805f60898
commit
e115d5863c
|
@ -1 +1 @@
|
|||
[{"Name":"Preinstall1","Weight":100,"Remark":"","AutoFill":true,"WaveList":[[{"Position":{"X":0,"Y":0},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]},{"Position":{"X":53,"Y":31},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0003","CurrAmmon":"12","ResidueAmmo":"12"},"Altitude":0,"VerticalSpeed":5.551115E-14}]}]]}]
|
||||
[{"Name":"Preinstall1","Weight":100,"Remark":"","AutoFill":true,"WaveList":[[{"Position":{"X":0,"Y":0},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]},{"Position":{"X":53,"Y":31},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0003","CurrAmmon":"12","ResidueAmmo":"12"},"Altitude":0,"VerticalSpeed":5.551115E-14}]},{"Position":{"X":84,"Y":8},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0002","CurrAmmon":"7","ResidueAmmo":"7"},"Altitude":0,"VerticalSpeed":5.551115E-14}]}]]}]
|
|
@ -122,6 +122,7 @@ public abstract partial class AiRole : Role
|
|||
{
|
||||
if (AttackTarget == null || AttackTarget.IsDestroyed || !IsEnemy(AttackTarget))
|
||||
{
|
||||
AttackTarget = null;
|
||||
foreach (var role in World.Role_InstanceList)
|
||||
{
|
||||
if (role.AffiliationArea == AffiliationArea && IsEnemy(role))
|
||||
|
|
|
@ -83,6 +83,12 @@ public class AiAttackState : StateBase<AiRole, AIStateEnum>
|
|||
|
||||
public override void Process(float delta)
|
||||
{
|
||||
if (Master.LookTarget == null || Master.LookTarget.IsDestroyed || (Master.LookTarget is Role role && !Master.IsEnemy(role))) //更改攻击状态
|
||||
{
|
||||
ChangeState(AIStateEnum.AiNormal);
|
||||
return;
|
||||
}
|
||||
|
||||
//更新标记位置
|
||||
Master.UpdateMarkTargetPosition();
|
||||
|
||||
|
|
|
@ -43,6 +43,12 @@ public class AiSurroundState : StateBase<AiRole, AIStateEnum>
|
|||
|
||||
public override void Process(float delta)
|
||||
{
|
||||
if (Master.LookTarget == null)
|
||||
{
|
||||
ChangeState(AIStateEnum.AiNormal);
|
||||
return;
|
||||
}
|
||||
|
||||
//先检查弹药是否打光
|
||||
if (Master.IsAllWeaponTotalAmmoEmpty())
|
||||
{
|
||||
|
|
|
@ -127,6 +127,12 @@ public partial class Enemy : AiRole
|
|||
|
||||
//看向目标
|
||||
if (LookTarget != null && MountLookTarget)
|
||||
{
|
||||
if (LookTarget.IsDestroyed)
|
||||
{
|
||||
LookTarget = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
var pos = LookTarget.Position;
|
||||
LookPosition = pos;
|
||||
|
@ -143,6 +149,7 @@ public partial class Enemy : AiRole
|
|||
//枪口跟随目标
|
||||
MountPoint.SetLookAt(pos);
|
||||
}
|
||||
}
|
||||
|
||||
if (RoleState.CanPickUpWeapon)
|
||||
{
|
||||
|
|
|
@ -203,6 +203,15 @@ public partial class Player : Role
|
|||
else if (InputManager.UseActiveProp) //使用道具
|
||||
{
|
||||
UseActiveProp();
|
||||
|
||||
foreach (var role in World.Role_InstanceList)
|
||||
{
|
||||
if (IsEnemy(role))
|
||||
{
|
||||
role.Camp = Camp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (InputManager.ExchangeProp) //切换道具
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user