コード例 #1
0
    protected override void Execute(List <CommandEntity> entities)
    {
        foreach (var e in entities)
        {
            var gameEntity = m_contexts.game.CreateEntity();
            gameEntity.AddPlayerId(e.commandOwner.value);
            var blueprint = m_blueprintService.GetBlueprint("Player");
            Debug.Assert(blueprint != null, "Player blueprint not found");
            blueprint.Apply(gameEntity);
            gameEntity.AddId(m_entityIdService.GetId());

//            var weaponEntity = m_contexts.game.CreateEntity();
//            weaponEntity.AddId(m_entityIdService.GetId());
//            weaponEntity.AddParent(gameEntity.id.value);
//            var localPos = new Vector3(0.1f, 0.7f, 0f);
//            weaponEntity.AddLocalPosition(localPos);
//            weaponEntity.AddLocalTransform(localPos,Quaternion.identity, Matrix4x4.Translate(localPos));
//            weaponEntity.AddLocalPosition()
//            weaponEntity.AddLocalPosition(new UnityEngine.Vector2(0.1f, 0.7f));
//            e.Destroy();
        }
    }
コード例 #2
0
    protected override void Execute(List <CommandEntity> entities)
    {
        foreach (var e in entities)
        {
            var playerEntities = m_contexts.game.GetEntitiesWithPlayerId(e.commandOwner.value);
            if (playerEntities.Count == 0)
            {
                continue;
            }

            var playerEntity = playerEntities.SingleEntity();
            var blueprint    = m_blueprintService.GetBlueprint("Bullet");
            Debug.Assert(blueprint != null, "Bullet blueprint not found");

//            var gunPointId = playerEntity.children.value[0];
//            var gunPointEntity = m_contexts.game.GetEntityWithId(gunPointId);
            var bulletEntity = m_contexts.game.CreateEntity();
            blueprint.Apply(bulletEntity);
            bulletEntity.AddPosition(playerEntity.position.value);
            bulletEntity.AddRotation(playerEntity.rotation.value);
            bulletEntity.AddDirection(playerEntity.direction.value);
//            bulletEntity.AddDirection(playerEntity.direction.value);
        }
    }