Exemple #1
0
        public override void Paint(GridLayout grid, GameObject brushTarget, Vector3Int position)
        {
            // Do not allow editing palettes
            if (brushTarget.layer == 31)
            {
                return;
            }

            if (gameConfig == null)
            {
                return;
            }

            var        entityConfig = gameConfig.entityConfigs[selectedIndex];
            GameObject instance     = (GameObject)PrefabUtility.InstantiatePrefab(entityConfig.prefab);

            if (instance != null)
            {
                Undo.MoveGameObjectToScene(instance, brushTarget.scene, "Paint Entity");
                Undo.RegisterCreatedObjectUndo((Object)instance, "Paint Entity");
                instance.transform.SetParent(brushTarget.transform);
                instance.transform.position = grid.LocalToWorld(grid.CellToLocalInterpolated(new Vector3Int(position.x, position.y, 0) + new Vector3(.5f, .5f, 0f)));
                var displacement = DirectionUtils.DirectionToDisplacement(direction);
                instance.transform.localRotation = Quaternion.LookRotation(Vector3.forward, new Vector3(displacement.x, displacement.y, 0f));
            }
        }
        public override void Update(UpdateState state)
        {
            base.Update(state);
            UpdateCarousel(state);


            for (int i = 0; i < 18; i++)
            {
                var relPos = BodyPosition + i - 9;
                relPos = (float)DirectionUtils.PosMod(relPos, 18);
                if (relPos > 9)
                {
                    relPos += 6;
                }
                var angle = (relPos / 24) * (Math.PI * 2);

                var pos = new Vector3(0 + 4.5f * (float)Math.Cos(angle), 0, 0 + 4.5f * (float)Math.Sin(angle));
                BodyAvatars[i].Avatar.RotationY = -(float)angle + (float)Math.PI / 2;
                var ang2 = (float)Math.Abs(DirectionUtils.PosMod(angle + Math.PI, Math.PI * 2) - Math.PI);
                //if (ang2 > Math.PI * 2) ang2 = 255;
                var ava = BodyAvatars[i].Avatar;
                ava.AmbientLight = Vector4.One * Math.Max(0, Math.Min(1, 2 - ang2));
                if (i != DirectionUtils.PosMod(-Math.Round(BodyPosition + 9), 18))
                {
                    ava.AmbientLight *= 0.5f;
                }
                else
                {
                    ava.AmbientLight *= 1.1f;
                }
                ava.Position = pos;
                ava.Scale    = Vector3.One * (Pet ? 1 : 1 / 2f);
            }
        }
Exemple #3
0
 public bool IsEdgePosition(Vector2Int boardSize)
 {
     return((Coordinate.x == 0 && DirectionUtils.IntToDirection(PositionOnTile) == Direction.LEFT) ||
            (Coordinate.x == boardSize.x - 1 && DirectionUtils.IntToDirection(PositionOnTile) == Direction.RIGHT) ||
            (Coordinate.y == 0 && DirectionUtils.IntToDirection(PositionOnTile) == Direction.DOWN) ||
            (Coordinate.y == boardSize.x - 1 && DirectionUtils.IntToDirection(PositionOnTile) == Direction.UP));
 }
Exemple #4
0
 internal void Reverse()
 {
     currentdirection         = DirectionUtils.Reverse(currentdirection);
     currentrailblockprogress = 1 - currentrailblockprogress;
     lastdirection            = currentdirection;
     //currentvehiclespeed = 0;
 }
