public GameObject Construct(PositionAndRotation initialPosition, Allegiance allegiance) { var clone = Template.CreateInstance(initialPosition); clone.GetComponent <EnemyBehavior>().Initialize(this, allegiance); return(clone); }
public PositionAndRotation GetWarpableObjectLocalTransforms(WarppableObject obj) { PositionAndRotation posAndRot = new PositionAndRotation(); posAndRot.lPosition = _axis.InverseTransformPoint(obj.transform.position); // Getting the position in the axis of the portal posAndRot.lRotation = Quaternion.Inverse(_axis.rotation) * obj.transform.rotation; // finding local rotation - we are taking global rotaion and substracting it by Axis rotation. // in rotations, substraction is inverse return(posAndRot); }
public TileBehavior Construct( PositionAndRotation location, WorldGrid grid, GridCoordinate gridCoordinate) { var behavior = Template.CreateInstance(location) .GetComponent <TileBehavior>(); return(behavior); }
void Update() { GameObject[] cardsPlayer = GameObject.FindGameObjectsWithTag(nameCards); if (cardsPlayer != null) { for (int i = 0; i < cardsPlayer.Length; i++) { PositionAndRotation card = PlacingCard(i, (sbyte)cardsPlayer.Length); cardsPlayer[i].transform.SetPositionAndRotation(card.position, card.rotation); } } }
public void UpdateMe() { if (_play) { _nowTrans = _replayData.Load(UpdateManager.frame); if (_nowTrans != null) { transform.SetPositionAndRotation(_nowTrans.position, _nowTrans.rotation); } } else { if (_replayData == null) { return; } _nowTrans.position = transform.position; _nowTrans.rotation = transform.rotation; _replayData.Write(_nowTrans); } }
public PositionAndRotation[] PointsForNewCards(byte countAddCard) { GameObject[] cardsPlayer = GameObject.FindGameObjectsWithTag(nameCards); sbyte count; if (cardsPlayer != null) { count = (sbyte)cardsPlayer.Length; } else { count = 0; } PositionAndRotation[] newCard = new PositionAndRotation[countAddCard]; for (int i = 0; i < countAddCard; i++) { newCard[i] = PlacingCard(count + i, (sbyte)(count + countAddCard)); } return(newCard); }
// Clone an existing unity object with a specific position and rotation and owner public static T CreateInstance <T>(this T original, Transform owner, PositionAndRotation position) where T : UnityObject => UnityObject.Instantiate(original, position.Position, position.Rotation, owner);
/// <inheritdoc /> public override IUsable CreateAndAttachUsable(PlayerBehavior actor, Transform parent, PositionAndRotation location) { var logic = new PlaceableBehaviorLogic(); logic.Initialize(this); return(logic); }
/// <summary> /// 受信したメッセージの内容によって処理を行う /// </summary> /// <param name="unit">受信情報</param> void Parse(ReceivedUnit unit) { //なるべくメッセージごと1関数で実装する UDPMessage type = unit.message.ToUDPMessage(); int ackRegisteredIndex = ackWaiting.IndexOfPort(unit.senderEP.Port); int connectedIndex = connectedPlayerEPs.IndexOfPort(unit.senderEP.Port); print("メッセージを受信"); switch (type) { case UDPMessage.Ack: { print(ackRegisteredIndex); if (ackRegisteredIndex == -1) { break; } connectedPlayerEPs.Add(unit.senderEP); ackWaiting.RemoveAt(ackRegisteredIndex); if (connectedPlayerEPs.Count == 1) { sendThread = new Thread(new ThreadStart(ThreadSend)); sendThread.Start(); } print("他の人から接続がありました"); byte[] message = UDPMessage.AckComplete.ToByte(); client.SendAsync(message, message.Length, unit.senderEP); otherPlayerObjects[connectedPlayerEPs.Count - 1].SetActive(true); break; } case UDPMessage.AckComplete: { print(ackRegisteredIndex); if (ackRegisteredIndex == -1) { break; } connectedPlayerEPs.Add(unit.senderEP); ackWaiting.RemoveAt(ackRegisteredIndex); if (connectedPlayerEPs.Count == 1) { sendThread = new Thread(new ThreadStart(ThreadSend)); sendThread.Start(); } print("他の人から接続がありました"); otherPlayerObjects[connectedPlayerEPs.Count - 1].SetActive(true); break; } case UDPMessage.PosUpdate: { Vector3 pos = unit.message.ToVector3(4); float Yrot = BitConverter.ToSingle(unit.message, 16); if (otherPlayerInfo.Count <= connectedIndex) { //プレイヤーのSmoothedMovementがない場合 PositionAndRotation newPlayer = new PositionAndRotation(sendPerSecond); newPlayer.UpdateInformation(pos, Yrot); otherPlayerInfo.Add(newPlayer); } else { otherPlayerInfo[connectedIndex].UpdateInformation(pos, Yrot); } break; } default: { print("malformed packet!!!!!!!!!"); break; } } }
public void Add(PositionAndRotation par) { alsoVisible.Add(par); }
public RenderPositionAndRotation(Vector3 position, Quaternion rotation) { this.linked = new PositionAndRotation(position, rotation); }
/// <inheritdoc /> public abstract IUsable CreateAndAttachUsable(PlayerBehavior actor, Transform parent, PositionAndRotation location);
/// <inheritdoc /> public override IUsable CreateAndAttachUsable(PlayerBehavior actor, Transform parent, PositionAndRotation location) { var instance = _localTemplateCopy.Value.CreateInstance(parent, location); var projectileWeapon = instance.GetComponent <ProjectileWeaponBehavior>(); projectileWeapon.Initialize(this); instance.transform.localPosition -= HeldPosition.Offset; return(projectileWeapon); }