コード例 #1
0
 public override void ForcePlaceAt(GridBlock pos)
 {
     if (spawnedObject == null)
     {
         spawnedObject = Instantiate(Prefab, pos.Position, Quaternion.identity);
     }
     ApplyPlacement(null, pos, pos.Position);
 }
コード例 #2
0
    public override void StartPlacing(Player player, GridPosition pos, Vector3 worldPos)
    {
        if (Reference.Reference != null)
        {
            return;
        }

        if (spawnedObject == null)
        {
            spawnedObject = Instantiate(Prefab, worldPos, Quaternion.identity);
        }
        spawnedObject.gameObject.SetActive(true);
        spawnedObject.transform.position = worldPos;
    }
コード例 #3
0
    public override void ApplyPlacement(Player player, GridBlock block, Vector3 worldPos)
    {
        if (Reference.Reference != null)
        {
            return;
        }
        spawnedObject.transform.position = block.GridPosition.WorldPosition;
        Reference.Reference = spawnedObject;

        spawnedObject.SetupObject(block);
        spawnedObject.transform.SetParent(PlaceableParent.Reference);
        WorldObjectList.Add(spawnedObject);

        spawnedObject = null;
    }