Exemple #5
0
        private void ExportMap()
        {
            var mapRoot = GetMapRoot();

            m_map.size = mapRoot.size;

            var mapBlocks = new List <MapBlock>();

            for (var i = 0; i < mapRoot.transform.childCount; i++)
            {
                var mapBlockTransform  = mapRoot.transform.GetChild(i);
                var mapBlockIdentifier = mapBlockTransform.GetComponent <MapBlockIdentifier>();
                if (mapBlockIdentifier != null)
                {
                    mapBlocks.Add(new MapBlock
                    {
                        entityType = mapBlockIdentifier.entityType,
                        position   = new Vector2Int(Mathf.RoundToInt(mapBlockTransform.localPosition.x - 0.5f), Mathf.RoundToInt(mapBlockTransform.localPosition.y - 0.5f)),
                        direction  = DirectionUtils.DisplacementToDirection(new Vector2(mapBlockTransform.up.x, mapBlockTransform.up.y)),
                    });
                }
            }
            m_map.blocks = mapBlocks.ToArray();

            EditorUtility.SetDirty(m_map);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
Exemple #6
0
        public static void PrepareTexture(Chunk chunk, ref Vector3Int localPos, Vector2[] data, Direction direction, TextureCollection[] textureCollections, bool rotated)
        {
            Rect texture  = textureCollections[(int)direction].GetTexture(chunk, ref localPos, direction);
            bool backface = DirectionUtils.IsBackface(direction);

            PrepareTexture(data, ref texture, rotated, backface);
        }
Exemple #7
0
    public override void BuildFace(Chunk chunk, Vector3[] vertices, Color32[] palette, ref BlockFace face, bool rotated)
    {
        bool backFace = DirectionUtils.IsBackface(face.side);

        var pools = Globals.WorkPool.GetPool(chunk.ThreadID);
        var verts = pools.Vector3ArrayPool.PopExact(4);
        var cols  = pools.Color32ArrayPool.PopExact(4);

        {
            verts[0] = vertices[0];
            verts[1] = vertices[1];
            verts[2] = vertices[2];
            verts[3] = vertices[3];

            cols[0] = palette[face.block.Type];
            cols[1] = palette[face.block.Type];
            cols[2] = palette[face.block.Type];
            cols[3] = palette[face.block.Type];

            BlockUtils.AdjustColors(chunk, cols, face.light);

            RenderGeometryBatcher batcher = chunk.RenderGeometryHandler.Batcher;
            batcher.AddFace(face.materialID, verts, cols, backFace);
        }

        pools.Color32ArrayPool.Push(cols);
        pools.Vector3ArrayPool.Push(verts);
    }
Exemple #8
0
        private void OnTriggerEnter2D(Collider2D collision)
        {
            if (!collision.CompareTag("Nail Attack") || Time.time < _nextTime)
            {
                return;
            }

            _nextTime = Time.time + 0.25f;

            GameCameras cam = GameCameras.instance;

            if (cam != null)
            {
                cam.cameraShakeFSM.SendEvent("EnemyKillShake");
            }

            float        degrees      = 0f;
            PlayMakerFSM damagesEnemy = PlayMakerFSM.FindFsmOnGameObject(collision.gameObject, "damages_enemy");

            if (damagesEnemy != null)
            {
                degrees = damagesEnemy.FsmVariables.FindFsmFloat("direction").Value;
            }

            Vector3 position = Ref.Hero.transform.position;
            Vector3 euler    = Vector3.zero;

            switch (DirectionUtils.GetCardinalDirection(degrees))
            {
            case 0:
                Ref.Hero.RecoilLeft();
                position = new Vector3(position.x + 2, position.y, 0.002f);
                break;

            case 1:
                Ref.Hero.RecoilDown();
                position = new Vector3(position.x, position.y + 2, 0.002f);
                euler    = new Vector3(0, 0, 90);
                break;

            case 2:
                Ref.Hero.RecoilRight();
                position = new Vector3(position.x - 2, position.y, 0.002f);
                euler    = new Vector3(0, 0, 180);
                break;

            default:
                position = new Vector3(position.x, position.y - 2, 0.002f);
                euler    = new Vector3(0, 0, 270);
                break;
            }

            GameObject effect = ObjectCache.TinkEffect;

            effect.transform.localPosition            = position;
            effect.transform.localRotation            = Quaternion.Euler(euler);
            effect.GetComponent <AudioSource>().pitch = (85 + Rnd.Next(30)) / 100f;

            effect.SetActive(true);
        }
    public void HandleAiming()
    {
        closestPos = DirectionUtils.CalculateClosestDirection(target.position, transform.position);

        Vector3 aimDirection = (closestPos - transform.position).normalized;

        angle = Mathf.Atan2(aimDirection.y, aimDirection.x) * Mathf.Rad2Deg;



        transform.eulerAngles = new Vector3(0, 0, angle);


        Vector3 localScale       = Vector3.one;
        Vector3 playerLocalScale = Vector3.one;

        if (angle > 90 || angle < -90)
        {
            localScale.y       = -1;
            playerLocalScale.x = -1;
        }
        else
        {
            localScale.y       = 1;
            playerLocalScale.x = 1;
        }
        transform.localScale        = localScale;
        Sprite.transform.localScale = playerLocalScale;
    }
Exemple #10
0
    private bool isPlayerEliminated(SPlayer sp, PlayerLocation startLocation, Tile t)
    {
        if (t == null || startLocation.Coordinate != t.Coordinate)
        {
            return(false);
        }

        int positionAfterPath = t.GetPathConnection(startLocation.PositionOnTile);

        Vector2Int     newCoord = startLocation.Coordinate + DirectionUtils.DirectionToVector(DirectionUtils.IntToDirection(positionAfterPath));
        int            newPos   = DirectionUtils.AdjacentPosition(positionAfterPath);
        PlayerLocation pl       = new PlayerLocation(newCoord, newPos);

        if (!isPositionInBoard(newCoord) || GetPlayersAtLocation(pl, sp).Count > 0)
        {
            return(true);
        }

        if (m_placedTiles.ContainsKey(newCoord))
        {
            return(isPlayerEliminated(sp, pl, m_placedTiles [newCoord]));
        }

        return(false);
    }
    public override bool OnSetUp(Hashtable config, World world)
    {
        if (!base.OnSetUp(config, world))
        {
            return(false);
        }

        connectsToNames = _GetPropertyFromConfig(config, "connectsToNames", "").Replace(" ", "").Split(',');
        connectsToSolid = _GetPropertyFromConfig(config, "connectsToSolid", true);

        for (int dir = 0; dir < 6; dir++)
        {
            var       d         = m_datas[dir] = new CustomMeshBlockData();
            var       i         = m_info[dir] = new MeshBlockInfo();
            Direction direction = DirectionUtils.Get(dir);

            i.fileLocation = _GetPropertyFromConfig(config, direction + "FileLocation", "");
            if (string.IsNullOrEmpty(i.fileLocation))
            {
                continue;
            }

            string textureName = _GetPropertyFromConfig(config, direction + "Texture", "");
            d.textures = world.textureProvider.GetTextureCollection(textureName);

            i.meshOffset = new Vector3(
                float.Parse(_GetPropertyFromConfig(config, direction + "XOffset", "0"), CultureInfo.InvariantCulture),
                float.Parse(_GetPropertyFromConfig(config, direction + "YOffset", "0"), CultureInfo.InvariantCulture),
                float.Parse(_GetPropertyFromConfig(config, direction + "ZOffset", "0"), CultureInfo.InvariantCulture)
                );
        }

        return(true);
    }
Exemple #12
0
    public override void BuildFace(Chunk chunk, Vector3[] vertices, Color32[] palette, ref BlockFace face, bool rotated)
    {
        bool backFace = DirectionUtils.IsBackface(face.side);

        LocalPools pools = chunk.pools;
        var        verts = pools.Vector3ArrayPool.PopExact(4);
        var        cols  = pools.Color32ArrayPool.PopExact(4);

        {
            verts[0] = vertices[0];
            verts[1] = vertices[1];
            verts[2] = vertices[2];
            verts[3] = vertices[3];

            cols[0] = palette[face.block.Type];
            cols[1] = palette[face.block.Type];
            cols[2] = palette[face.block.Type];
            cols[3] = palette[face.block.Type];

            BlockUtils.AdjustColors(chunk, cols, face.light);
            magicMeshConfig.AddFace(verts, cols, backFace);
        }

        pools.Color32ArrayPool.Push(cols);
        pools.Vector3ArrayPool.Push(verts);
    }
Exemple #13
0
        public void spellDam(On.HealthManager.orig_Hit orig, HealthManager self, HitInstance hitInstance)
        {
            if (hitInstance.AttackType == AttackTypes.Spell && hitInstance.Source.name.StartsWith("bullet"))
            {
                Log("Bullet impact with name " + hitInstance.Source.name);
                BulletBehavior b = fireball.GetComponent <BulletBehavior>();
                if (!b.enemyHit())
                {
                    return;
                }
                if (self.IsBlockingByDirection(
                        DirectionUtils.GetCardinalDirection(hitInstance.GetActualDirection(self.transform)),
                        hitInstance.AttackType))
                {
                    orig(self, hitInstance);
                    return;
                }

                hitEnemy(self, b.bulletType.Damage, hitInstance, b.bulletType.SoulGain);
            }
            else
            {
                orig(self, hitInstance);
            }
        }
    public override bool OnSetUp(Hashtable config, World world)
    {
        if (!base.OnSetUp(config, world))
        {
            return(false);
        }

        connectsToNames = _GetPropertyFromConfig(config, "connectsToNames", "").Replace(" ", "").Split(',');
        connectsToSolid = _GetPropertyFromConfig(config, "connectsToSolid", true);

        for (int dir = 0; dir < 6; dir++)
        {
            var d = m_datas[dir] = new CustomMeshBlockData();

            Direction direction = DirectionUtils.Get(dir);
            if (_GetPropertyFromConfig(config, direction + "FileLocation", "") == "")
            {
                continue;
            }

            d.textures = world.textureProvider.GetTextureCollection(_GetPropertyFromConfig(config, direction + "Texture", ""));

            Vector3 meshOffset;
            meshOffset.x = float.Parse(_GetPropertyFromConfig(config, direction + "XOffset", "0"), CultureInfo.InvariantCulture);
            meshOffset.y = float.Parse(_GetPropertyFromConfig(config, direction + "YOffset", "0"), CultureInfo.InvariantCulture);
            meshOffset.z = float.Parse(_GetPropertyFromConfig(config, direction + "ZOffset", "0"), CultureInfo.InvariantCulture);

            SetUpMesh(
                world.config.meshFolder + "/" + _GetPropertyFromConfig(config, direction + "FileLocation", ""),
                meshOffset, out d.tris, out d.verts, out d.uvs, out d.colors
                );
        }

        return(true);
    }
Exemple #15
0
        public void CameraInterp(float value)
        {
            if (value < -1)
            {
                return;
            }
            var prev = (int)(value + 1);
            var next = (int)(Math.Ceiling(value) + 1);

            if (next > 2)
            {
                next = 2;
            }

            var pos1  = ModePositions[prev];
            var pos2  = ModePositions[next];
            var targ1 = ModeTargets[prev] - pos1;
            var targ2 = ModeTargets[next] - pos2;

            value = (float)DirectionUtils.PosMod(value, 1.0);
            var camvec = Vector3.Lerp(targ1, targ2, value);
            var campos = Vector3.Lerp(pos1, pos2, value);

            campos += (float)Math.Sin(value * Math.PI) * SinTransitions[prev];

            Cam.Position = campos;
            Cam.Target   = campos + camvec;
        }
Exemple #16
0
        public override VMPrimitiveExitCode Execute(VMStackFrame context, VMPrimitiveOperand args)
        {
            var operand = (VMGetDirectionToOperand)args;

            var      obj2 = context.StackObject;
            VMEntity obj1;

            //todo: wrong flag below?
            if ((operand.Flags & 1) == 0)
            {
                obj1 = context.Caller;
            }
            else
            {
                obj1 = context.VM.GetObjectById(VMMemory.GetVariable(context, operand.ObjectScope, operand.OScopeData));
            }

            var pos1 = obj1.Position;
            var pos2 = obj2.Position;

            var direction = DirectionUtils.Normalize(Math.Atan2(pos2.x - pos1.x, pos1.y - pos2.y));

            var result = Math.Round((DirectionUtils.PosMod(direction, Math.PI * 2) / Math.PI) * 4);

            VMMemory.SetVariable(context, operand.ResultOwner, operand.ResultData, (short)result);

            return(VMPrimitiveExitCode.GOTO_TRUE);
        }
Exemple #17
0
    public override void BuildBlock(Chunk chunk, ref Vector3Int localPos, int materialID)
    {
        for (int d = 0; d < 6; d++)
        {
            Direction dir = DirectionUtils.Get(d);

            BlockFace face = new BlockFace
            {
                block      = null,
                pos        = localPos,
                side       = dir,
                light      = new BlockLightData(0),
                materialID = materialID
            };

            BuildFace(chunk, null, null, ref face, false);
        }

        RenderGeometryBatcher batcher = chunk.GeometryHandler.Batcher;

        var  d2      = customMeshConfig.data;
        Rect texture = d2.textures.GetTexture(chunk, ref localPos, Direction.down);

        batcher.AddMeshData(materialID, d2.tris, d2.verts, d2.colors, d2.uvs, ref texture, localPos);
    }
Exemple #18
0
 private void OnSwiped(Direction direction)
 {
     if (PlayerSettings.MovementEnabled)
     {
         cardShepherd.MoveCard(DirectionUtils.DirectionToVector2(direction));
     }
 }
Exemple #19
0
        public void UpdateDynamicMultitile(VMContext context)
        {
            //check adjacent tiles for objects of this type and add them to our multitile group
            //also build adjacency flags for use by the Dynamic Multitile Update entry point
            int flags = 0;

            foreach (var ent in context.VM.Entities)
            {
                if (ent == this)
                {
                    continue;
                }
                var diff = ent.Position - Position;
                if (ent.Object.OBJ.GUID == this.Object.OBJ.GUID && Math.Abs(diff.TileX) < 2 && Math.Abs(diff.TileY) < 2)
                {
                    if (ent.MultitileGroup != MultitileGroup)
                    {
                        var oldObjects = ent.MultitileGroup.Objects;
                        MultitileGroup.Combine(ent.MultitileGroup);
                        foreach (var obj in oldObjects)
                        {
                            obj.UpdateDynamicMultitile(context);
                        }
                    }

                    var direction = DirectionUtils.Normalize(Math.Atan2(ent.Position.x - Position.x,Position.y - ent.Position.y));
                    var result    = (int)Math.Round((DirectionUtils.PosMod(direction,Math.PI * 2) / Math.PI) * 4);

                    var dirDiff = (int)DirectionUtils.PosMod(result - DirectionToWallOff(Direction) * 2,8);

                    flags |= 1 << dirDiff;
                }
            }
            ExecuteEntryPoint(8,context,true,null,new short[] { (short)flags,0,0,0 });
        }
Exemple #20
0
        public bool MovePlayer(Direction direction)
        {
            Point newPos = Container.Adventure.Player.Position + DirectionUtils.DirectionToVector(direction);

            if (Container.Adventure.SetActorPosition(Container.Adventure.Player, newPos))
            {
                return(true);
            }

            Monster monster = Container.Adventure.GetMonsterAt(newPos);

            if (monster != null)
            {
                Attack(Container.Adventure.Player, monster);
                return(true);
            }

            NonPlayerCharacter npc = Container.Adventure.GetNpcAt(newPos);

            if (npc != null)
            {
                npc.ShowConversation();
            }

            return(false);
        }
    private void CreatePlasma(Vector3 sofaPos, Direction sofaDir, out Vector3 plasmaPos)
    {
        Vector3 position = sofaPos;

        position.y = _plasmaTVPrefab.transform.position.y + 10f;
        Direction dir = sofaDir.GetOpposite();

        switch (dir)
        {
        case Direction.Up:
        case Direction.Down:
            position.z -= 100f * dir.CreateSign();
            position.x += 0.5f;
            break;

        case Direction.Right:
        case Direction.Left:
            position.z += 0.5f;
            position.x -= 100f * dir.CreateSign();
            break;
        }
        var plasmaTV_pos = plasmaPos = RoomClamp(position);

        var plasmaTV = (Transform)Instantiate(_plasmaTVPrefab, plasmaTV_pos, DirectionUtils.DirectionToQuaternion(dir));

        plasmaTV.parent = _devices;
    }
    private void CreatePhone()
    {
        //spawnNode = GetEmptyCornerNodes(_emptyNodes).First(); //TEST only
        SpawnNode spawnNode = RandomFindFarEmptyNodeFrom(5, 3, "Phone", SpawnNodeType.Connector, SpawnNodeType.CornerConnector);

        if (spawnNode == null)
        {
            spawnNode = GetFarEmptyNodeFrom(SpawnNodeType.Connector, SpawnNodeType.CornerConnector);
        }

        Vector3 pos = spawnNode.GridNode.Position;

        pos.y = _phonePrefab.position.y + 10f;
        switch (spawnNode.MainDirection)
        {
        case Direction.Up:
        case Direction.Down:
            pos.z -= 0.5f * spawnNode.MainDirection.CreateSign();
            break;

        case Direction.Left:
        case Direction.Right:
            pos.x -= 0.5f * spawnNode.MainDirection.CreateSign();
            break;
        }

        var phone = (Transform)Instantiate(_phonePrefab, pos, DirectionUtils.DirectionToQuaternion(spawnNode.MainDirection));

        phone.parent = _devices;

        //SpawnNodeType.Device  - не нужно
        CreateConnector(spawnNode, spawnNode.MainDirection);
    }
    private void CreateConnector(SpawnNode spawnNode, Direction direction)
    {
        var startConnector_pos = spawnNode.GridNode.AstarNode.position.ToVector3();

        startConnector_pos.y = _connectorPrefab.position.y + 10f;

        switch (direction)
        {
        case Direction.Up:
        case Direction.Down:
            startConnector_pos.z -= 0.5f * direction.CreateSign();
            break;

        case Direction.Left:
        case Direction.Right:
            startConnector_pos.x -= 0.5f * direction.CreateSign();
            break;
        }

        var connector = (Transform)Instantiate(_connectorPrefab, startConnector_pos, DirectionUtils.DirectionToQuaternion(direction));

        connector.parent = SceneContainers.Connectors;

        RemoveNodeFromEmptyNodes(spawnNode, SpawnNodeType.Connector);
    }
Exemple #24
0
        public virtual Vector2[] GetScrollBasis(bool multiplied)
        {
            if (State.CameraMode == CameraRenderMode._3D)
            {
                var cam = State.Cameras.ActiveCamera as CameraController3D;
                var mat = Matrix.CreateRotationZ(-(cam?.RotationX ?? 0));
                var z   = multiplied ? ((1 + (float)Math.Sqrt(cam?.Zoom3D ?? 1)) / 2) : 1;
                return(new Vector2[] {
                    Vector2.Transform(new Vector2(0, -1), mat) * z,
                    Vector2.Transform(new Vector2(1, 0), mat) * z
                });
            }
            else
            {
                var cam  = State.Cameras.ActiveCamera as CameraController2D;
                var rcam = cam.Camera;
                var rot  = (float)DirectionUtils.PosMod((-0.5 + (int)rcam.Rotation - rcam.RotateOff / 90) * (-Math.PI / 2), Math.PI * 2);

                var mat = Matrix.CreateRotationZ(rot);
                int z   = (multiplied) ? (((1 << (3 - (int)State.Zoom)) * 3) / 2) : 1;
                return(new Vector2[] {
                    Vector2.Transform(new Vector2(0, -1), mat) * z,
                    Vector2.Transform(new Vector2(1, 0), mat) * z * 2
                });
            }

            /*
             * else
             * {
             *  Vector2[] output = new Vector2[2];
             *  switch (State.Rotation)
             *  {
             *      case WorldRotation.TopLeft:
             *          output[1] = new Vector2(2, 2);
             *          output[0] = new Vector2(1, -1);
             *          break;
             *      case WorldRotation.TopRight:
             *          output[1] = new Vector2(2, -2);
             *          output[0] = new Vector2(-1, -1);
             *          break;
             *      case WorldRotation.BottomRight:
             *          output[1] = new Vector2(-2, -2);
             *          output[0] = new Vector2(-1, 1);
             *          break;
             *      case WorldRotation.BottomLeft:
             *          output[1] = new Vector2(-2, 2);
             *          output[0] = new Vector2(1, 1);
             *          break;
             *  }
             *  if (multiplied)
             *  {
             *      int multiplier = ((1 << (3 - (int)State.Zoom)) * 3) / 2;
             *      output[0] *= multiplier;
             *      output[1] *= multiplier;
             *  }
             *  return output;
             * }
             */
        }
Exemple #25
0
    public void IntDirectionConversion()
    {
        Assert.AreEqual(DirectionUtils.DirectionToVector(Direction.LEFT), new Vector2Int(-1, 0));
        Assert.AreEqual(DirectionUtils.DirectionToVector(Direction.NONE), new Vector2Int(0, 0));

        Assert.AreEqual(DirectionUtils.VectorToDirection(new Vector2Int(-1, 0)), Direction.LEFT);
        Assert.AreEqual(DirectionUtils.VectorToDirection(new Vector2Int(0, 0)), Direction.NONE);
    }
 private void SetHead(VMAvatar head, int i)
 {
     i = (int)DirectionUtils.PosMod(i, ActiveHeads.Count);
     head.HeadOutfit = new FSO.SimAntics.Model.VMOutfitReference(new Outfit()
     {
         TS1AppearanceID = ActiveHeads[i] + ".apr", TS1TextureID = ActiveHeadTex[i]
     });
 }
Exemple #27
0
    // Start is called before the first frame update
    void Start()
    {
        turnManager = GameObject.FindObjectOfType <TurnManager>();
        turnManager.onEnemiesTurn += ExecuteTurn;

        spriteRenderer   = GetComponent <SpriteRenderer>();
        spawnCoordinates = DirectionUtils.GetBulletCoordinates(cannonType);
        spawnDirections  = DirectionUtils.GetBulletDirection(cannonType);
    }
        private void SetBody(VMAvatar body, int i)
        {
            i = (int)DirectionUtils.PosMod(i, ActiveBodies.Count);
            var oft = new Outfit()
            {
                TS1AppearanceID = ActiveBodies[i] + ".apr", TS1TextureID = ActiveBodyTex[i]
            };

            if (!Pet)
            {
                var code = CurrentCode[0];
                if (CurrentCode[1] != 'a')
                {
                    code = 'u';
                }
                var hg = ActiveHandgroupTex[i];
                oft.LiteralHandgroup = new HandGroup()
                {
                    TS1HandSet = true,
                    LightSkin  = new HandSet()
                    {
                        LeftHand = new Hand()
                        {
                            Idle = new Gesture()
                            {
                                Name = "h" + code + "lo.apr", TexName = "huao" + hg
                            },
                            Pointing = new Gesture()
                            {
                                Name = "h" + code + "lp.apr", TexName = "huap" + hg
                            },
                            Fist = new Gesture()
                            {
                                Name = "h" + code + "lc.apr", TexName = "huac" + hg
                            }
                        },
                        RightHand = new Hand()
                        {
                            Idle = new Gesture()
                            {
                                Name = "h" + code + "ro.apr", TexName = "huao" + hg
                            },
                            Pointing = new Gesture()
                            {
                                Name = "h" + code + "rp.apr", TexName = "huap" + hg
                            },
                            Fist = new Gesture()
                            {
                                Name = "h" + code + "rc.apr", TexName = "huac" + hg
                            }
                        }
                    }
                };
            }

            body.BodyOutfit = new FSO.SimAntics.Model.VMOutfitReference(oft);
        }
Exemple #29
0
        public async Task <DeviceData> GetDeviceData(string userId, string deviceId)
        {
            var owner = await _deviceSyncStore.DeviceClaimedByAsync(deviceId);

            if (owner != userId)
            {
                throw new DeviceAccessException(deviceId, userId, owner);
            }
            var activeItem = await _focusStore.GetActiveItem(userId);

            if (null == activeItem)
            {
                return(new DeviceData()
                {
                    Event = null,
                    Directions = null
                });
            }
            if (null == activeItem.CalendarEventId && null == activeItem.CalendarEventFeedId)
            {
                return(null); //other items are not supported yet
            }
            var evt = await _calendarServiceClient.Users[userId].Feeds[activeItem.CalendarEventFeedId].Events.Get(activeItem.CalendarEventId);

            if (null == evt)
            {
                return(null);
            }
            Route route = null;

            if (null != activeItem.DirectionsKey)
            {
                route = DirectionUtils.SelectRoute(await _travelServiceClient.Directions[activeItem.DirectionsKey].GetAsync());
            }
            return(new DeviceData()
            {
                Event = new EventData()
                {
                    Start = evt.Start,
                    Subject = evt.Subject
                },
                Directions = null != route ? new DirectionsData
                {
                    ArrivalTime = route.ArrivalTime,
                    DepartureTime = route.DepatureTime,
                    Legs = route.Steps.Select(v => new LegData()
                    {
                        ArrivalStop = v.ArrivalStop.Name,
                        DepartureStop = v.DepartureStop.Name,
                        DepartureTime = v.DepartureTime,
                        Direction = new Regex("^Wien\\s").Replace(v.Headsign ?? "", ""),
                        Line = v.Line.ShortName
                    }).ToArray()
                } : null
            });
        }
Exemple #30
0
    void Update()
    {
        var position          = transform.position;
        var mouseDirection    = DirectionUtils.GetMouseDirectionTo(position);
        var inversedDirection = new Vector2(-mouseDirection.x, -mouseDirection.y);
        var target            = new Vector3(inversedDirection.x, inversedDirection.y, 0);

        _line.SetPosition(0, new Vector3(position.x, position.y, 0));
        _line.SetPosition(1, target * Length);
    }